Use a TP-Link HS110 to monitor my washing machine

I have one of these working just great with HA: http://www.tp-link.com/en/products/details/cat-5258_HS110.html

But now I want to monitor my washing machine with it to see when the load has finished, by looking at the energy usage, but I don’t know where to start - help!

I found this page reverse engineering it: https://www.softscheck.com/en/reverse-engineering-tp-link-hs110/

1 Like

I did this with two aeotec SmartSwitches, one for the washer and one for the dryer. The trick is to monitor your wash loads for data points so you know what the energy readings are for the different periods. Some units will have a constant draw, the dryer unit level may raise when you open the door (cause the light goes on), etc.

Once you figure this out, you know what your minimum power levels are and you can use these in an automation/sensor set up.

I have these two sensors set up (I usually document my code this way):

#
#   Automation Templates
#
#    True when washer power level is below 3.4 watts, high threshold of resting state
#    Default state is true
     washer_pwrdn:
       value_template: "{{ states('sensor.aeotec_smart_switch_6_power_10') | int < 3.4 }}"

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

I also made two binary inputs to toggle the notification:

washer_switch:
    name: Toggle Washer Automation
    initial: off
    icon: mdi:water
dryer_switch:
    name: Toggle Dryer Automation
    initial: off
    icon: mdi:sync

It all comes together with the automations:

# Washer Notification Sequence

- alias: 'Washer Start'
  trigger:
    platform: state
    entity_id: sensor.washer_pwrdn
    from: 'True'
    to: 'False'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.washer_switch

- alias: 'Washer Done'
  trigger:
    platform: state
    entity_id: sensor.washer_pwrdn
    from: 'False'
    to: 'True'
    for:
      minutes: 3
  condition:
      condition: state
      entity_id: input_boolean.washer_switch
      state: 'on'
  action:
    - service: notify.pushbullet
      data:
        message: 'Robert, the washer is done.'
    - service: input_boolean.turn_off
      entity_id: input_boolean.washer_switch

# Dryer Notification Sequence

- alias: 'Dryer Start'
  trigger:
    platform: state
    entity_id: sensor.dryer_pwrup
    from: 'False'
    to: 'True'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.dryer_switch

- alias: 'Dryer Done'
  trigger:
    platform: state
    entity_id: sensor.aeotec_smart_switch_6_power_11
    state: '0.0'
  condition:
    condition: state
    entity_id: input_boolean.dryer_switch
    state: 'on'
  action:
    - service: notify.pushbullet
      data:
        message: 'Robert, the dryer is done.'
    - service: input_boolean.turn_off
      entity_id: input_boolean.dryer_switch

Why the 3 minute wait on the washer? Well my power levels drop when the washer is draining or filling for the rinse, so this takes that into account to prevent false positives. This is what I meant about spending time to get to know the cycles.

The bonus here is that because I am using PushBullet, all my devices get the notification and the phone speaks it out loud.

10 Likes

@rpitera
Thanks
Now I have a smart Washer and Dryer :smile:

2 Likes

I’m so glad every time someone tells me that. I’ve gotten so much here it feels good to give back!

Cheers!

1 Like

I need help please. I’m trying to set up a tplink HS110 as above to send me pushbullet notifications when the washer/dryer is finished but after several hours trying to figure it out I cannot work it out. So far I’ve got this in the configuration.yaml file and see the switch in the web configuration page and current use in watts but when I add any of the above in rpitera’s post to the config file the service will not start. Please could I have a step by step guide what to add where for my tplink plug? Do I need to create a seperate file for the automation?

> homeassistant:
>   # Name of the location where Home Assistant is running
>   name: Home
>   # Location required to calculate the time the sun rises and sets
>   latitude: 
>   longitude:
>   # Impacts weather/sunrise data (altitude above sea level in meters)
>   elevation: 0
>   # metric for Metric, imperial for Imperial
>   unit_system: metric
>   # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
>   time_zone: Europe/London

> # Show links to resources in log and frontend
> introduction:

> # Enables the frontend
> frontend:

> # Enables configuration UI
> config:

> http:
>   # Uncomment this to add a password (recommended!)
>   # api_password: PASSWORD
>   # Uncomment this if you are using SSL or running in Docker etc
>   # base_url: example.duckdns.org:8123

