77 lines
3.9 KiB
JSON
77 lines
3.9 KiB
JSON
[
|
|
{
|
|
"id": "Watchy Calendar Agenda",
|
|
"automation": "- alias: Watchy Calendar Agenda\n description: ''\n triggers:\n - entity_id:\n - switch.watchy_56ae04_connected\n to: 'on'\n trigger: state\n conditions: []\n actions:\n - response_variable: agenda\n metadata: {}\n target:\n entity_id:\n - calendar.main\n - calendar.birthdays\n action: calendar.get_events\n data_template:\n start_date_time: '{{ today_at(\"00:00:00\") }}'\n end_date_time: '{{ today_at(\"23:59:59\") }}'\n - alias: Parse data\n variables:\n simplified: \"[\\n {% for i in (agenda['calendar.main'].events + agenda['calendar.birthdays'].events)\\\n \\ | sort(attribute=\\\"start\\\") %}\\n {% set start = as_datetime(i.start)\\\n \\ %}\\n {% set end = as_datetime(i.end) %}\\n {% if start.day == now().day\\\n \\ %}\\n {{ [(start.hour * 60 + start.minute), (end.hour * 60 + end.minute)\\\n \\ if end.day == now().day else (24 * 60), (i.summary | trim)] | to_json }},\\n\\\n \\ {% endif %}\\n {% endfor %}\\n]\\n\"\n - action: persistent_notification.create\n enabled: false\n data_template:\n message: '{{ simplified | to_json }}\n\n '\n - data_template:\n agenda_json: '{{ simplified | to_json }}'\n action: esphome.watchy_56ae04_set_agenda\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "watchy connected",
|
|
"room": "office",
|
|
"type": "switch",
|
|
"id": {
|
|
"entity_id": "switch.watchy_56ae04_connected",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "main calendar",
|
|
"room": "office",
|
|
"type": "calendar",
|
|
"id": {
|
|
"entity_id": "calendar.main",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "birthdays calendar",
|
|
"room": null,
|
|
"type": "calendar",
|
|
"id": {
|
|
"entity_id": "calendar.birthdays",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "watchy set agenda",
|
|
"room": "office",
|
|
"type": "esphome",
|
|
"id": {
|
|
"entity_id": "esphome.watchy_56ae04_set_agenda",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "Watchy Weather",
|
|
"automation": "- alias: Watchy Weather\n description: ''\n triggers:\n - entity_id:\n - switch.watchy_56ae04_request_weather\n to: 'on'\n trigger: state\n conditions: []\n actions:\n - action: rest_command.openweathermap_forecast\n response_variable: response\n data: {}\n - if:\n - condition: template\n value_template: '{{ response.status == 200 }}'\n then:\n - alias: Parse data\n variables:\n simplified: '{ \"list\": [ {% for i in response.content.list %} {{ { ''dt'':\n i.dt, ''main'': { ''feels_like'': i.main.feels_like }, ''weather'': [{ ''id'':\n i.weather.0.id }], ''sys'': { ''pod'': i.sys.pod } } }} {{ \",\" if not loop.last\n }} {% endfor %} ] }\n\n '\n - action: persistent_notification.create\n data:\n message: '{{ simplified }}'\n enabled: false\n - action: esphome.watchy_56ae04_set_weather\n data_template:\n weather_json: '{{ simplified }}'\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "watchy request weather",
|
|
"room": "office",
|
|
"type": "switch",
|
|
"id": {
|
|
"entity_id": "switch.watchy_56ae04_request_weather",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "openweathermap forecast",
|
|
"room": null,
|
|
"type": "rest_command",
|
|
"id": {
|
|
"entity_id": "rest_command.openweathermap_forecast",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "watchy set weather",
|
|
"room": "office",
|
|
"type": "esphome",
|
|
"id": {
|
|
"entity_id": "esphome.watchy_56ae04_set_weather",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |