I’ve started adding automations in my HA setup only a few days ago.
One automation I am trying to achieve is to link a sensor attribute (called door_sensor_3_8 (don’t bother with understanding the name really) with attribute V_PERCENTAGE from a MySensor node) to the dimmer level of a zwave Fibaro Dimmer.
The goal is to have the dimmer using the new value from the MySensor node every time the latter changes.
I’m guessing this will only trigger if the value crosses your threshold. From below 0 to above 0. Going from 1 to 2 won’t re-trigger like you would want. Otherwise it would be triggered every second that it’s not 0, and probably spam your zwave network.
You could do it using appdaemon since you can subscribe to a state change, and you get the old and new values.
Or I would suggest running in on a time based automation and update every 5 minutes or something.
Would it be possible to just re,ove the threshold in the trigger ? The value of the percentage attribute is only changes when I press a button so I should not get spammed there if it is possible.
I’m going to check appdaemon, it seems very interesting especially for someone who already knows programming.
As for automation trigger I saw this chapter but I am not sure exactly how to make the trigger happen on each change of that specific attribute value that I’m interested in. Most of the examples seems to check for state to be equal or compared to a specific value. Here I would like to call the service for every change of the attribute state value.
I get an error in the config file when I use your example.
Removing the entity_id line seemed to fix the issue.
trigger:
platform: template
value_template: "{% if states.sensor.door_sensor_3_8.attributes.V_PERCENTAGE | int > 0 %}true{% endif %}"
The problem is that I end up with exactly the same behavior as with the numeri_state : the service if only called if I first change the value to 0 and then to another value.
I tried removing the >0 but that did not change a thing.
Sorry - I was looking for something else and came across this.
Is this still awaiting a solution ?
if you create a input_number scaled as your v_percentage sensor then trigger when the two don’t match (not equivalent)
the resultant action would be to set_value on the slider to the trigger_to value and then also write that to your light, re-scaling if your light requires 255 as max (so *2.55 assuming your sensor is 0-100)
AND the above assumes that you can’t just use ‘state’ as a trigger on your sensor change, normally state works for me.
regards
Mutt