Skip to content

Instantly share code, notes, and snippets.

@Resinchem
Created January 2, 2021 02:13
Show Gist options
  • Save Resinchem/825f709a665b78f46bae93815b734903 to your computer and use it in GitHub Desktop.
Save Resinchem/825f709a665b78f46bae93815b734903 to your computer and use it in GitHub Desktop.
Washer Notification
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Washing Machine Start/Finish
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# input_boolean.notify_washer: turns voice notifications off/on - auto-off from 11 pm - 8 am
# sensor.washer_watts from Sonoff S31 w/Tasmota
- alias: 'Washer State - Start'
trigger:
platform: numeric_state
entity_id: sensor.washer_watts
above: 5
for:
minutes: 2
# Make sure washer isn't already running and delaying between cycles - don't re-trigger and cause stopwatch reset
condition:
condition: template
value_template: "{{ states.sensor.washer_state.state != 'Washing' }}"
action:
- service: mqtt.publish
data:
topic: hass/state/washer
payload: 'Washing'
retain: 'true'
- alias: 'Washer State - Idle'
trigger:
platform: numeric_state
entity_id: sensor.washer_watts
below: 5
for:
minutes: 1
action:
- service: mqtt.publish
data:
topic: hass/state/washer
payload: 'Idle'
retain: 'true'
- alias: 'Washer Finished'
trigger:
platform: state
entity_id: sensor.washer_state
from: 'Washing'
to: 'Idle'
condition:
- condition: state
entity_id: input_boolean.notify_washer
state: 'on'
action:
- service: tts.google_say
entity_id:
- media_player.all_home_devices
data_template:
message: "The washer has completed its cycle."
- alias: 'Washer Notify Off'
# disables notifications for 2 hours - via switch.wash_notify and input_boolean.notify_washer
trigger:
platform: state
entity_id: input_boolean.notify_washer
from: 'on'
to: 'off'
action:
- service: timer.start
data:
entity_id: timer.washer_notify
duration: '02:00:00'
- alias: 'Washer Notify On'
trigger:
platform: state
entity_id: input_boolean.notify_washer
from: 'off'
to: 'on'
action:
- service: timer.finish
entity_id: timer.washer_notify
- alias: 'Washer Notification Delay Expired'
# Timer expriration: Re-enable input boolean (which re-enables automation)
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.washer_notify
condition:
- condition: state
entity_id: input_boolean.voice_night_mode
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.notify_washer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment