Action when laundry is done

Just out of curiosity, which Z-Wave outlet is everyone using?

Both of those ideas are great, thanks for the replies.

I’m using two Aeotec Smart Switch 6’s myself.

I’m using TP-Link HS110 smart plugs

Interesting. I have a few HS110s but I’m wondering how you get the current energy usage to show up in Home Assistant. When I include my HS110s in my configuration all that I can see/control is the on/off state of the HS110 switch. Any insight? If so, have a few HS110s laying around that I might be able to use for this. Thanks!

I copied the code for the sensors from rpitera above:

- platform: template
  sensors:

    kettle_watts:
      value_template: '{{ states.switch.hs110_1_kettle.attributes["Current consumption"] | replace(" W", "") | float }}'
      unit_of_measurement: 'W'

    kettle_daily_kw:
        value_template: '{{ states.switch.hs110_1_kettle.attributes["Daily consumption"] | replace(" kW", "") | float }}'
        unit_of_measurement: 'kW'

    kettle_daily_cost:
        value_template: '{{ (states.switch.hs110_1_kettle.attributes["Daily consumption"] | replace(" kW", "") | float * 0.084) | round(2) }}'
        unit_of_measurement: 'p'

    kettle_amps:
      value_template: '{{ states.switch.hs110_1_kettle.attributes["Current"] | replace(" A", "") | float }}'
      unit_of_measurement: 'A'

    kettle_kw:
      value_template: '{{ states.switch.hs110_1_kettle.attributes["Total consumption"] | replace(" kW", "") | float }}'
      unit_of_measurement: 'kW'

    kettle_volts:
      value_template: '{{ states.switch.hs110_1_kettle.attributes["Voltage"] | replace(" V", "") | float }}'
      unit_of_measurement: 'V'


    washing_machine_watts:
      value_template: '{{ states.switch.hs110_2_washing_machine.attributes["Current consumption"] | replace(" W", "") | float }}'
      unit_of_measurement: 'W'

    washing_machine_daily_kw:
        value_template: '{{ states.switch.hs110_2_washing_machine.attributes["Daily consumption"] | replace(" kW", "") | float }}'
        unit_of_measurement: 'kW'

    washing_machine_daily_cost:
        value_template: '{{ (states.switch.hs110_2_washing_machine.attributes["Daily consumption"] | replace(" kW", "") | float * 0.084) | round(2) }}'
        unit_of_measurement: 'p'

    washing_machine_amps:
      value_template: '{{ states.switch.hs110_2_washing_machine.attributes["Current"] | replace(" A", "") | float }}'
      unit_of_measurement: 'A'

    washing_machine_kw:
      value_template: '{{ states.switch.hs110_2_washing_machine.attributes["Total consumption"] | replace(" kW", "") | float }}'
      unit_of_measurement: 'kW'

    washing_machine_volts:
      value_template: '{{ states.switch.hs110_2_washing_machine.attributes["Voltage"] | replace(" V", "") | float }}'
1 Like
Many Thanks!  Below is my config...

**sensor.yaml**
    # Value Template
    - platform: template
      sensors:
        dryer_on:
          value_template: "{{ states('sensor.dryer_power') | int > 3 }}"
        washer_on:
          value_template: "{{ states('sensor.washer_power') | int > 3 }}"

**automation.yaml**
    # Dryer On
    - alias: Dryer On
      trigger:
        platform: state
        entity_id: sensor.dryer_on
        to: 'True'
      action:
        service: input_boolean.turn_on
        entity_id: input_boolean.dryer

    # Dryer Off
    - alias: Dryer Off
      trigger:
        platform: state
        entity_id: sensor.dryer_on
        to: 'False'
      condition:
        condition: state
        entity_id: input_boolean.dryer
        state: 'on'
      action:
        - service: input_boolean.turn_off
          entity_id: input_boolean.dryer
        - service: notify.sms
          data: {  "message": "Dryer finished.",  "target": [ "+##########", "+##########" ]}

    # Washer On
    - alias: Washer On
      trigger:
        platform: state
        entity_id: sensor.washer_on
        to: 'True'
      action:
        service: input_boolean.turn_on
        entity_id: input_boolean.washer

    # Washer Off
    - alias: Washer Off
      trigger:
        platform: state
        entity_id: sensor.washer_on
        to: 'False'
        for:
          minutes: 3
      condition:
        condition: state
        entity_id: input_boolean.washer
        state: 'on'
      action:
        - service: input_boolean.turn_off
          entity_id: input_boolean.washer
        - service: notify.sms
          data: {  "message": "Washer finished.",  "target": [ "+#########", "+##########" ]}
