Additional Entities for weird things

Hi there,

Have recently been fitting the house out with various smarts and got most working well in HA. Very impressed with everything that’s here for us. I have a couple of things I can’t find out how to do, I’m sure it’s been asked before, I’m just not sure on the terminology 100%.

I have the power monitored to the washing machine and am using the automation to alert me when the power drops below 5w, to say it’s finished and to empty the clothes. Is there a way I can add additional status/entities to show the washing machine is ‘in use’ (power > 5w), ‘ready’ (power < 3w) and ‘Needs Emptied’ (power <5w & > 3w).

Additionally I have a smart plug monitoring my computer set up and making sure everything that I don’t need gets turned off (monitors etc). Is there a way I can record the time where the power used is over, say, 50w? I’d like to chart how long I’m spending working.

I’ve another query about the auto entity card, but that’s a minor niggle and I made a seperate post a few days ago.

Thanks everyone!

Yes — you can do this kind of thing with the Template integration.

Have a look here. I use the code on the last post, edited for my needs. Works fine:

Thanks everyone. I checked out the template integration and have something working for the washer. That’s super handy.

Any thoughts on tracking the amount of time I’m at my computer?

Since you just learned how to do templates, you could make a new binary sensor template that’s on (meaning you are working) based on wattage being above what you want. Then use that new sensor you created with the history_stats integration to track how long it’s been on that state https://www.home-assistant.io/integrations/history_stats/

Turns out the washer is not working. It’s appears as ‘Ready’ all the time… Further investigation required.

I will move on to the stats thing later, I tried some code I found that is doing something, but not quite sure what just now.

Have you tried my recipe too?

Hi,

Here’s what I’ve tried but the sensor gets stuck at ‘Ready’ all the time:

template:
  - sensor:
    - name: "Washing Machine Status"
      unit_of_measurement: 'W'
      state: >
        {% if state_attr('sensor.washing_machine_energy_power', 'W')|float > 6 %}
          Working
        {% elif state_attr('sensor.washing_machine_energy_power', 'W')|float < 3 %}
          Ready
        {% else %}
          Needs Emptied
        {% endif %}

Any idea what’s up?

Yes thanks, the alert when the washing machine has finished is working well:

- id: '1643236669472'
  alias: Test Washing Machine Finished
  description: ''
  trigger:
  - type: power
    platform: device
    device_id: cfb936ccb89a8d05957eddcca1267fdc
    entity_id: sensor.washing_machine_energy_power
    domain: sensor
    below: 6
    for:
      hours: 0
      minutes: 0
      seconds: 5
  condition: []
  action:
  - service: notify.living_room_tv
    data:
      message: Washing machine has finished!
  - service: notify.mobile_app_nick
    data:
      message: Washing machine has finished!
  mode: single

Got it! Didn’t know about the ‘Templates’ section in Dev Tools, that soon helped with debugging!

template:
  - sensor:
    - name: "Washing Machine Status"
      state: >
        {% if states('sensor.washing_machine_energy_power')|int > 6 %}
          Working
        {% elif states('sensor.washing_machine_energy_power')|int < 3 %}
          Ready
        {% else %}
          Needs Emptied
        {% endif %}
2 Likes