I’m attempting to use Automation Trigger Variables in an automation to detect the from_state and use it as part of a condition in the action session. It’s basically an automation triggered on octopus energy price detecting it’s in a certain price band but I want to know whether the price has decreased into the band or increased into it.
My yaml seems to always return false
1 - I’m sure I’ve errored the syntax somewhere, can anyone point out where?
2 - because I’m using trigger variables testing this/debugging seems impossible as the trigger is invalid when called from devtools service or templates. Is there a trick to debugging I’m missing?
Code segment, condition always seems to resolve to false, I am attempting to do a check for less than or greater than the last value
if:
- condition: template
value_template: "{{ (trigger.from_state.state |int) - (trigger.to_state.state|int) > 0 }}"
then:
- service: notify.notify
data:
message: >
PowerCost reducing just changed from {{ trigger.from_state.state }} to
{{ trigger.to_state.state }}
else:
- service: notify.notify
data:
message: >
PowerCost increasing just changed from {{ trigger.from_state.state }} to
{{ trigger.to_state.state }}
Thanks in advance for any assistance/pointers