Skip to content

Instantly share code, notes, and snippets.

@jceloria
Created March 27, 2019 13:43
Show Gist options
  • Save jceloria/ed9b8437347878d8c312cba07d01fd66 to your computer and use it in GitHub Desktop.
Save jceloria/ed9b8437347878d8c312cba07d01fd66 to your computer and use it in GitHub Desktop.
HA calendar package
---
# ############################################################################ #
# ############################################################################ #
calendar:
# -------------------------------------------------------------------------- #
- platform: caldav
url: !secret ha_caldav_url
username: !secret ha_caldav_user
password: !secret ha_caldav_pass
custom_calendars:
- name: Shared Calendar
calendar: Home
search: '.*'
- platform: caldav
url: !secret ha_jc_caldav_url
username: !secret ha_jc_caldav_user
password: !secret ha_jc_caldav_pass
custom_calendars:
- name: JC Calendar
calendar: Private
search: '.*'
- platform: caldav
url: !secret ha_ac_caldav_url
username: !secret ha_ac_caldav_user
password: !secret ha_ac_caldav_pass
custom_calendars:
- name: AC Calendar
calendar: Private
search: '.*'
sensor:
# -------------------------------------------------------------------------- #
- platform: template
sensors:
shared_calendar:
value_template: >-
{{ states('persistent_notification.shared_calendar') }}
jc_calendar:
value_template: >-
{{ states('persistent_notification.jc_calendar') }}
ac_calendar:
value_template: >-
{{ states('persistent_notification.ac_calendar') }}
alert:
# -------------------------------------------------------------------------- #
shared_calendar:
name: Shared Calendar Event
entity_id: sensor.shared_calendar
state: 'notifying'
repeat: 15
title: >-
{{ states.persistent_notification.shared_calendar.attributes.title }}
message: >-
{{ states.persistent_notification.shared_calendar.attributes.message }}
notifiers:
- all
data:
sound: persistent
priority: 1
jc_calendar:
name: JC Calendar Event
entity_id: sensor.jc_calendar
state: 'notifying'
repeat: 15
title: >-
{{ states.persistent_notification.jc_calendar.attributes.title }}
message: >-
{{ states.persistent_notification.jc_calendar.attributes.message }}
notifiers:
- jc
data:
sound: persistent
priority: 1
ac_calendar:
name: AC Calendar Event
entity_id: sensor.ac_calendar
state: 'notifying'
repeat: 15
title: >-
{{ states.persistent_notification.ac_calendar.attributes.title }}
message: >-
{{ states.persistent_notification.ac_calendar.attributes.message }}
notifiers:
- ac
data:
sound: persistent
priority: 1
automation:
# -------------------------------------------------------------------------- #
- alias: Calendar Event Persistent Notifications
initial_state: true
trigger:
- platform: state
entity_id: group.calendar
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.options_automation_override
state: 'off'
action:
- service: persistent_notification.create
data_template:
notification_id: >-
{%- for entity in trigger.to_state.attributes.entity_id -%}
{%- if states(entity) == 'on' -%}
{{ state_attr(entity, 'friendly_name') | lower }}
{%- endif -%}
{%- endfor -%}
title: >-
{%- for entity in trigger.to_state.attributes.entity_id -%}
{%- if states(entity) == 'on' -%}
{{ state_attr(entity, 'friendly_name') }}
{%- endif -%}
{%- endfor -%}
message: >-
{%- for entity in trigger.to_state.attributes.entity_id -%}
{%- if states(entity) == 'on' -%}
{{ state_attr(entity, 'message') }}
{%- endif -%}
{%- endfor -%}
# ############################################################################ #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment