Skip to content

Instantly share code, notes, and snippets.

  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jcallaghan/942de52cca7a2590e26073522048f476 to your computer and use it in GitHub Desktop.
This automation is triggered in Home Assistant when the toilet is flushed. It activates the air freshener and also nags through text-to-speech to close the seat lid if it is left open.
alias: 'Bathroom - Toilet flush air freshener + tts'
trigger:
# Trigger when the toilet is flushed usng a sensor on the cistern flush arm.
platform: state
entity_id: binary_sensor.toilet_flusher_contact
to: "on"
action:
# Activate the air freshener.
- service: switch.turn_on
data:
entity_id: switch.esph_bathroom_air_freshener
# Add a delay for the seat lid sensor to close.
- delay: 00:00:04
# Check if the toilet seat lid is still up.
- condition: and
conditions:
- condition: template
value_template: "{{ is_state('binary_sensor.toilet_seat_contact_inverted', 'on') }}"
# Use TTS to say close the toilet seat lid.
- service: notify.alexa_media_bathroom_sonos
data:
message: "<say-as interpret-as='interjection'>oy</say-as>,<prosody pitch='high'> close the toilet seat lid.</prosody>"
data:
type: announce
method: speak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment