Trigger flow from entity's state attribute

The trick here is going to be creating a trigger that works, we could set something up inside Node-Red that triggers every day starting at 12:01am that repeats every minute until 11:59pm then goes through the value template node to then trigger some sort of automation once it gets above 5 but… Honestly I’d recommend we have you build a sensor by extracting the attribute of the current power, then we can use that newly created sensor to trigger an automation for you inside Node-Red. Here’s how I would do it (note: the format might vary depending on how you have your sensors.yaml if you even have one of those, how I’m typing this up is assuming you do the sensor just how I have it written below inside your configuration.yaml). If you do have a sensors.yaml and perform the “!include” feature let me know we can adjust as needed.

sensor:
  - platform: template 
    sensors:
	  washing_machine_power:
        value_template: "{{ states.switch.washing_machine_.attributes.current_power_w | int }}"
	    friendly_name: 'Washing Machine Power'

Try setting this up and reboot, you should have a new sensor called “sensor.washing_machine_power” that will show the same number as the attribute from the switch (in your screen shot it’s showing 0.175 right now). Once you have that we can use the new sensor inside Node-Red to create your automation. If you’d rather go the other way with everything inside Node-Red like I mentioned at the beginning let me know, we’d just need to figure out a way to trigger something to hit that attribute repeatedly until it passes 5 and triggers something.

3 Likes