Skip to content

Instantly share code, notes, and snippets.

@Resinchem
Created September 11, 2021 12:45
Show Gist options
  • Save Resinchem/e20a02c512bcb2b4a3fc4a2fba21d7fc to your computer and use it in GitHub Desktop.
Save Resinchem/e20a02c512bcb2b4a3fc4a2fba21d7fc to your computer and use it in GitHub Desktop.
Dryer Notifications
# =====================================
# DRYER State and Notifications
# =====================================
- alias: "Dryer Start"
trigger:
platform: numeric_state
entity_id: sensor.dryer_indicator_on #Top photoresistor
above: 0.75
condition:
condition: template
value_template: "{{ not is_state('sensor.dryer_state', 'Drying') }}"
action:
- service: mqtt.publish
data:
topic: hass/state/dryer
payload: 'Drying'
retain: 'true'
# Start 1 hour timer in case cycle stopped before complete
- service: timer.start
data:
entity_id: timer.dryer_cycle
duration: '01:00:00'
- alias: "Dryer Finished"
trigger:
platform: numeric_state
entity_id: sensor.dryer_indicator_level
above: 0.75
#above: 1.7
condition:
condition: template
value_template: "{{ is_state('sensor.dryer_state', 'Drying') }}"
action:
- service: mqtt.publish
data:
topic: hass/state/dryer
payload: 'Finished'
retain: 'true'
- alias: "Dryer Idle"
# Default to Idle status if neither indicator on and state <> drying
trigger:
platform: numeric_state
entity_id: sensor.dryer_indicator_level
below: 0.75
# below: 1.55
condition:
- condition: numeric_state
entity_id: sensor.dryer_indicator_on
below: 0.75
- condition: template
#value_template: "{{ states.sensor.dryer_state.state != 'Drying' }}"
value_template: "{{ not is_state('sensor.dryer_state', 'Drying') }}"
action:
- service: mqtt.publish
data:
topic: hass/state/dryer
payload: "Idle"
retain: 'true'
- alias: "Dryer Cycle Time Expired"
# If manually stopped, reset status to Idle after max time
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.dryer_cycle
action:
- service: mqtt.publish
data:
topic: hass/state/dryer
payload: "Idle"
retain: "true"
# ------------------------------
# Voice Notifications
# ------------------------------
- alias: "Dryer Announce"
trigger:
platform: state
entity_id: sensor.dryer_state
from: 'Drying'
to: 'Finished'
condition:
- condition: state
entity_id: input_boolean.notify_dryer
state: 'on'
action:
- service: tts.google_say
entity_id:
- media_player.all_home_devices
data_template:
message: "Your clothes are dry. Whoop, whoop."
# stop max cycle time
- service: timer.cancel
entity_id: timer.dryer_cycle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment