to reproduce do the following:
add two new variables $getalarm
and $alarmtime
get them whatever value you want, except noAlarm
add the following rule:
if $getalarm changes and $getalarm is not “noAlarm” then $alarmtime = $getalarm
try to update the variable $getalarm
via
curl -X PATCH --header “Content-Type:application/json” --data ‘{“type”:“value”,“valueOrExpression”:“noAlarm”}’ --user “admin:pass” yourIP:Port/api/variables/getalarm
This results in an updated variable $alarmtime
. it seems to be ignoring this part of the rule: and $getalarm is not "noAlarm"
but it is working… the tricky part is: the variable is read into the rule, before the rule gets active.
to proof this:
send next hello to update the variable $getalarm
via:
curl -X PATCH --header “Content-Type:application/json” --data ‘{“type”:“value”,“valueOrExpression”:“hello”}’ --user “admin:pass” yourIP:Port/api/variables/getalarm
now $getalarm
is updated but $alarmtime
not. But the rule says, it should be updated, because we are not sending noAlarm
next wave a goodbye via
curl -X PATCH --header “Content-Type:application/json” --data ‘{“type”:“value”,“valueOrExpression”:“goodbye”}’ --user “admin:pass” yourIP:Port/api/variables/getalarm
now both variables are updated again
to proof all of this, send next a noAlarm and anything else afterwards
is this a wanted behaviour?
how to get the value of a changed variable then to work with?
how to work with value of a variable direct after it is changed?