Author Topic: Workflow not starting  (Read 235 times)

Offline Octoplayer

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-0
Workflow not starting
« on: July 07, 2017, 12:13:45 pm »
Hi,
I have just added a new workflow, but it does not want to start. I have checked my original workflow, and that is now doing the same. I have just created a new simple one - same again.
They all just sit there when I press reset, with the Start state Green. The countdown timer on my first action does not appear, and the Vera log says "luup_log:128: ALTUI: warning: Invalid Workflow altuiid:0-2"

The ALtui Switches are both "normal", and the workflows are enabled. Any hints on what I can try next?

My test workflow report is just
Code: [Select]
Details
Start - 805908a7-2cb1-4ae3-9e94-35eb7b74f379
Transitions
'test' - 2ef51cf5-7697-411b-9b55-178d53e348e9
When
Timer: 'test' expiration 10s
Moves To
State: S1
S1 - 7eb82226-a9d5-4ce6-9ff2-498c8a51ec23

Not sure if this is related, but when I added the new WF and restarted Luup, my User Panel was entirely blank. I reverted to the previous day's backup, and recreated the WF.

Browser is Chrome, Vera is V1.7.2935, Altui 1.89.2071

Thanks
Octo

Offline amg0

  • Moderator
  • Sr. Hero Member
  • *****
  • Posts: 2434
  • Karma: +147/-8
Re: Workflow not starting
« Reply #1 on: July 07, 2017, 02:07:15 pm »
Hi,
I have just added a new workflow, but it does not want to start. I have checked my original workflow, and that is now doing the same. I have just created a new simple one - same again.
They all just sit there when I press reset, with the Start state Green. The countdown timer on my first action does not appear, and the Vera log says "luup_log:128: ALTUI: warning: Invalid Workflow altuiid:0-2"

The ALtui Switches are both "normal", and the workflows are enabled. Any hints on what I can try next?

My test workflow report is just
Code: [Select]
Details
Start - 805908a7-2cb1-4ae3-9e94-35eb7b74f379
Transitions
'test' - 2ef51cf5-7697-411b-9b55-178d53e348e9
When
Timer: 'test' expiration 10s
Moves To
State: S1
S1 - 7eb82226-a9d5-4ce6-9ff2-498c8a51ec23

Not sure if this is related, but when I added the new WF and restarted Luup, my User Panel was entirely blank. I reverted to the previous day's backup, and recreated the WF.

Browser is Chrome, Vera is V1.7.2935, Altui 1.89.2071

