[quote=“pls90, post:9, topic:194845”]my cat was kind enough to provide more data for analysis.
As you can see from the timestamps of PLEG status, that the outer sensor was tripped first, then the inner sensor.
Workflow announced leaving.
In the log:
[code]10210 = inner
10211 = outer
2016-12-24 19:34:05.473 luup.variable_set:5: 10210.urn:micasaverde-com:serviceId:SecuritySensor1.Tripped was: 0 now: 1 #hooks:1
2016-12-24 19:34:05.473 luup.variable_set:5: 10210.urn:micasaverde-com:serviceId:SecuritySensor1.ArmedTripped was: 0 now: 1 #hooks:0
2016-12-24 19:34:05.473 luup.variable_set:5: 10210.urn:micasaverde-com:serviceId:SecuritySensor1.LastTrip was: 1482599741 now: 1482604444 #hooks:0
2016-12-24 19:34:05.474 luup.variable_set:5: 10211.urn:micasaverde-com:serviceId:SecuritySensor1.Tripped was: 0 now: 1 #hooks:1
2016-12-24 19:34:05.474 luup.variable_set:5: 10211.urn:micasaverde-com:serviceId:SecuritySensor1.LastTrip was: 1482599743 now: 1482604439 #hooks:0
2016-12-24 19:34:05.474 luup.variable_set:5: 10211.urn:micasaverde-com:serviceId:SecuritySensor1.ArmedTripped was: 0 now: 1 #hooks:0
2016-12-24 19:34:19.047 luup_log:3: ALTUI: Wkflow - Workflow: 0-30, Valid Transition found:motion_inner, Active State:waiting=>inner tripped
2016-12-24 19:34:19.047 luup.variable_set:3: 3.urn:upnp-org:serviceId:altui1.Timers was: [] now: [] #hooks:0
2016-12-24 19:34:19.054 luup.variable_set:3: 3.urn:upnp-org:serviceId:altui1.WorkflowsActiveState was: {“0-3”:“582a5825-8463-4165-847c-3d808246f23f”,“0-44”:“2f001db9-64a3-4bfb-b575-5fc87a5a367f”,“0-36”:"2f65637a-c544-4… now: {“0-3”:“582a5825-8463-4165-847c-3d808246f23f”,“0-44”:“2f001db9-64a3-4bfb-b575-5fc87a5a367f”,“0-36”:"2f65637a-c544-4… #hooks:0
2016-12-24 19:34:19.071 luup.variable_set:3: 3.urn:upnp-org:serviceId:altui1.Timers was: [] now: [{“armed”:true,“data”:"3#19#8a553840-e2fd-4c11-9eed-4a88ac37f221#c62b0508-54f6-4430-b8e1-5d41fb407e65#a7c462f5-ef75… #hooks:0
2016-12-24 19:34:19.085 luup.watch_callback:: 10211.urn:micasaverde-com:serviceId:SecuritySensor1.Tripped function: 0xe34ec0
2016-12-24 19:34:19.103 luup_log:3: ALTUI: Wkflow - Workflow: 0-30, Valid Transition found:motion_outer, Active State:inner tripped=>notify away
2016-12-24 19:34:19.103 luup.variable_set:3: 3.urn:upnp-org:serviceId:altui1.Timers was: [{“armed”:true,“data”:"3#19#8a553840-e2fd-4c11-9eed-4a88ac37f221#c62b0508-54f6-4430-b8e1-5d41fb407e65#a7c462f5-ef75… now: [] #hooks:0
2016-12-24 19:34:19.110 luup.variable_set:3: 3.urn:upnp-org:serviceId:altui1.WorkflowsActiveState was: {“0-3”:“582a5825-8463-4165-847c-3d808246f23f”,“0-44”:“2f001db9-64a3-4bfb-b575-5fc87a5a367f”,“0-36”:"2f65637a-c544-4… now: {“0-3”:“582a5825-8463-4165-847c-3d808246f23f”,“0-44”:“2f001db9-64a3-4bfb-b575-5fc87a5a367f”,“0-36”:"2f65637a-c544-4… #hooks:0
2016-12-24 19:34:19.114 luup.call_action:3: 22.urn:upnp-org:serviceId:IOSPush1.SendPushOverNotification
2016-12-24 19:34:20.118 luup.variable_set:22: 22.urn:upnp-org:serviceId:IOSPush1.TimeSend was: 1482599733 now: 1482604460 #hooks:0[/code]
The workflow works correctly when the cat is entering slowly, when she is fast there seems to be a problem with two consecutive triggers in close timely proximity.
This time there were 5s between trip of outer and inner sensor.
The workflow is quite simple and straight forward.
I don’t think that the problem can be solved by changing workflows.
Just to try a different approach: could I use lua code to evaluate transitions?
Something like
if timestamp_outer_trip < timestamp_inner_trip then "entering"
What exactly is the conditions for the motion_inner and motion_outer ?
it seems that the root cause can be that watches are processed in the order they are notified by VERA ( with luup watch I suppose and like you see in the log ) while the actual order of tripping timestamp is different as you can see in the logs
2016-12-24 19:34:05.473 luup.variable_set:5: 10210.urn:micasaverde-com:serviceId:SecuritySensor1.LastTrip was: 1482599741 now: 1482604444 #hooks:0
2016-12-24 19:34:05.474 luup.variable_set:5: 10211.urn:micasaverde-com:serviceId:SecuritySensor1.Tripped was: 0 now: 1 #hooks:1
2016-12-24 19:34:05.474 luup.variable_set:5: 10211.urn:micasaverde-com:serviceId:SecuritySensor1.LastTrip was: 1482599743 now: 1482604439 #hooks:0
maybe the way is to have a workflow which wait for 2 tripping ( indiferently inner ou outer ) in an interval less than 2 seconds. Once that has happened , then get the actual timestamps to do a diff and decide , based on the sign of the diff , if it is in or out event
potential worfklow
S0 : idle
Transition:
either one trip happens
S1 : one trip happened
Transition:
timer 2 s => go back to idle S0
second trip happens => S2
S2 : 2 trip happenned
motion_in : condition compares the 2 motion timestamps and is inner>outer
motion_out : condition compares the 2 motion timestamps and is outer>inner