Paper garbage is seldom collected, so after some mishaps I wrote this automation to remind of us collecting.
The automation is using several components.
For waste and paper garbage notification I’m using this component.
Sensor:
# Days until waste garbage is collected
- platform: template
sensors:
waste_garbage_collection:
friendly_name: Waste garbage is collected in
value_template: "{{ (( as_timestamp(strptime(states('sensor.mat_plast_og_rest'), '%d/%m/%Y')) - as_timestamp(now()) )/ (3600*24)) | round() }}"
unit_of_measurement: days
# Days until paper garbage is collected
- platform: template
sensors:
paper_garbage_collection:
friendly_name: Paper garbage is collected in
value_template: "{{ (( as_timestamp(strptime(states('sensor.papir'), '%d/%m/%Y')) - as_timestamp(now()) )/ (3600*24)) | round() }}"
unit_of_measurement: days
Automation:
# Paper garbage notification
- alias: Paper garbage notification
id: paper_garbage_notification
description: 'Flash lights light green when paper garbage collection'
trigger:
- platform: time
at: '20:00:00'
- platform: time
at: '21:00:00'
condition:
condition: and
conditions:
- condition: state
entity_id: group.all_people
state: 'home'
- condition: state
entity_id: sensor.paper_garbage_collection
state: '0'
action:
- choose:
# Tv off
- conditions:
- condition: and
conditions:
- condition: state
entity_id: remote.living_room_hub
state: 'off'
sequence:
- service: scene.create
data:
scene_id: garbage_notification_revert
snapshot_entities:
- light.hallway_ceiling_1
- light.hallway_ceiling_2
- light.kitchen_lamp
- light.sofa_lamp
- light.living_room_lamp
- light.office_ceiling
- light.attic_ceiling
- service: rest_command.rhasspy_speak
data_template:
payload_data: "Paper garbage collection tomorrow please get garbage."
- service_template: notify.pushover
data_template:
title: "Paper garbage collection"
message: "Paper garbage collection tomorrow, please get garbage."
data:
priority: 0
sound: "pianobar"
- service: homeassistant.turn_on
entity_id: group.garbage_notification_script
- delay: '20'
- service: scene.turn_on
data:
entity_id: scene.garbage_notification_revert
# User home and tv on
- conditions:
- condition: and
conditions:
- condition: state
entity_id: group.all_people
state: 'home'
- condition: state
entity_id: remote.living_room_hub
state: 'on'
sequence:
- service: scene.create
data:
scene_id: garbage_notification_revert
snapshot_entities:
- light.hallway_ceiling_1
- light.hallway_ceiling_2
- light.kitchen_lamp
- light.sofa_lamp
- light.living_room_lamp
- light.office_ceiling
- light.attic_ceiling
- service: rest_command.rhasspy_speak
data_template:
payload_data: "Paper garbage collection tomorrow please get garbage."
- service: notify.living_room_media_center
data_template:
title: "Paper garbage collection"
message: "Paper garbage collection tomorrow, please get garbage."
data:
duration: 15
font-size: max
transparency: 50%
position: bottom-right
- service_template: notify.pushover
data_template:
title: "Paper garbage collection"
message: "Paper garbage collection tomorrow, please get garbage."
data:
priority: 0
sound: "pianobar"
- service: homeassistant.turn_on
entity_id: group.garbage_notification_script
- delay: '20'
- service: scene.turn_on
data:
entity_id: scene.garbage_notification_revert