4 Likes

This didnt work for me. However changing the state: 'off' to: to:'off' did the trick :slight_smile:

Yeah, I believe “state” was removed in this context and now only “to” is supported. Doesn’t look like I can go back and edit it now though.

Hi, I’m really new to HA, can you please tell me how to confiru input_boolean for this to work?
thanks

edit: nevermind, got it in the end

The ideal action when laundry is done is to “fold and put away”. Not sure how that would be coded though. :wink:

2 Likes

well there is this coming out, i’m getting one, cause my girl is always complaining about laundry :smiley:

2 Likes

I had forgotten I had seen a clip of that maybe a year ago. So will it get HA support?

That’s not something that simply “happens”… Someone will have to write support for it.

That little exchange at the end was totally in jest. I doubt the product will get picked by thousands of ha folks so I am not expecting a real question of support.

Sorry to hijack this but is there a way to reverse engeneer this so we have time left?

I know the cycles of my washing machine and want to implement this differently.

I got the stopwatch work and understand it all except the json you used for the value_template, well I get what it’s doing but I dont know enough to reverse engeneer it to allow for “time remaining”.

I assume it’s something like

600 - states.automation.stopwatch_start.attributes.last_triggered).total_seconds()

Assuming that a washing cylce is 10 mintues that is (I appreciate thats no where near correct but i mean the logic should be there).

Edit: Oooops read Jan '17 from your original post @tboyce1 and took it to be current as in this Jan, sorry for digging this up.

Jono, could I get your entire code for Washer & Dryer? I have some of it and love it, but like your setup with the Time Elapsed…

I’ve not been using that lately in my dashboard (after a big cleanup), although the code is still in there.

It gives warning in the logs about the automation for the stopwatch, so I guess I need to look at that, but here it is:

sensor:
- platform: template
  sensors:

# Kettle
    kettle_watts:
      value_template: '{{ states.switch.hs110_kettle.attributes["current_power_w"] | replace(" W", "") | float }}'
      unit_of_measurement: 'W'

    kettle_state:
      value_template:  '{% if is_state("input_boolean.kettle_switch", "on") %}On{% else %}Off{%- endif %}'

# True when Kettle power level is above 8.4 watts, showing kettle is in use
    kettle_power_up:
      value_template: "{{ states('sensor.kettle_watts') | int > 8.4 }}"

    kettle_power_down:
      value_template: "{{ states('sensor.kettle_watts') | int < 8.4 }}"


# Washing Machine
    washing_machine_watts:
      value_template: '{{ states.switch.hs110_washing_machine.attributes["current_power_w"] | replace(" W", "") | float }}'
      unit_of_measurement: 'W'

# True when washer power level is below 3.4 watts, high threshold of resting state
    washing_machine_power_down:
      value_template: "{{ states('sensor.washing_machine_watts') | int < 3.4 }}"

    washing_machine_power_up:
      value_template: "{{ states('sensor.washing_machine_watts') | int > 3.4 }}"

    stopwatch:
      friendly_name: "Time Elapsed"
      value_template: >
        {% if is_state('input_boolean.stopwatch', 'on') %}
          {{ relative_time(states.automation.stopwatch_start.attributes.last_triggered) }}
        {% elif is_state('sensor.stopwatch', 'unknown') %}
          0 seconds
        {% else %}
          {{ states('sensor.stopwatch') }}
        {% endif %}
      entity_id:
        - automation.stopwatch_start
        - automation.stopwatch_update
        - automation.stopwatch_stop


# Tumble Dryer
    tumble_dryer_watts:
      value_template: '{{ states.switch.hs110_tumble_dryer.attributes["current_power_w"] | replace(" W", "") | float }}'
      unit_of_measurement: 'W'

# True when Dryer power level is above 8.4 watts, showing dryer is in use (as opposed to just having the door open)
    tumble_dryer_power_up:
      value_template: "{{ states('sensor.tumble_dryer_watts') | int > 8.4 }}"

    tumble_dryer_power_down:
      value_template: "{{ states('sensor.tumble_dryer_watts') | int < 8.4 }}"

########################################

input_boolean:
  kettle_switch:
    name: "Kettle in Use"
    icon: mdi:settings

  washing_machine_switch:
    name: "Washer in Use"
    icon: mdi:settings

  tumble_dryer_switch:
    name: "Dryer in Use"
    icon: mdi:settings

  stopwatch:
    name: "Timer"
    icon: mdi:timer
    initial: off

  dummy:
    name: "Dummy"
    initial: off

