Skip to content

Instantly share code, notes, and snippets.

@reid
Created October 11, 2018 21:19
Show Gist options
  • Save reid/f4671c69c2e7d84ffe8840804d781dcc to your computer and use it in GitHub Desktop.
Save reid/f4671c69c2e7d84ffe8840804d781dcc to your computer and use it in GitHub Desktop.
Announce on Google Home when laundry is done
# Using Home Assistant 0.79.3
discovery: # Discover Google Home devices
# TP-Link TS110
switch:
- platform: tplink
name: "Washer"
host: 10.0.1.150
- platform: tplink
name: "Dryer"
host: 10.0.1.151
tts: # Text-to-Speech
- platform: google
binary_sensor:
- platform: template
sensors:
washer:
friendly_name: "Clothes Washer"
# Shut off after 5 minutes of power less than 1.5 W (standby)
delay_off:
minutes: 5
value_template: >-
{{ states.switch.washer.attributes.current_power_w | float > 1.5 }}
dryer:
friendly_name: "Clothes Dryer"
# Shut off after 1 minutes of zero power use
delay_off:
minutes: 1
value_template: >-
{{ states.switch.dryer.attributes.current_power_w | float > 0 }}
automation:
- alias: "Announce Washer Complete"
trigger:
- platform: state
entity_id: binary_sensor.washer
condition:
- condition: state
entity_id: binary_sensor.washer
state: 'off'
action:
- service: media_player.media_pause # Pause all media players
- service: tts.google_say
entity_id: media_player.googlehome4518 # Google Home, discovered by discovery component
data:
message: 'Your washing machine cycle is complete.'
- alias: "Announce Dryer Complete"
trigger:
- platform: state
entity_id: binary_sensor.dryer
condition:
- condition: state
entity_id: binary_sensor.dryer
state: 'off'
action:
- service: media_player.media_pause # Pause all media players
- service: tts.google_say
entity_id: media_player.googlehome4518 # Google Home, discovered by discovery component
data:
message: 'Your laundry is dry.'
# Optional, used for graphing power usage over time
sensor:
- platform: template
sensors:
washer_w:
friendly_name: "Washing Machine Power Consumption"
unit_of_measurement: 'W'
value_template: >-
{{ states.switch.washer.attributes.current_power_w | float }}
dryer_w:
friendly_name: "Dryer Power Consumption"
unit_of_measurement: 'W'
value_template: >-
{{ states.switch.dryer.attributes.current_power_w | float }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment