Replies: 1 comment
-
If you want to trigger on the numeric value, it will be much more robust and reliable to convert to float and do a numerical (rather than string) comparison. So it's better to do this: @state_trigger("float(sensor.circadian_on_off) > 0 and float(sensor.circadian_on_off.old) == 0", state_hold=5, kwargs= {"rooms": rooms}) One debugging approach is to add a debug function that triggers off any state change, eg, @state_trigger("sensor.circadian_on_off") and then logs the values of @state_trigger("sensor.circadian_on_off")
def debug_circadian_on_off(var_name=None, value=None, old_value=None):
log.info(f"debug_circadian_on_off var={var_name}, value={value}, old_value={old_value}, trig={float(value) > 0 and float(old_value) == 0}") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some state triggers that use the previous value (.old). A couple months ago they just stopped triggering, and I can't seem to figure out what's changed.
I've used
@state_trigger("sensor.circadian_on_off > '0.0' and sensor.circadian_on_off.old == '0.0' ", state_hold=5, kwargs= {"rooms": rooms})
@state_trigger("sensor.circadian_on_off > 0.0 and sensor.circadian_on_off.old == 0.0 ", state_hold=5, kwargs= {"rooms": rooms})
@state_trigger("sensor.circadian_on_off > '0' and sensor.circadian_on_off.old == '0' ", state_hold=5, kwargs= {"rooms": rooms})
@state_trigger("sensor.circadian_on_off > 0 and sensor.circadian_on_off.old == 0 ", state_hold=5, kwargs= {"rooms": rooms})
Has something broken in a recent update? Or am I missing something here?
Beta Was this translation helpful? Give feedback.
All reactions