Thanks
Octo
Could you please share altui device variables values ( misc / debug / device's state ) ?
Also you can put altui in debug mode, restart loup engine , and share the /var/log/cmh log file


Offline Octoplayer

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-0
Re: Workflow not starting
« Reply #2 on: July 07, 2017, 05:27:56 pm »
Just come back to my machine - it has lost my panel and all 3 workflows they are just blank and it does not show any workflow.  :(
Before I restore, I have looked for the variables:
Debug = 0
Enable Workflow = 1
I cannot see misc or device state vars in the Var list?

There are 3 entries for Workflow - but they are blank
and 10 entries for data_page1_n

I have restarted the luup in debug mode - file attached (zipped as it was too large)

Thanks

Offline Octoplayer

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-0
Re: Workflow not starting
« Reply #3 on: July 07, 2017, 05:47:09 pm »
Hmmm, just tried creating a new simple workflow to replace the missing ones, That is working as expecting: Start goes red, link timer counts down and S1 goes red.

However, Custom Page is still blank, even on another browser, although the config still seems to be in the Var fields.




Offline Octoplayer

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-0
Re: Workflow not starting
« Reply #4 on: July 08, 2017, 11:55:15 am »
Just had another look, noticed the Options Page had a restore User Page Cache button... pressed that and the panel reappeared, so just need to recreate the workflow and I'm done.


Offline amg0

  • Moderator
  • Sr. Hero Member
  • *****
  • Posts: 2434
  • Karma: +147/-8
Re: Workflow not starting
« Reply #5 on: July 08, 2017, 01:33:38 pm »
Just had another look, noticed the Options Page had a restore User Page Cache button... pressed that and the panel reappeared, so just need to recreate the workflow and I'm done.

I suspect some kind of data corruption issue during last save. the log file you provided only show empty workflow so that does not tell why it would not start. I suspect after the restore and teh creation of new workflow it should work
if not, same procedure please, DEBUG mode & reload then share the log files
if you are concerned about privacy you can use private mail
hope that helps

Offline Octoplayer

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-0
Re: Workflow not starting
« Reply #6 on: July 11, 2017, 12:14:45 pm »
Yep - I have re-created my workflows, and with the restored custom panel all is back to normal.

PS - minor one for the Bug list - the tool tip on the Custom Page editor for an Action says "Run Scene" rather than "Run Action"

Thanks

Offline amg0

  • Moderator
  • Sr. Hero Member
  • *****
  • Posts: 2434
  • Karma: +147/-8
Re: Workflow not starting
« Reply #7 on: July 11, 2017, 04:25:30 pm »
Yep - I have re-created my workflows, and with the restored custom panel all is back to normal.

PS - minor one for the Bug list - the tool tip on the Custom Page editor for an Action says "Run Scene" rather than "Run Action"

Thanks

ok; fixed in v >= 2083. thx

Offline Octoplayer

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-0
Re: Workflow not starting
« Reply #8 on: July 17, 2017, 07:03:10 pm »
Hi, Still having problems with my workflow, a simple switch which will just not work.
I think I have tracked it to a bug, or at least unexpected behaviour in the WorkFlow transition detector.

I am monitoring motion and light levels with an AOTech 4-in-one, to turn on a light when there is movement and light levels are below a threshold.

I have simplified this down to a 2-state machine, just "dark" or "bright", with a simple transition between them, triggered when light levels go above or below thresholds.
Even with everything dark, the logic is getting repeatedly getting incorrectly triggered and going to the Bright state.
So the Bright condition is new >25, the new light level is 5-6, but the debug log says the condition is met. (see highlighted bits in the debug log.)
I have the main code I am trying to use as 0-1, but that is paused. I have tried various combinations, including using Blocky to generate the conditions, but the behaviour is consistent.

Any thoughts to save my sanity??
Thanks

Quote
0   07/17/17 23:45:20.712   luup_log:128: ALTUI: debug: _internalVariableWatchCB(0-207,urn:micasaverde-com:serviceId:LightSensor1,CurrentLevel,old:'5',new:'6') - (Wkflow) <0x76432520>
50   07/17/17 23:45:20.713   luup_log:128: ALTUI: debug: findWatch(0-207,urn:micasaverde-com:serviceId:LightSensor1,CurrentLevel) <0x76432520>
50   07/17/17 23:45:20.715   luup_log:128: ALTUI: debug: registeredWatches: { "0-202": { "urn:upnp-org:serviceId:SwitchPower1": { "Status": { "LastUpdate": 1500328475, "LastOld": "1", "Expressions": { "workflow": [ { "WorkflowAltuiID": "0-1" } ] }, "LastNew": "0" } } }, "0-207": { "urn:micasaverde-com:serviceId:LightSensor1": { "CurrentLevel": { "LastUpdate": 1500331480, "LastOld": "6", "Expressions": { "workflow": [ { "WorkflowAltuiID": "0-2" } ] }, "LastNew": "5" } } }, "0-25": { "urn:micasaverde-com:serviceId:SecuritySensor1": { "ArmedTripped": { "LastUpdate": 1500328578, "LastOld": "1", "Expressions": { "workflow": [ { "WorkflowAltuiID": "0-1" } ] }, "LastNew": "0" }, "Tripped": { "LastUpdate": 1500328578, "LastOld": "1", "Expressions": { "workflow": [ { "WorkflowAltuiID": "0-1" } ] }, "LastNew": "0" } } } } <0x76432520>
50   07/17/17 23:45:20.716   luup_log:128: ALTUI: debug: -----> evaluateExpression() { "workflow": [ { "WorkflowAltuiID": "0-2" } ] } <0x76432520>
50   07/17/17 23:45:20.717   luup_log:128: ALTUI: debug: Wkflow - executeWorkflows(128 , { "device": "0-207", "service": "urn:micasaverde-com:serviceId:LightSensor1", "watch": { "LastUpdate": 1500331520, "LastOld": "5", "Expressions": { "workflow": [ { "WorkflowAltuiID": "0-2" } ] }, "LastNew": "6" }, "variable": "CurrentLevel" }) <0x76432520>
50   07/17/17 23:45:20.718   luup_log:128: ALTUI: debug: Wkflow - executeWorkflows limited to specific workflows <0x76432520>
50   07/17/17 23:45:20.718   luup_log:128: ALTUI: debug: Wkflow - evalWorkflowState(128, 2), workflow:Workflow 0-2 <0x76432520>
50   07/17/17 23:45:20.718   luup_log:128: ALTUI: debug: Wkflow - findStartState(2) <0x76432520>
50   07/17/17 23:45:20.719   luup_log:128: ALTUI: debug: Wkflow - findStartState(2) returns 8cbc1cb1-55d0-48cd-a153-0f7af34b22b0 <0x76432520>
50   07/17/17 23:45:20.719   luup_log:128: ALTUI: debug: Wkflow - active state:bc2a23c4-be79-4a06-9dd7-c58cbd883f36, Dark <0x76432520>
50   07/17/17 23:45:20.719   luup_log:128: ALTUI: debug: Wkflow - evaluateStateTransition(128,Start,2) <0x76432520>
50   07/17/17 23:45:20.720   luup_log:128: ALTUI: debug: Wkflow - link props:{ "onEnter": [  ], "comment": "", "expired": false, "onExit": [  ], "onEnterLua": "", "onEnterScenes": [  ], "stateinfo": { "bStart": true }, "onExitLua": "", "onExitScenes": [  ] } <0x76432520>
50   07/17/17 23:45:20.721   luup_log:128: ALTUI: debug: Wkflow - link has a timer. <0x76432520>
50   07/17/17 23:45:20.721   luup_log:128: ALTUI: debug: Wkflow - blocked:, paused: <0x76432520>
50   07/17/17 23:45:20.721   luup_log:128: ALTUI: debug: Wkflow - getStateTransitions(128) <0x76432520>
50   07/17/17 23:45:20.721   luup_log:128: ALTUI: debug: Wkflow - getStateTransitions(128) returns 1 transitions <0x76432520>
50   07/17/17 23:45:20.722   luup_log:128: ALTUI: debug: Wkflow - evaluateStateTransition(128,BRight,2) <0x76432520>
50   07/17/17 23:45:20.723   luup_log:128: ALTUI: debug: Wkflow - link props:{ "workflows": [  ], "comment": "", "timer": "", "conditions": [ { "luaexpr": "(new > '25')", "triggeronly": true, "device": "0-207", "variable": "CurrentLevel", "service": "urn:micasaverde-com:serviceId:LightSensor1" } ], "duration": "", "smooth": true } <0x76432520>
50   07/17/17 23:45:20.724   luup_log:128: ALTUI: debug: Wkflow - Condition (new > '25') is TriggerOnly and watchevent:{ "device": "0-207", "service": "urn:micasaverde-com:serviceId:LightSensor1", "watch": { "LastUpdate": 1500331520, "LastOld": "5", "Expressions": { "workflow": [ { "WorkflowAltuiID": "0-2" } ] }, "LastNew": "6" }, "variable": "CurrentLevel" } <0x76432520>
50   07/17/17 23:45:20.724   luup_log:128: ALTUI: debug: _evaluateUserExpression(128,207,urn:micasaverde-com:serviceId:LightSensor1,CurrentLevel,5,6,1500331520,(new > '25')) <0x76432520>
50   07/17/17 23:45:20.726   luup_log:128: ALTUI: debug: setVariableIfChanged(urn:upnp-org:serviceId:altui1,WorkflowsVariableBag,{ "0-2": [  ], "0-1": [  ] },128) <0x76432520>
50   07/17/17 23:45:20.726   luup_log:128: ALTUI: debug: Evaluation of user watch expression returned: [ true ] <0x76432520>
50   07/17/17 23:45:20.727   luup_log:128: ALTUI: Wkflow - Workflow: 0-2, Valid Transition found:BRight, Active State:Dark=>Bright <0x76432520>[

/quote]
Code: [Select]
Workflow 0-2 - (0-2)
3 States: Start, Dark, Bright
3 Transitions: test, Dim, BRight
Details
Start - 8cbc1cb1-55d0-48cd-a153-0f7af34b22b0
Transitions
'test' - 6afd8b42-9497-4320-90a6-f6de9e4025ab
When
Timer: '3s' expiration 3s
Moves To
State: Dark
Dark - bc2a23c4-be79-4a06-9dd7-c58cbd883f36
Transitions
'BRight' - b5bb50fc-04a5-4d02-850c-b3d6d3de5574
When
 Trigger, device:'_Light Sensor' (0-207) when urn:micasaverde-com:serviceId:LightSensor1-CurrentLevel
(new > '25')
Moves To
State: Bright
Bright - 2b6aa1d6-bf24-49dc-90cd-a99956aaa051
Transitions
'Dim' - c581c129-f5e4-41ef-85f3-442d42f5eb06
When
 Trigger, device:'_Light Sensor' (0-207) when urn:micasaverde-com:serviceId:LightSensor1-CurrentLevel
(new < '20')
Moves To
State: Dark

Offline jswim788

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +14/-2
Re: Workflow not starting
« Reply #9 on: July 17, 2017, 07:54:00 pm »
new is likely a string, so the comparison with '25' will be alphabetical, not numeric.  You could try (tonumber(new) > 25) as the transition expression.

Offline amg0

  • Moderator
  • Sr. Hero Member
  • *****
  • Posts: 2434
  • Karma: +147/-8
Re: Workflow not starting
« Reply #10 on: July 18, 2017, 06:11:08 am »
new is likely a string, so the comparison with '25' will be alphabetical, not numeric.  You could try (tonumber(new) > 25) as the transition expression.

that is exactly the issue.  new is the new value of the watched device variable and like luup.variable_get() , the result is a string
"6" is > "25" so it triggers

indeed you can use tonumber(new)>25 in your comparison and it should work

Offline Octoplayer

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +3/-0
Re: Workflow not starting
« Reply #11 on: July 18, 2017, 04:53:14 pm »
Doh - I had looked at that in the log and examples, not noticed that it was a string compare  - but all the tests I did were == '5', 6, or 7, which of course worked.

Thanks JSWIN and AMG, Its working much better now.

I now have a working example attached of a sensor  :), motion triggered, with the ability to manually (verbally) override the the light on or off, based on the AOTech 4-1 device. For anyone interested, I have the 4-1 set to armed, reporting every 15s, and triggering on for 20s after motion is detected. If the light is turned manually, it will not turn off when motion stops , and if it is turned off manually, it will not retrigger for 15min.

Code: [Select]
Start - 67153095-a961-4b7c-87a6-126e8ed171a2
Transitions
'Start' - 596694ec-8dc2-4b10-b759-2854b9b25c36
When
Timer: 'fred' expiration 5s
Moves To
State: K Off
Light On Timer - 71a91093-ff5a-437d-bdf6-2d8fb2674ad5
OnEnter
on Kitchen Lights (0-202) urn:upnp-org:serviceId:SwitchPower1-SetTarget [{"name":"newTargetValue","value":"1"}]
OnExit
on Kitchen Lights (0-202) urn:upnp-org:serviceId:SwitchPower1-SetTarget [{"name":"newTargetValue","value":"0"}]
Transitions
'No Motion' - d6d7f4c9-d96a-4258-a9d4-be955cf611ce
When
 Trigger, device:'4 in 1 sensor (motion)' (0-25) when urn:micasaverde-com:serviceId:SecuritySensor1-Tripped
new=='0'
Moves To
State: Turning Off
'K Light Off' - a4ad6ae5-13bf-45be-ab64-660eb4e2d8b1
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new == '0'
Moves To
State: Cooling off
Light on by demand - 49c61fae-1917-4e3c-9086-08e9353df97a
Transitions
'K Light Off' - 53c1d640-f895-4003-860f-55b2dcdd0886
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new == '0'
Moves To
State: K Off
K Off - bb6a3fdd-320d-4e4d-86e9-26695e1dbd8a
Transitions
'Motion ' - 2ef95732-da9a-4f4e-9c10-10976c2de378
When
Schedule:
evening day of week: 1,2,3,4,5,6,7 h:m:s= [-00:15:00T] @ mode:All
 Trigger, device:'4 in 1 sensor (motion)' (0-25) when urn:micasaverde-com:serviceId:SecuritySensor1-ArmedTripped
new=='1'
device:'_Light Sensor' (0-207) when urn:micasaverde-com:serviceId:LightSensor1-CurrentLevel
tonumber(new) < 25
Moves To
State: Light On Timer
'K Light On' - c9512011-ac84-4fb8-8fb2-9fcb38fe4ce4
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new=='1'
Moves To
State: Light on by demand
Turning Off - 345de433-fff9-449c-bcd4-45504f8fd19b
OnEnter
on Kitchen Lights (0-202) urn:upnp-org:serviceId:SwitchPower1-SetTarget [{"name":"newTargetValue","value":"0"}]
Transitions
'Motion ' - 50a40dcc-9028-4aed-a269-a734aaa9b5ae
When
Schedule:
evening day of week: 1,2,3,4,5,6,7 h:m:s= [-00:15:00T] @ mode:All
 Trigger, device:'4 in 1 sensor (motion)' (0-25) when urn:micasaverde-com:serviceId:SecuritySensor1-ArmedTripped
new=='1'
Moves To
State: Light On Timer
'Dark' - a5789c91-e172-4503-bb9e-25ddb80476ce
When
device:'_Light Sensor' (0-207) when urn:micasaverde-com:serviceId:LightSensor1-CurrentLevel
tonumber(new) <25
Moves To
State: K Off
'20s' - 5900a7c3-d211-4d56-8474-80c6f662490a
When
Timer: '20s' expiration 20s
Moves To
State: K Off
'K Light On' - 68ff397b-ab2c-455a-af7a-b7b81a0454d7
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new=='1'
Moves To
State: Light on by demand
Cooling off - 294555e2-55f5-4206-b050-7e4010c6c8d5
Transitions
'15m' - 1468eddb-6bed-4023-8589-535c63e06613
When
Timer: '15m' expiration 900s
Moves To
State: K Off
'K Light On' - dce7df38-2948-47bf-8fda-7b1c16acd6f1
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new=='1'
Moves To
State: Light on by demand

Offline amg0

  • Moderator
  • Sr. Hero Member
  • *****
  • Posts: 2434
  • Karma: +147/-8
Re: Workflow not starting
« Reply #12 on: July 19, 2017, 12:31:42 pm »
Doh - I had looked at that in the log and examples, not noticed that it was a string compare  - but all the tests I did were == '5', 6, or 7, which of course worked.

Thanks JSWIN and AMG, Its working much better now.

I now have a working example attached of a sensor  :), motion triggered, with the ability to manually (verbally) override the the light on or off, based on the AOTech 4-1 device. For anyone interested, I have the 4-1 set to armed, reporting every 15s, and triggering on for 20s after motion is detected. If the light is turned manually, it will not turn off when motion stops , and if it is turned off manually, it will not retrigger for 15min.

Code: [Select]
Start - 67153095-a961-4b7c-87a6-126e8ed171a2
Transitions
'Start' - 596694ec-8dc2-4b10-b759-2854b9b25c36
When
Timer: 'fred' expiration 5s
Moves To
State: K Off
Light On Timer - 71a91093-ff5a-437d-bdf6-2d8fb2674ad5
OnEnter
on Kitchen Lights (0-202) urn:upnp-org:serviceId:SwitchPower1-SetTarget [{"name":"newTargetValue","value":"1"}]
OnExit
on Kitchen Lights (0-202) urn:upnp-org:serviceId:SwitchPower1-SetTarget [{"name":"newTargetValue","value":"0"}]
Transitions
'No Motion' - d6d7f4c9-d96a-4258-a9d4-be955cf611ce
When
 Trigger, device:'4 in 1 sensor (motion)' (0-25) when urn:micasaverde-com:serviceId:SecuritySensor1-Tripped
new=='0'
Moves To
State: Turning Off
'K Light Off' - a4ad6ae5-13bf-45be-ab64-660eb4e2d8b1
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new == '0'
Moves To
State: Cooling off
Light on by demand - 49c61fae-1917-4e3c-9086-08e9353df97a
Transitions
'K Light Off' - 53c1d640-f895-4003-860f-55b2dcdd0886
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new == '0'
Moves To
State: K Off
K Off - bb6a3fdd-320d-4e4d-86e9-26695e1dbd8a
Transitions
'Motion ' - 2ef95732-da9a-4f4e-9c10-10976c2de378
When
Schedule:
evening day of week: 1,2,3,4,5,6,7 h:m:s= [-00:15:00T] @ mode:All
 Trigger, device:'4 in 1 sensor (motion)' (0-25) when urn:micasaverde-com:serviceId:SecuritySensor1-ArmedTripped