########################################

automation:
  - alias: "Kettle Start"
    trigger:
      platform: state
      entity_id: sensor.kettle_power_up
      from: 'False'
      to: 'True'
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.kettle_switch

# Kettle Boiled Notification Sequence
  - alias: "Kettle Finish Notifications"
    trigger:
      - platform: state
        entity_id: sensor.kettle_power_down
        from: 'False'
        to: 'True'
    condition:
      - condition: state
        entity_id: input_boolean.kettle_switch
        state: 'on'
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.kettle_switch
      - service: notify.ios_jonos_iphone
        data:
          message: "Kettle Boiled"
      - service: tts.google_say
        entity_id: media_player.google_home
        data_template:
          message: " Kettle boiled"


# Washing Machine Notification Sequence
  - alias: "Washing Machine Start"
    trigger:
      platform: state
      entity_id: sensor.washing_machine_power_down
      from: 'True'
      to: 'False'
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.washing_machine_switch
      - service: input_boolean.turn_on
        entity_id: input_boolean.stopwatch

  - alias: "Washing Machine Finish Notification"
    trigger:
      - platform: state
        entity_id: sensor.washing_machine_power_down
        from: 'False'
        to: 'True'
        for: '00:03:00'
    condition:
      condition: state
      entity_id: input_boolean.washing_machine_switch
      state: 'on'
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.washing_machine_switch
      - service: input_boolean.turn_off
        entity_id: input_boolean.stopwatch
      - service: notify.ios_jonos_iphone
        data:
          title: "Washing Done"
          message: "Time Taken: {{ states('sensor.stopwatch') }}"
      - service: tts.google_say
        entity_id: media_player.google_home
        data_template:
          message: " The Washing Machine has finished"

  - alias: "Stopwatch Start"
    trigger:
      platform: state
      entity_id: input_boolean.stopwatch
      to: "on"
    action:
      - service: input_boolean.toggle
        entity_id: input_boolean.dummy
  - alias: "Stopwatch Stop"
    trigger:
      platform: state
      entity_id: input_boolean.stopwatch
      to: 'off'
    action:
      - service: input_boolean.toggle
        entity_id: input_boolean.dummy

  - alias: "Stopwatch Update"
    trigger:
      platform: time
      seconds: '/1'
    condition:
      condition: state
      entity_id: input_boolean.stopwatch
      state: 'on'
    action:
      service: input_boolean.toggle
      entity_id: input_boolean.dummy


# Tumble Dryer Notification Sequence
  - alias: "Tumble Dryer Start"
    trigger:
      platform: state
      entity_id: sensor.tumble_dryer_power_up
      from: 'False'
      to: 'True'
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.tumble_dryer_switch

  - alias: "Tumble Dryer Finish Notification"
    trigger:
      - platform: state
        entity_id: sensor.tumble_dryer_watts
        to: '0.0'
      - platform: state
        entity_id: sensor.tumble_dryer_power_down
        from: 'False'
        to: 'True'
        for: '00:03:00'
    condition:
      condition: state
      entity_id: input_boolean.tumble_dryer_switch
      state: 'on'
    action:
      - service: input_boolean.turn_off
        entity_id: input_boolean.tumble_dryer_switch
      - service: notify.ios_jonos_iphone
        data:
          title: "Tumble Dryer Finished"
          message: "Check the clothes are dry?"
      - service: tts.google_say
        entity_id: media_player.google_home
        data_template:
          message: " The Tumble Dryer has finished"
2 Likes

Is there a way how to display stopwatch time in hours:minutes:seconds?
I cannot achieve it.
It displays secs only (up to 60), afterwards minutes only (up to 60) and hours only (after 60 minutes is gone) :frowning:
Any advice?
I’ve used this code:

- platform: template
  sensors:
    stopwatch:
      friendly_name: "Stopwatch"
      value_template: >
        {% if is_state('sensor.heat_pump', 'ON') %}
          {{ relative_time(states.automation.stopwatch_start.attributes.last_triggered) }}
        {% elif is_state('sensor.stopwatch', 'unknown') %}
          0
        {% else %}
          {{ states('sensor.stopwatch') }}
        {% endif %}

Thanks! I was way overcomplicating this… :slight_smile:

If anyone is interested I combined/recoded/cleaned the examples above to support the latest HA and display “on time” in HH:mm

Config is here: Need help with tracking my washing machine status