Help Creating a Sensor Template based on Power Watts

Can I please have some help creating a sensor template?
I have a power monitoring socket on a piece of machinery and I would like HA to show it’s status based on power watts and display this on the Dashboard.

0W = Off
1-100W = Idle
Above 101W = Running

Thanks

This is one I have for the washing machine, should be adaptable for what you are looking to achieve


- platform: template
  sensors:
    washing_machine_status:
      unique_id: washing_machine_status
      friendly_name: Washing Machine Status
      value_template: >
        {% if states("sensor.washing_machine_watts") | float(0) == 0 %}
          off
        {% elif states("sensor.washing_machine_watts") | float(0) <= 3 %}
          standby
        {% elif states("sensor.washing_machine_watts") | float(0) >= 1000 %}
          heating
        {% else %}
          washing
        {% endif %}
4 Likes

Have u solved this problem? I cannot adapt the solution for me.

This worked for me in my templates.yaml @EMP83

  - sensor:
      - name: Laundry Status
        state: >
          {% if states("sensor.shelly_laundry_switch_0_power") | float(0) == 0 %}
            off
            icon: mdi-washing-machine-off
          {% elif states("sensor.shelly_laundry_switch_0_power") | float(0) <= 3 %}
            standby
          {% elif states("sensor.shelly_laundry_switch_0_power") | float(0) >= 250 %}
            drying
          {% else %}
            washing
          {% endif %}

I am looking for something similar. Will this work to expose the status of the washing machine in HomeKit? I want to be able to have HomeKit announce when the washing machine is done using the status of the washing machine (on or off).