new=='1'
device:'_Light Sensor' (0-207) when urn:micasaverde-com:serviceId:LightSensor1-CurrentLevel
tonumber(new) < 25
Moves To
State: Light On Timer
'K Light On' - c9512011-ac84-4fb8-8fb2-9fcb38fe4ce4
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new=='1'
Moves To
State: Light on by demand
Turning Off - 345de433-fff9-449c-bcd4-45504f8fd19b
OnEnter
on Kitchen Lights (0-202) urn:upnp-org:serviceId:SwitchPower1-SetTarget [{"name":"newTargetValue","value":"0"}]
Transitions
'Motion ' - 50a40dcc-9028-4aed-a269-a734aaa9b5ae
When
Schedule:
evening day of week: 1,2,3,4,5,6,7 h:m:s= [-00:15:00T] @ mode:All
 Trigger, device:'4 in 1 sensor (motion)' (0-25) when urn:micasaverde-com:serviceId:SecuritySensor1-ArmedTripped
new=='1'
Moves To
State: Light On Timer
'Dark' - a5789c91-e172-4503-bb9e-25ddb80476ce
When
device:'_Light Sensor' (0-207) when urn:micasaverde-com:serviceId:LightSensor1-CurrentLevel
tonumber(new) <25
Moves To
State: K Off
'20s' - 5900a7c3-d211-4d56-8474-80c6f662490a
When
Timer: '20s' expiration 20s
Moves To
State: K Off
'K Light On' - 68ff397b-ab2c-455a-af7a-b7b81a0454d7
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new=='1'
Moves To
State: Light on by demand
Cooling off - 294555e2-55f5-4206-b050-7e4010c6c8d5
Transitions
'15m' - 1468eddb-6bed-4023-8589-535c63e06613
When
Timer: '15m' expiration 900s
Moves To
State: K Off
'K Light On' - dce7df38-2948-47bf-8fda-7b1c16acd6f1
When
 Trigger, device:'Kitchen Lights' (0-202) when urn:upnp-org:serviceId:SwitchPower1-Status
new=='1'
Moves To
State: Light on by demand
Excellent. Good show case of what workflow can do...