-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.yaml
55 lines (52 loc) · 2.26 KB
/
configuration.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Enable python script support needed for the calendar data conversion
python_script:
# Helper boolean to disable deep sleep for ota updates (when enabled the device won't go back to sleep after waking up)
input_boolean:
disable_deep_sleep:
name: Disable Deep Sleep
icon: mdi:sleep-off
enable_debug_display:
name: Enable Debug Display
icon: mdi:toolbox
template:
# Binary sensor that indicates whether the calendar has been updated since the epaper panel was last refreshed - the screen will only refresh on wake up if true
- binary_sensor:
- name: ESP Calendar Data Update During Deep Sleep
state: >
{{ states.sensor.esp_calendar_data.last_updated > states.sensor.last_display_update.last_updated }}
# Sensor that contains the json calendar data that ESPHome then parses to display the events
- trigger:
- platform: time_pattern
minutes: "*"
action:
# Get the calendar data
- service: calendar.get_events
data:
start_date_time: "{{ now() }}"
duration:
# How many days into the future entries should be fetched
days: 10
target:
entity_id:
# Add your calendar entity id's here
- calendar.x
- calendar.y
- calendar.z
response_variable: calendar_response
# Convert the received data into our custom format that the ESPHome firmware expects via a python script
- service: python_script.esp_calendar_data_conversion
data:
calendar: "{{ calendar_response }}"
now: "{{ now().date() }}"
response_variable: calendar_converted
sensor:
- name: ESP Calendar Data
state: "OK"
attributes:
todays_day_name: >
{{ ['maandag','dinsdag','woensdag','donderdag','vrijdag','zaterdag','zondag'][now().weekday()] }}
todays_date_month_year: >
{% set months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"] %}
{{ months[now().month-1] }} {{ now().strftime('%Y') }}
closest_end_time: "{{ as_timestamp(calendar_converted.closest_end_time, default=0) }}"
entries: "{{ calendar_converted.entries }}"