diff --git a/entities/notifiers/homegroup_telegram.yaml b/entities/notifiers/homegroup_telegram.yaml new file mode 100644 index 0000000..e00fe9c --- /dev/null +++ b/entities/notifiers/homegroup_telegram.yaml @@ -0,0 +1,5 @@ +# Notifier for Telegram-Gruppe "Zu Hause" +# https://www.home-assistant.io/integrations/notify/ +name: homegroup_telegram +platform: telegram +chat_id: !secret telegram_homegroup \ No newline at end of file diff --git a/entities/sensors/waste_sensors.yaml b/entities/sensors/waste_sensors.yaml index dafd5dd..6d39b4b 100644 --- a/entities/sensors/waste_sensors.yaml +++ b/entities/sensors/waste_sensors.yaml @@ -6,7 +6,7 @@ name: waste_gray details_format: upcoming count: 4 - value_template: '{{value.types|join(" + ")}} in {{value.daysTo}} Tag(en)' + value_template: 'am {{value.date.strftime("%d.%m.%Y")}} in {{value.daysTo}} Tagen' date_template: '{{value.date.strftime("%d.%m.%Y")}}' types: - 'graue Tonne' @@ -15,7 +15,7 @@ name: waste_yellow details_format: upcoming count: 4 - value_template: '{{value.types|join(" + ")}} in {{value.daysTo}} Tag(en)' + value_template: 'am {{value.date.strftime("%d.%m.%Y")}} in {{value.daysTo}} Tagen' date_template: '{{value.date.strftime("%d.%m.%Y")}}' types: - 'gelbe Tonne/Sack' @@ -24,25 +24,16 @@ name: waste_brown details_format: upcoming count: 4 - value_template: '{{value.types|join(" + ")}} in {{value.daysTo}} Tag(en)' + value_template: 'am {{value.date.strftime("%d.%m.%Y")}} in {{value.daysTo}} Tagen' date_template: '{{value.date.strftime("%d.%m.%Y")}}' types: - 'braune Tonne' -- platform: waste_collection_schedule - name: waste_green - details_format: upcoming - count: 4 - value_template: '{{value.types|join(" + ")}} in {{value.daysTo}} Tag(en)' - date_template: '{{value.date.strftime("%d.%m.%Y")}}' - types: - - 'grüne Tonne' - - platform: waste_collection_schedule name: waste_bulk details_format: upcoming count: 4 - value_template: '{{value.types|join(" + ")}} in {{value.daysTo}} Tag(en)' + value_template: 'am {{value.date.strftime("%d.%m.%Y")}} in {{value.daysTo}} Tagen' date_template: '{{value.date.strftime("%d.%m.%Y")}}' types: - 'Sperrmüll' @@ -51,11 +42,20 @@ name: waste_pollutants details_format: upcoming count: 4 - value_template: '{{value.types|join(" + ")}} in {{value.daysTo}} Tag(en)' + value_template: 'am {{value.date.strftime("%d.%m.%Y")}} in {{value.daysTo}} Tagen' date_template: '{{value.date.strftime("%d.%m.%Y")}}' types: - 'Schadstoffe' +- platform: waste_collection_schedule + name: waste_green + details_format: upcoming + count: 4 + value_template: 'am {{value.date.strftime("%d.%m.%Y")}} in {{value.daysTo}} Tagen' + date_template: '{{value.date.strftime("%d.%m.%Y")}}' + types: + - 'grüne Tonne' + - platform: waste_collection_schedule name: waste_all count: 4 diff --git a/integrations/telegram_bot.yaml b/integrations/telegram_bot.yaml index 9605373..bf2bbf6 100644 --- a/integrations/telegram_bot.yaml +++ b/integrations/telegram_bot.yaml @@ -7,4 +7,5 @@ telegram_bot: allowed_chat_ids: - !secret telegram_dev # dev chat - !secret telegram_chk # christian + - !secret telegram_homegroup # home-gruppe parse_mode: html \ No newline at end of file diff --git a/integrations/waste_collection_schedule.yaml b/integrations/waste_collection_schedule.yaml index 5628026..1bba9e9 100644 --- a/integrations/waste_collection_schedule.yaml +++ b/integrations/waste_collection_schedule.yaml @@ -17,16 +17,16 @@ waste_collection_schedule: show: false - type: grüne Tonne alias: grüne Tonne - picture: /local/images/waste/tonnegruen.png + picture: /local/images/waste/tonnegruen.svg - type: graue Tonne alias: graue Tonne - picture: /local/images/waste/tonnegrau.png + picture: /local/images/waste/tonnegrau.svg - type: braune Tonne alias: braune Tonne - picture: /local/images/waste/tonnebraun.png + picture: /local/images/waste/tonnebraun.svg - type: gelbe Tonne/Sack alias: gelbe Tonne/Sack - picture: /local/images/waste/tonnegelb.png + picture: /local/images/waste/tonnegelb.svg - type: Sperrmüll alias: Sperrmüll - type: Schadstoffe diff --git a/scripts/telegram_test.yaml b/scripts/telegram_test.yaml index cb7edce..a409287 100644 --- a/scripts/telegram_test.yaml +++ b/scripts/telegram_test.yaml @@ -8,6 +8,9 @@ sequence: - service: notify.dev_telegram data: message: test from Telegram with service "notify.dev_telegram" + - service: notify.homegroup_telegram + data: + message: test from Telegram with service "notify.homegroup_telegram" mode: single # alias: Telegram Test1 # mode: single diff --git a/scripts/waste_notification.yaml b/scripts/waste_notification.yaml index a7c2544..7c9cf3c 100644 --- a/scripts/waste_notification.yaml +++ b/scripts/waste_notification.yaml @@ -1,6 +1,31 @@ # https://www.home-assistant.io/integrations/script alias: Skript Müllbenachrichtigung +variables: + action_required: > + {% + set tomorrow = strptime((now()+timedelta(days=+1)).strftime('%Y-%m-%d'),"%Y-%m-%d") + %} + {% + set wasteDateString = states('sensor.waste_all').split("|")[2] + %} + {% + set wasteType = states('sensor.waste_all').split("|")[0] + %} + {# + set wasteDateString = "19.11.2021" + #} + {% + set wasteDate = strptime(wasteDateString,"%d.%m.%Y") + %} + {% if tomorrow == wasteDate %} + True + {% else %} + False + {% endif %} sequence: - - service: notify.dev_telegram + - condition: template + value_template: "{{ action_required }}" + - service: notify.homegroup_telegram data: - message: Mülldatem werden ausgewertet {{ states('sensor.tonnenbutton') }} \ No newline at end of file + message: >- + {{ states('sensor.waste_all').split("|")[0] }} muss raus \ No newline at end of file diff --git a/secrets.yaml b/secrets.yaml index dc24905..f29053a 100644 --- a/secrets.yaml +++ b/secrets.yaml @@ -7,6 +7,7 @@ some_password: welcome telegram_api_key: 448772521:AAHIIrXBVEUF7_1zYRCmGo5YHipRJyBlp7o telegram_dev: -391668323 telegram_chk: 14652347 +telegram_homegroup: -192460863 mqtt_user: mqtt_user mqtt_pw: IH88EZW4mIm9LI8oJWIK \ No newline at end of file