> # Checks for available updates
> # Note: This component will send some information about your system to
> # the developers to assist with development of Home Assistant.
> # For more information, please see:
> # https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
> updater:
>   # Optional, allows Home Assistant developers to focus on popular components.
>   # include_used_components: true

> # Discover some devices automatically
> discovery:

> # Allows you to issue voice commands from the frontend in enabled browsers
> conversation:

> # Enables support for tracking state changes over time.
> history:

> # View all events in a logbook
> logbook:

> # Track the sun
> #sun:

> # Weather Prediction
> #sensor:
> #  platform: yr

> # Text to speech
> tts:
>   platform: google

> group: !include groups.yaml
> automation: !include automations.yaml

> switch:
>   - platform: tplink
>     host: 192.168.1.205
>     name: "Washing Machine"
> sensor:
>   - platform: template
>     sensors:
>       washing_machine_current:
>         friendly_name: 'Washing Machine Current'
>         value_template: '{{ states.switch.washing_machine.attributes["Current consumption"].split(" ")[0] }}'
>         unit_of_measurement: 'W'

> notify:
>   platform: pushbullet
>   api_key: xxxxxxxx
>   name: pushbullet

@rpitera - Robert, would you mind giving a little bit more information on what the Aeotec Smartswitch may look like? Or a model number? When I searched online, I got a variety of images returned for the search criteria. Also, is your dryer 120 or 220 volts.

Can I ask, how are you getting your phone to speak the pushbullet message out loud? Thx

Washer and Dryer are both on standard 120v plugs (Dryer is gas heated). The exact model of Smart Switch is the ZW096 Smart Switch 6 Gen 5:
https://www.amazon.com/Aeotec-Aeon-Labs-ZW096-Switch/dp/B00VQISOCG/ref=sr_1_1?ie=UTF8&qid=1500639485&sr=8-1&keywords=aeotec+smart+switch

My favorite Android program ever, eCID - Enhanced SMS & Caller ID+

I have been using this program since I bought my first Android phone. I bought the full program and have been using it on phones and tablets for years. It’s the first thing I load on a new device. Speaks SMS, Alerts, Notifications, EMails and even announces calls. You can config it to work with pretty much any program that does notifications and you can even set it up to be interactive (Reads out SMS, asks if you want to reply. You reply with voice, it verifies before sending!)

It’s constantly updated and new features are added all the time. I put this in the same class as Tasker; highly configurable, useful as hell and developed by a guy who really cares about his program. Also, he is extremely responsive to issues and to feature suggestions and gives great support (the one and only time I needed it in like six years or more).

I cannot recommend this program enough! It solves a number of problems besides just speaking notifications.
What are you waiting for, just buy it already!! (LOL, I’m just a fan of this guy’s work and want to support him!)

As getting it to work with Pushbullet, I simply picked it from the list of programs in the app and then adjusted the spoken text and some of the options to my liking; you could simply check the box in the list and it would work straight away though.

Here’s a great intro video for it:

Hope this answers your questions, but feel free to ask if you have more.

Thanks Robert, this will most likely be my solution for the washer, but my dryer is 220V and I have yet found a solution that would be somewhat easy to implement. I’ll start with the washer and see how my wife likes it and see if it would be worth working on the dryer. Thanks again for sharing.

1 Like

I’m using HS110s with 220v (I’m in the UK) with a washer and a dryer. It works great. If you need any info let me know.

1 Like

Thanks for your offer jono, my issue is that it’s 220V plug here in the US. So the prongs on the appliance cord are different than anything in the rest of the house with the exception of the stove. These 2 appliance run 220, the rest of the house is 110. That I know, there is nothing out there as far as automation devices that will accept these plugs.

Ah, right! Thanks or explaining.

1 Like

That’s going to be a tough one. So far as I know, this is the only 220v US smart plug:

https://bosscontrols.com/product/boss-220-smart-plug/

Two problems; it ain’t cheap and it works with a cloud service.

But I’ll keep looking around. Reddit would be a good place to ask though. r/homeautomation

@rpitera @jono I’m stuck getting started. Would either of you be able to help with my config question above?

Take another look at my post here:

But keep in mind I use includes instead of putting everything in the configuration.yaml; if you use my stuff as a copy and paste, but all your stuff is in one file, then you need to adjust the formatting a little bit. I have separate files for my sensors, my input booleans and I also have all of my automations as separate files included with the list directive. So my formatting wouldn’t include section headers like input_boolean: or sensor:.

You’ll have to adjust accordingly.

