dev waste calender

This commit is contained in:
Christian Kauer 2021-11-18 11:29:09 +01:00
parent ae773a25ba
commit 7adf52b36e
7 changed files with 55 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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') }}
message: >-
{{ states('sensor.waste_all').split("|")[0] }} muss raus

View File

@ -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