Skip to content

Instantly share code, notes, and snippets.

@onedr0p
Created October 3, 2018 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onedr0p/0a6025cc5ef18bc78b5399bb69401669 to your computer and use it in GitHub Desktop.
Save onedr0p/0a6025cc5ef18bc78b5399bb69401669 to your computer and use it in GitHub Desktop.
packages/washing_machine.yaml
homeassistant:
customize:
package.node_anchors:
customize: &customize
package: 'Washing Machine'
expose: &expose
<<: *customize
hidden: false
not-expose: &not-expose
<<: *customize
hidden: true
# sensor.washingmachine_status:
# friendly_name: Washing Machine Status
# <<: *expose
# sensor.washingmachine_watts:
# friendly_name: Washing Machine current consumption
# <<: *expose
group:
group_washingmachine:
name: Washing Machine
entities:
- input_select.washingmachine_status
switch:
- platform: tplink
host: 192.168.1.105
name: "Washing Machine"
sensor:
- platform: template
sensors:
washingmachine_amps:
value_template: '{{ states.switch.washing_machine.attributes.current_a}}'
unit_of_measurement: 'A'
friendly_name: 'Washing Machine ampère'
washingmachine_volts:
value_template: '{{ states.switch.washing_machine.attributes.voltage}}'
unit_of_measurement: 'V'
friendly_name: 'Washing Machine voltage'
washingmachine_watts:
value_template: '{{ states.switch.washing_machine.attributes.current_power_w}}'
unit_of_measurement: 'W'
friendly_name: 'Washing Machine current consumption'
washingmachine_total_kw:
value_template: '{{ states.switch.washing_machine.attributes.total_energy_kwh}}'
unit_of_measurement: 'kWh'
friendly_name: 'Washing Machine total consumption'
- platform: template
sensors:
washingmachine_status:
value_template: '{% if is_state("input_select.washingmachine_status", "Powered Off") %}Off{% else %}On{% endif %}'
friendly_name: 'Washing Machine Status'
input_select:
washingmachine_status:
name: Washing Machine Status
options:
- "Powered Off"
- "Running"
- "Finished"
initial: "Powered Off"
icon: mdi:washing-machine
automation:
- alias: Action - Set washing machine to running
trigger:
- platform: numeric_state
entity_id: sensor.washingmachine_watts
above: '10'
for:
minutes: 10
condition: []
action:
- service: input_select.select_option
data:
entity_id: input_select.washingmachine_status
option: "Running"
- service: tts.google_say
entity_id:
- media_player.bedroom_assistant
- media_player.kitchen_assistant
- media_player.living_room_assistant
data_template:
message: "The awesome machine that washes clothes has started"
- alias: Action - Set washing machine as finished
trigger:
- platform: numeric_state
entity_id: sensor.washingmachine_watts
below: '10'
for:
minutes: 10
condition:
- condition: state
entity_id: input_select.washingmachine_status
state: "Running"
action:
- service: input_select.select_option
data:
entity_id: input_select.washingmachine_status
option: "Finished"
- alias: Notify - Washing machine finished
trigger:
- platform: state
entity_id: input_select.washingmachine_status
to: "Finished"
condition:
- condition: state
entity_id: input_select.washingmachine_status
state: "Finished"
action:
- service: tts.google_say
entity_id:
- media_player.bedroom_assistant
- media_player.kitchen_assistant
- media_player.living_room_assistant
data_template:
message: "The awesome machine that washes clothes has completed"
- service: input_select.select_option
data:
entity_id: input_select.washingmachine_status
option: "Powered Off"
- service: notify.pushover
data_template:
title: 'Washer has completed'
message: 'Get the clothes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment