device variable watches

I want to use a device variable watch in a trigger. What exactly should I enter to test if a variable becomes “True”. Should I use the new and old variables in the test? Tried single, double quotes but the trigger is never active.

Thanks for your help

[quote=“delle, post:1, topic:189573”]I want to use a device variable watch in a trigger. What exactly should I enter to test if a variable becomes “True”. Should I use the new and old variables in the test? Tried single, double quotes but the trigger is never active.

Thanks for your help[/quote]
That depends a bit on the device and how it has chosen to represent true in its variable. Check the exact value in the device variable. Then the Lua expression should be something like :

new == "true"[/code] or [code]new == "1"

Thanks amg0

I have a scene to switch on and another one to switch off a device. What’s wrong with a trigger watching the variable “Status”. Why is always the same scene(9) triggered whatever the value of the status is. Scene 10 is always evaluated as second option

switch on

2015-11-09 20:11:48.306 luup_log:3: ALTUI: debug: variableWatchCallback(10130,urn:upnp-org:serviceId:SwitchPower1,Status,old:‘0’,new:‘1’)
2015-11-09 20:11:48.307 luup_log:3: ALTUI: debug: findWatch(10130,urn:upnp-org:serviceId:SwitchPower1,Status)
2015-11-09 20:11:48.310 luup_log:3: ALTUI: debug: registeredWatches: {“10130”:{“urn:upnp-org:serviceId:SwitchPower1”:{“Status”:{“LastUpdate”:1447095810,“LastOld”:“1”,“Expressions”:{“1”:{“SceneID”:9,“LastEval”:1},“0”:{“SceneID”:10,“LastEval”:0}},“LastNew”:“0”}}},“10111”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:6},“new == "1"”:{“SceneID”:5}}}}},“7”:{“urn:upnp-org:serviceId:VContainer1”:{“Variable2”:{“Expressions”:{“‘True’”:{“SceneID”:4}}}}},“10088”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:8}}}}}}
2015-11-09 20:11:48.311 luup_log:3: ALTUI: debug: registeredWatches found a match
2015-11-09 20:11:48.311 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,1,0,1,1447096308,9)
2015-11-09 20:11:48.311 luup_log:3: ALTUI: debug: _evaluateUserExpression(0,1,1447096308,1)
2015-11-09 20:11:48.312 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [1]
2015-11-09 20:11:48.313 luup_log:3: ALTUI: debug: run_scene(9)
2015-11-09 20:11:48.313 luup.call_action:3: 0.urn:micasaverde-com:serviceId:HomeAutomationGateway1.RunScene
2015-11-09 20:11:48.314 luup.scenes:0: running scene 9, SB PLAYING, initiated by command
2015-11-09 20:11:48.315 luup_log:3: ALTUI: debug: evaluateExpression() returns 1
2015-11-09 20:11:48.315 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,0,0,1,1447096308,10)
2015-11-09 20:11:48.316 luup_log:3: ALTUI: debug: _evaluateUserExpression(0,1,1447096308,0)
2015-11-09 20:11:48.317 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [0]
2015-11-09 20:11:48.318 luup_log:3: ALTUI: debug: ignoring watch trigger, loadstring returned 0

switch off

2015-11-09 20:13:11.243 luup_log:3: ALTUI: debug: variableWatchCallback(10130,urn:upnp-org:serviceId:SwitchPower1,Status,old:‘1’,new:‘0’)
2015-11-09 20:13:11.244 luup_log:3: ALTUI: debug: findWatch(10130,urn:upnp-org:serviceId:SwitchPower1,Status)
2015-11-09 20:13:11.248 luup_log:3: ALTUI: debug: registeredWatches: {“10130”:{“urn:upnp-org:serviceId:SwitchPower1”:{“Status”:{“LastUpdate”:1447096308,“LastOld”:“0”,“Expressions”:{“1”:{“SceneID”:9,“LastEval”:1},“0”:{“LastEval”:0,“SceneID”:10}},“LastNew”:“1”}}},“10111”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:6},“new == "1"”:{“SceneID”:5}}}}},“7”:{“urn:upnp-org:serviceId:VContainer1”:{“Variable2”:{“Expressions”:{“‘True’”:{“SceneID”:4}}}}},“10088”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:8}}}}}}
2015-11-09 20:13:11.249 luup_log:3: ALTUI: debug: registeredWatches found a match
2015-11-09 20:13:11.249 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,1,1,0,1447096391,9)
2015-11-09 20:13:11.250 luup_log:3: ALTUI: debug: _evaluateUserExpression(1,0,1447096391,1)
2015-11-09 20:13:11.251 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [1]
2015-11-09 20:13:11.251 luup_log:3: ALTUI: debug: run_scene(9)
2015-11-09 20:13:11.252 luup.call_action:3: 0.urn:micasaverde-com:serviceId:HomeAutomationGateway1.RunScene
2015-11-09 20:13:11.252 luup.scenes:0: running scene 9, SB PLAYING, initiated by command
2015-11-09 20:13:11.253 luup_log:3: ALTUI: debug: evaluateExpression() returns 1
2015-11-09 20:13:11.254 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,0,1,0,1447096391,10)
2015-11-09 20:13:11.254 luup_log:3: ALTUI: debug: _evaluateUserExpression(1,0,1447096391,0)
2015-11-09 20:13:11.255 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [0]
2015-11-09 20:13:11.256 luup_log:3: ALTUI: debug: ignoring watch trigger, loadstring returned 0

[quote=“delle, post:3, topic:189573”]Thanks amg0

I have a scene to switch on and another one to switch off a device. What’s wrong with a trigger watching the variable “Status”. Why is always the same scene(9) triggered whatever the value of the status is. Scene 10 is always evaluated as second option

switch on

2015-11-09 20:11:48.306 luup_log:3: ALTUI: debug: variableWatchCallback(10130,urn:upnp-org:serviceId:SwitchPower1,Status,old:‘0’,new:‘1’)
2015-11-09 20:11:48.307 luup_log:3: ALTUI: debug: findWatch(10130,urn:upnp-org:serviceId:SwitchPower1,Status)
2015-11-09 20:11:48.310 luup_log:3: ALTUI: debug: registeredWatches: {“10130”:{“urn:upnp-org:serviceId:SwitchPower1”:{“Status”:{“LastUpdate”:1447095810,“LastOld”:“1”,“Expressions”:{“1”:{“SceneID”:9,“LastEval”:1},“0”:{“SceneID”:10,“LastEval”:0}},“LastNew”:“0”}}},“10111”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:6},“new == "1"”:{“SceneID”:5}}}}},“7”:{“urn:upnp-org:serviceId:VContainer1”:{“Variable2”:{“Expressions”:{“‘True’”:{“SceneID”:4}}}}},“10088”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:8}}}}}}
2015-11-09 20:11:48.311 luup_log:3: ALTUI: debug: registeredWatches found a match
2015-11-09 20:11:48.311 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,1,0,1,1447096308,9)
2015-11-09 20:11:48.311 luup_log:3: ALTUI: debug: _evaluateUserExpression(0,1,1447096308,1)
2015-11-09 20:11:48.312 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [1]
2015-11-09 20:11:48.313 luup_log:3: ALTUI: debug: run_scene(9)
2015-11-09 20:11:48.313 luup.call_action:3: 0.urn:micasaverde-com:serviceId:HomeAutomationGateway1.RunScene
2015-11-09 20:11:48.314 luup.scenes:0: running scene 9, SB PLAYING, initiated by command
2015-11-09 20:11:48.315 luup_log:3: ALTUI: debug: evaluateExpression() returns 1
2015-11-09 20:11:48.315 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,0,0,1,1447096308,10)
2015-11-09 20:11:48.316 luup_log:3: ALTUI: debug: _evaluateUserExpression(0,1,1447096308,0)
2015-11-09 20:11:48.317 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [0]
2015-11-09 20:11:48.318 luup_log:3: ALTUI: debug: ignoring watch trigger, loadstring returned 0

switch off