I don’t like to admit defeat but after 6 hours at it trying to make it work it may well be beyond me!

What I’ve got in configuration.yaml so far is:

> switch:
> - platform: tplink
> host: 192.168.1.205
> name: "Washing Machine"
> sensor:
> - platform: template
> sensors:
> washing_machine_current:
> friendly_name: 'Washing Machine Current'
> value_template: '{{ states.switch.washing_machine.attributes["Current consumption"].split(" ")[0] }}'
> unit_of_measurement: 'W'

> notify:
> platform: pushbullet
> api_key: xxxxxxxx
> name: pushbullet

Do I add this to configuration.yaml:

> #
> #   Automation Templates
> #
> #    True when washer power level is below 3.4 watts, high threshold of resting state
> #    Default state is true
>      washer_pwrdn:
>        value_template: "{{ states('sensor.aeotec_smart_switch_6_power_10') | int < 3.4 }}"

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

and what would I need to replace sensor.aeotec_smart_switch_6_power_11 with in my case?

Then where does this go?

> washer_switch:
>     name: Toggle Washer Automation
>     initial: off
>     icon: mdi:water
> dryer_switch:
>     name: Toggle Dryer Automation
>     initial: off
>     icon: mdi:sync

and also where does this go? Does it go in automations.yaml?

> # Washer Notification Sequence

> - alias: 'Washer Start'
>   trigger:
>     platform: state
>     entity_id: sensor.washer_pwrdn
>     from: 'True'
>     to: 'False'
>   action:
>     service: input_boolean.turn_on
>     entity_id: input_boolean.washer_switch

> - alias: 'Washer Done'
>   trigger:
>     platform: state
>     entity_id: sensor.washer_pwrdn
>     from: 'False'
>     to: 'True'
>     for:
>       minutes: 3
>   condition:
>       condition: state
>       entity_id: input_boolean.washer_switch
>       state: 'on'
>   action:
>     - service: notify.pushbullet
>       data:
>         message: 'Robert, the washer is done.'
>     - service: input_boolean.turn_off
>       entity_id: input_boolean.washer_switch

Ok first you need to post your configs properly so we can read them.

Go into your post and highlight each portion of code you are posting, then click on the preformatted text button in the post editor:

This will preserve your code the way you formatted it, instead of applying a style to it and that will let us read it properly so we can help.

Second - You are asking where the automation templates go as if you could just paste these in. First you have to determine the values for these. You need to monitor the power levels on your switch and figure out what the minimum level is when your washer or dryer is running. My thresholds are based on my machine, yours will be different.

So you need to know this before going further. Read my post again; I mention this in the first paragraph.

@rpitera I read your instructions and code many many times but still could not apply it to the tplink hs110 plugs despite spending a total of 6 hours on it yesterday. Perhaps the way the tplink plugs power state reporting is handled is different in Home Assistant compared to the Aeotec Smart Switch?

I have success with the below, sending a notification to Pushbullet and it being read out on my phone with TTS. But cannot implement the delay period whereby the power has to be <1.5 watts for x minutes before the notification is sent as you have with for: minutes: 3 in the trigger section. Have you any suggestions?

Switch:
  - platform: tplink
    host: 192.168.1.206
    name: "Washing Machine"

sensor:
  - platform: template
    sensors:
      washing_machine_current:
        friendly_name: 'Washing Machine Current'
        value_template: '{{ states.switch.washing_machine.attributes["Current consumption"].split(" ")[0] }}'
        unit_of_measurement: 'W'
 
notify:
  platform: pushbullet
  api_key: *****
  name: pushbullet

 
automation:
  - alias: "Notify when washing machine cycle is complete"
    trigger:
      platform: numeric_state
      entity_id: sensor.washing_machine_current
#above 0.5 watts entry so turning the machine on then off manually doesn't create a false notification. ie. 0 watts doesn't send a notification
          above: 0.5
          below: 1.5

    action:
      service: notify.pushbullet
      data_template:
        title: "The washing machine cycle has finished"
        message: "It's ready to be emptied"

@jono How did you set up your tplink HS110 plug?

1 Like

I just got a TP link plug, but not sure whether it measures current as I haven’t had time to implement it yet.

But I had issues trying to do this with numeric state triggers too; that’s why I made the template sensors and used them to toggle the boolean input and used those as the trigger. You may want to try the same thing instead of trying to use the state of the current as a trigger directly.