Need help tracking washer with tplink HS110

I just want simple code to track and notify when washer is done. I don’t want to turn the switch on and off so it is always on. Really running into trouble here.

I just did this. When I get home I’ll copy my code over. Tells me when my washer is done via pushbullet. Very simple.

Check this post.

3 Likes

This is not originally my work. I found it somewhere on here, but now for the life of me I cannot find the post. However, I had to look around and piece a lot of stuff together, but here it is all in one.

First setup your notification. I’m using pushbullet and IFTTT (in configuration file).

ifttt:
  key: !secret iftt_key

notify:
  - platform: pushbullet
    name: pushbullet
    api_key: !secret pb_key

Second setup the switch. Mine is setup under my switches.yaml

#Laundry Room
- platform: tplink
  name: Dryer
  host: 192.168.1.17
- platform: tplink
  name: Washing_Machine
  host: 192.168.1.56

Next setup sensors. You’ll need to monitor the watts each of your machine uses when idle, vs running. The template will set the value of the dryer_run or washmach_run entities to true when not running, and false when running. This is important when we get to the automation.

#dryer running
dryer_run:
  friendly_name_template: "{{ states.switch.dryer.name}} Current Consumption"
  value_template: '{{ states.switch.dryer.attributes["current_power_w"] | float < 5}}'
#washing machine running
washmach_run:
  friendly_name_template: "{{ states.switch.washing_machine.name}} Current Consumption"
  value_template: '{{ states.switch.washing_machine.attributes["current_power_w"] | float < 3}}' 

Lastly, setup your automations. I used the yaml and not node red, but I think I’ll be switching.

- id: Dryer_Complete
  alias: Dryer Complete
  trigger:
    platform: state
    entity_id: sensor.dryer_run
    from: 'False'      
    to: 'True'      
    for:
      seconds: 30

  action:        
    - service: notify.pushbullet
      data_template:
        title: Dryer has finished.
        message: It's ready to be emptied
    
    - service: ifttt.trigger
      data: {"event":"dryer_complete", "value1":"Dryer Complete"}

    - service: ifttt.trigger
      data: {"event":"dryerdone_kb", "value1":"Dryer Complete"} 


- id: Washing_Machine_Complete
  alias: Washing Machine Complete
  trigger:
    platform: state
    entity_id: sensor.washmach_run
    from: 'False'      
    to: 'True'      
    for:
      seconds: 60
  action:
    - service: notify.pushbullet
      data_template:
        title: Washing Machine has finished.
        message: It's ready to be emptied
2 Likes

Thank you patmann03 and oriolism! Both of these approaches are extremely helpful! I read it and can understand it! I am new at this and although Hassio on my p3 is great, the documentation is hard because of so many versions and old stuff still out there for components. I can’t wait to try some of what you’ve shared in the morning! I’ll report back.

patmann03, I tried to use your code and am getting errors about using id: line for the washer. Added automation: right above that line but it didn’t like that either. Sorry, noob here. took some yaml and json tutorials but still not getting this part right :frowning:

Probably has to deal with your indents on the yaml file. My configuration file:

These basically tell home assistant that automations, switches, light’s, sensors etc. are held in separate files. The file names are after the !include and are in the same config folder as the configuration.

automation: !include automations.yaml
#script: !include scripts.yaml
switch: !include LTlights.yaml

light: !include lights.yaml

input_boolean: !include boolean.yaml

ifttt:
  key: !secret iftt_key

notify:
  - platform: pushbullet
    name: pushbullet
    api_key: !secret pb_key

The switches, sensors, and automations are in separate files. You’ll probably have to mess with the indenting. YAML uses 2 spaces. You should be able to copy and paste these directly and run them as long as you don’t change any of the ID’s. But that only works if you have your file structure similar to mine and not everything in the configuration yaml.

Ok so indentation seemed to be it cause I am right now using just the configuration file. checker says my file is valid and I get a green check. Now to go do some laundry and see what happens! :slight_smile:

Good luck. Let me know how it goes.

so i did laundry this morning and watched the sensor flip true/false which was great. I just never got my notification from push-bullet. I did verify that I can send a test to pushbullet by calling the service and immediately got a response on my phone but not from my configuration. At work now, I keep HA local only so I’ll have to recheck the script later. Progress…!

1 Like

i had issues with that too at first. You need to make sure whatever you named pushbullet as, that’s how you call the notification. It’s named pushbullet. So when you call it in the automation, you need to ensure you’re calling notify.pushbullet (if you changed the name, you’ll need to update the name in the automation. Also, it could come down to formatting for your automation. Again, my automations are in a separate file from my config. Glad to hear you’re making progress.

For example:
notify:
  - platform: pushbullet
    name: pushbullet
    api_key: !secret pb_key

Thank you for all your help! I now have it working! I had to increase the true/false time to 2 minutes cause I kept getting notifications at the rinse cycle. Now i have to figure out how to get the notification to Skype which does not seem native.

You may want to edit the sensor and up the wattage, but if you’re ok with the 2 minutes that’s fine too. Glad you got it working!

Oh, I didn’t think about the wattage level. I will take a look at that next wash I do. Thanks!!

I ended up using the statistics sensor (someone mentioned it in another washing machine thread) and I get the mean average watts (it’s set to only look at the last 3 minutes ) and it took some of those weird fluctuations out of the equation. It’s accurate enough now that I know when it’s done but no one has taken the clothes out because the green led stays lit I can see that with my sensor and it will keep repeating that the laundry needs to be moved to dryer until someone actually does it.

Hmmm that’s something to consider too if I am still having trouble, thanks!! Also I was wondering, mine is a dumb machine, no digital, no lights, no open door. Once I get the notification how do I get another in say 20min as a reminder and then that’s it. I don’t want to buy anything else to add to the machine like a contact or vibration sensor (I know those would help to report if the cover was opened). Would I use some kind of timer or countdown script? Any thoughts would be great!

Been also fighting with icon color on my cards. All my devices have a yellow icon! i even downloaded an icon from mdi in purple but it show up as yellow. I tried to use customize piece in the front end to allow the UI override and I’ve tried to add a line for icon_color in my customize.yaml where I was able to set the icon after putting the icons in my www folder. WHAT am i doing wrong???! Do I have to create what I’ve seen loosely referenced, a theme first?? pulling my hair out

I haven’t gotten into themes. I’d suggest a new thread.

Oh, right! thanks!!

Hello patmann03. We worked a while back to get my washer automation going which has been working great until my sd card in my pi died and I had to rebuild with the latest HA. so now either the washer run sensor is not compatible or the automation is not compatible any longer. Have you upgraded? does your code still work? have you had to tweak it ? Thanks! I’ve been trying but can’t this going…