2015-11-09 20:13:11.243 luup_log:3: ALTUI: debug: variableWatchCallback(10130,urn:upnp-org:serviceId:SwitchPower1,Status,old:‘1’,new:‘0’)
2015-11-09 20:13:11.244 luup_log:3: ALTUI: debug: findWatch(10130,urn:upnp-org:serviceId:SwitchPower1,Status)
2015-11-09 20:13:11.248 luup_log:3: ALTUI: debug: registeredWatches: {“10130”:{“urn:upnp-org:serviceId:SwitchPower1”:{“Status”:{“LastUpdate”:1447096308,“LastOld”:“0”,“Expressions”:{“1”:{“SceneID”:9,“LastEval”:1},“0”:{“LastEval”:0,“SceneID”:10}},“LastNew”:“1”}}},“10111”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:6},“new == "1"”:{“SceneID”:5}}}}},“7”:{“urn:upnp-org:serviceId:VContainer1”:{“Variable2”:{“Expressions”:{“‘True’”:{“SceneID”:4}}}}},“10088”:{“urn:micasaverde-com:serviceId:SecuritySensor1”:{“Tripped”:{“Expressions”:{“1”:{“SceneID”:8}}}}}}
2015-11-09 20:13:11.249 luup_log:3: ALTUI: debug: registeredWatches found a match
2015-11-09 20:13:11.249 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,1,1,0,1447096391,9)
2015-11-09 20:13:11.250 luup_log:3: ALTUI: debug: _evaluateUserExpression(1,0,1447096391,1)
2015-11-09 20:13:11.251 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [1]
2015-11-09 20:13:11.251 luup_log:3: ALTUI: debug: run_scene(9)
2015-11-09 20:13:11.252 luup.call_action:3: 0.urn:micasaverde-com:serviceId:HomeAutomationGateway1.RunScene
2015-11-09 20:13:11.252 luup.scenes:0: running scene 9, SB PLAYING, initiated by command
2015-11-09 20:13:11.253 luup_log:3: ALTUI: debug: evaluateExpression() returns 1
2015-11-09 20:13:11.254 luup_log:3: ALTUI: debug: evaluateExpression(10130,urn:upnp-org:serviceId:SwitchPower1,Status,0,1,0,1447096391,10)
2015-11-09 20:13:11.254 luup_log:3: ALTUI: debug: _evaluateUserExpression(1,0,1447096391,0)
2015-11-09 20:13:11.255 luup_log:3: ALTUI: debug: Evaluation of user watch expression returned: [0]
2015-11-09 20:13:11.256 luup_log:3: ALTUI: debug: ignoring watch trigger, loadstring returned 0[/quote]

thx for the debug trace, very useful.
see the registeredWatch json object (attached ). the json data structure is a hash of hash of hash etc and is organized this way
devid, service, variable , “expressions container”, expression ( each and individual ) , index , scene to run and last evel

you seem to have expressions like this:

  • expression “True”, “1” or 1 will allways evaluate to true and therefore allways execute the scene
  • expression 0 will allways evaluate to false and therefore never execute the scene

Now the questions are:
a) what is the content of the VariableToSend and VariableToWatch ALTUI variable
b) what is ALTUI version
c) can you confirm in your scene screens what expressions you wanted ?

Thanks amg0

VariablesToWatch contains

;urn:upnp-org:serviceId:VContainer1#Variable2#7#4#‘True’#;urn:micasaverde-com:serviceId:SecuritySensor1#Tripped#10088#8#1#;urn:micasaverde-com:serviceId:SecuritySensor1#Tripped#10111#6#1#;urn:upnp-org:serviceId:SwitchPower1#Status#10130#9#1#;urn:upnp-org:serviceId:SwitchPower1#Status#10130#10#0#;urn:micasaverde-com:serviceId:SecuritySensor1#Tripped#10111#5#1#

VariablesToSend I do not see

Version is AltUI v0.85.787

Please find attached the trigger info

[quote=“delle, post:5, topic:189573”]Thanks amg0

VariablesToWatch contains

;urn:upnp-org:serviceId:VContainer1#Variable2#7#4#‘True’#;urn:micasaverde-com:serviceId:SecuritySensor1#Tripped#10088#8#1#;urn:micasaverde-com:serviceId:SecuritySensor1#Tripped#10111#6#1#;urn:upnp-org:serviceId:SwitchPower1#Status#10130#9#1#;urn:upnp-org:serviceId:SwitchPower1#Status#10130#10#0#;urn:micasaverde-com:serviceId:SecuritySensor1#Tripped#10111#5#1#

VariablesToSend I do not see

Version is AltUI v0.85.787

Please find attached the trigger info[/quote]
Your altUI version is too old, you should please upgrade.
Also your Lua expression is wrong. 1 meAns it will fire every time.
You want to have “new==1” or “new==0” depending on the case.

Thanks amg0

I upgraded to version 885

In the end it seems the correct expression for tripping a security sensor is new == “1” or new == “0”

Thanks for all your work