We have moved at community.getvera.com

Author Topic: ALTUI: Workflows Issues  (Read 28902 times)

Offline xeinth

  • Full Member
  • ***
  • Posts: 144
  • Karma: +1/-1
Re: ALTUI: Workflows
« Reply #60 on: April 08, 2016, 01:09:10 pm »
You make it hard to leave you alone.

The bag stuff, very nice.  A couple of questions, what is the scope of the variables (across workspaces, or within a workspace) and is there some way view them externally?  I assume they will persist across a restart?

The initial use case I'd be looking at this the thermostat values, which would follow the home mode/occupancy but still allow modification up or down from some stimulus like a scene controller or amazon echo triggered scene.

x

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #61 on: April 08, 2016, 01:32:30 pm »
You make it hard to leave you alone.

The bag stuff, very nice.  A couple of questions, what is the scope of the variables (across workspaces, or within a workspace) and is there some way view them externally?  I assume they will persist across a restart?

The initial use case I'd be looking at this the thermostat values, which would follow the home mode/occupancy but still allow modification up or down from some stimulus like a scene controller or amazon echo triggered scene.

x

Scope is one workflow. 2 workflows can have the same variable name in their Bag, it will not collide. Bag is persistent accross reboot/reload ( such as timers ). State of the OnEnter OnExit lua code and can call Luup.* api in the Global (_G ) space

EDIT:  important :
  • State onEnter or onExit can call the UPNP action of a device and can use a Bag["xxx"] value in the parameters
  • Link condition expressions can make use of a Bag["xxx"] value in their expression
« Last Edit: April 08, 2016, 04:37:08 pm by amg0 »

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #62 on: April 08, 2016, 04:12:36 pm »
amg,

One other thing, I know you answered this before but I was wondering if you could be more specific with an example or expression to allow a triggered event from a scene controller.  I can transition states based on a button value, but that works on current state and is not triggered only when pressed.  Obviously we can use a timestamp to calculate this, but that I doubt is the right approach as you'd have to compare to when you entered the state.

Do you have an example which works?

I'm working on a workflow for the home modes, which transitions based on occupancy, time of day etc and drives the AC/security etc.  Thus far seems good but this is one of the issues, and I have yet to work on how to maintain variables of for the AC temp values.

X

here is an example where I use a Nodon Octan scene controller ( remote with 4 buttons ). on this device,  once it is set in scene activation mode ( zwave param 3 is set to 1 ), you get the value of the pressed button in the LastSceneID variable of the device. so I use ALTUI watch features to trigger a scene when that variable LastSceneID is changed.

Here is a workflow that does nothing until the first button ( value 10 ) is pressed.  when it is pressed , the workfows goes to another state where it stays there until any button , other than the first one ( so value != 10 ) is pressed. when so, it returns to the first state.
More over, I use a Bag variable to capture the last pressed button and display it

that gives this workflow ( attached sceens )

hope this helps

Offline ndoggac

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Re: ALTUI: Workflows
« Reply #63 on: April 08, 2016, 04:39:18 pm »
This is amazing work!!  Thank you!!

Is there an export/import method for the code?  I saved the LUA code from a created workflow, then deleted the workflow.  I then tried to create a new workflow, and copy and paste the code back into the editor, but this didn't work.  Or at least the diagram didn't update. 

Any ideas?  SSH in and replace files somewhere perhaps?

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #64 on: April 08, 2016, 04:42:44 pm »
This is amazing work!!  Thank you!!

Is there an export/import method for the code?  I saved the LUA code from a created workflow, then deleted the workflow.  I then tried to create a new workflow, and copy and paste the code back into the editor, but this didn't work.  Or at least the diagram didn't update. 

Any ideas?  SSH in and replace files somewhere perhaps?

seems to be often asked for, I need to work on it. but did you try this =>
backup/restore => http://forum.micasaverde.com/index.php/topic,36868.msg277220.html#msg277220

Offline dklinkman

  • Full Member
  • ***
  • Posts: 129
  • Karma: +1/-0
Re: ALTUI: Workflows
« Reply #65 on: April 08, 2016, 10:49:15 pm »
I can hardly keep up with this but it's not like I'm trying.  Updated to latest

AltUI v1.34.1442, ? 2015 amg0

But I see new instability possibly.  I have one simple workflow which is just a 10 second toggle between two states.  Before update it worked just great.  Not exciting but it worked.

But now often I display the workflow, then get message above that controller did not respond.  Message repeats.  Apparently luup is restarting.  After a minute or so I can go back in fresh.

I was hoping to try the workflow reset button and now and again that appears to work.  The graphic shows state returning to start, but then the luup restart happens.  The above happens even without the reset button.  All just timing I guess.

I'll try deleting and recreating the workflow to see if that changes anything.  But this is definitely a thing with the existing workflow.

Cheerz!!    --David
VeraPlus, UI7, ALTUI on Chrome, Lots of devices and plugins including MQTT and MySensors.  Also playing around with openLuup

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #66 on: April 09, 2016, 02:39:36 am »
I can hardly keep up with this but it's not like I'm trying.  Updated to latest

AltUI v1.34.1442, ? 2015 amg0

But I see new instability possibly.  I have one simple workflow which is just a 10 second toggle between two states.  Before update it worked just great.  Not exciting but it worked.

But now often I display the workflow, then get message above that controller did not respond.  Message repeats.  Apparently luup is restarting.  After a minute or so I can go back in fresh.

I was hoping to try the workflow reset button and now and again that appears to work.  The graphic shows state returning to start, but then the luup restart happens.  The above happens even without the reset button.  All just timing I guess.

I'll try deleting and recreating the workflow to see if that changes anything.  But this is definitely a thing with the existing workflow.

Cheerz!!    --David
Try 1 or 2 min instead of 10 sec to see the impact.
The workflow must reach some waiting point at some time, esp in debug mode. If all transition are true and it has to transition state every time and it logs a lot in debug mode you could run into trouble.
You can also try the reset button, but the one on the settings page of altUI device which kills all persistency for a clean restart
Also we need the wflow description and the logs. Without more info, can't really help.
It is working really stable for me now but I do not have workflows like yours

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #67 on: April 09, 2016, 07:26:00 am »
This is amazing work!!  Thank you!!

Is there an export/import method for the code?  I saved the LUA code from a created workflow, then deleted the workflow.  I then tried to create a new workflow, and copy and paste the code back into the editor, but this didn't work.  Or at least the diagram didn't update. 

Any ideas?  SSH in and replace files somewhere perhaps?

seems to be often asked for, I need to work on it. but did you try this =>
backup/restore => http://forum.micasaverde.com/index.php/topic,36868.msg277220.html#msg277220

in v 1448

Offline xeinth

  • Full Member
  • ***
  • Posts: 144
  • Karma: +1/-1
Re: ALTUI: Workflows
« Reply #68 on: April 09, 2016, 10:16:49 am »
A few comments on capturing scenes below, but just FYI I had another no handler issue on 1.33, but wasnt able to capture when it happened.  I think it could be related to incomplete workflows which are invalid, I'll start disabling them until they are done and see if that helps.


here is an example where I use a Nodon Octan scene controller ( remote with 4 buttons ). on this device,  once it is set in scene activation mode ( zwave param 3 is set to 1 ), you get the value of the pressed button in the LastSceneID variable of the device. so I use ALTUI watch features to trigger a scene when that variable LastSceneID is changed.

Here is a workflow that does nothing until the first button ( value 10 ) is pressed.  when it is pressed , the workfows goes to another state where it stays there until any button , other than the first one ( so value != 10 ) is pressed. when so, it returns to the first state.
More over, I use a Bag variable to capture the last pressed button and display it

that gives this workflow ( attached sceens )

hope this helps

So the scenario I was considering was lights which are auto turned on at night when motion is detected or a door is opened.  In that case, I want to disable the automatic lights for some period of time if they are manually turned off on the scene controller, a lockout.  For this case, image button 10 in your example is 'scene off'.

The issue is that when entering this state in your example, if button 10 is already selected, it will proceed to the manual lock out.  In reality, we only want to do this if the user manually hits the button again after the lights are turned on.  Otherwise, this button press could have been weeks in advance, in theory.  The bag concept is interesting in that we could capture a timestamp entering the state, and then compare with a button press to determine if the new event was after entering the state.  This could also be handled by using multiple states, but that could be somewhat ugly to maintain.

I'll think on it more, but curious if you have thought about this case.  I'm still not caught up on all the other features you've added so I might be missing a elegant solution.

x

Offline ndoggac

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Re: ALTUI: Workflows
« Reply #69 on: April 10, 2016, 09:57:36 am »
Is there an export/import method for the code? 

in v 1448


That sir, is awesome.  Already rebuilt the diagrams and exported the resultant code.  Thanks!

Offline ndoggac

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Re: ALTUI: Workflows
« Reply #70 on: April 10, 2016, 10:15:46 am »
I wanted to share an example thermostat workflow I created.  This replaced the LUA table based scene control I was using previously, that I had found in this forum for Zwave thermostats.  The problem with the previous scene is that it had to run every 3-5 minutes to work properly, and it was the most problematic scene I had, requiring regular LUA reboots.  This workflow took me about 30 minutes to create.

A few details: 

The workflow does not support "Auto" mode on the thermostat, as I never use it.  The states (Off, Heat, and Cool) have manual transitions in both directions to each other.  All transitions between heat or cool and temperature states are time based, but they can be based on home mode, or other.  The return path from a temperature state back to heat or cool is a simple 5 second timer.  This is a first floor thermostat, I have a separate workflow for the second floor.  Changes to times, or additional temperature set points can be added very quickly and easily.

The workflow tool has a lot of possibilities.  Thanks to the creator for all the hard work on this!

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #71 on: April 10, 2016, 10:20:05 am »
I wanted to share an example thermostat workflow I created.  This replaced the LUA table based scene control I was using previously, that I had found in this forum for Zwave thermostats.  The problem with the previous scene is that it had to run every 3-5 minutes to work properly, and it was the most problematic scene I had, requiring regular LUA reboots.  This workflow took me about 30 minutes to create.

A few details: 

The workflow does not support "Auto" mode on the thermostat, as I never use it.  The states (Off, Heat, and Cool) have manual transitions in both directions to each other.  All transitions between heat or cool and temperature states are time based, but they can be based on home mode, or other.  The return path from a temperature state back to heat or cool is a simple 5 second timer.  This is a first floor thermostat, I have a separate workflow for the second floor.  Changes to times, or additional temperature set points can be added very quickly and easily.

The workflow tool has a lot of possibilities.  Thanks to the creator for all the hard work on this!

Good lord... is not that impressive ? thanks a lot for sharing

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #72 on: April 10, 2016, 10:23:22 am »
A few comments on capturing scenes below, but just FYI I had another no handler issue on 1.33, but wasnt able to capture when it happened.  I think it could be related to incomplete workflows which are invalid, I'll start disabling them until they are done and see if that helps.


here is an example where I use a Nodon Octan scene controller ( remote with 4 buttons ). on this device,  once it is set in scene activation mode ( zwave param 3 is set to 1 ), you get the value of the pressed button in the LastSceneID variable of the device. so I use ALTUI watch features to trigger a scene when that variable LastSceneID is changed.

Here is a workflow that does nothing until the first button ( value 10 ) is pressed.  when it is pressed , the workfows goes to another state where it stays there until any button , other than the first one ( so value != 10 ) is pressed. when so, it returns to the first state.
More over, I use a Bag variable to capture the last pressed button and display it

that gives this workflow ( attached sceens )

hope this helps

So the scenario I was considering was lights which are auto turned on at night when motion is detected or a door is opened.  In that case, I want to disable the automatic lights for some period of time if they are manually turned off on the scene controller, a lockout.  For this case, image button 10 in your example is 'scene off'.

The issue is that when entering this state in your example, if button 10 is already selected, it will proceed to the manual lock out.  In reality, we only want to do this if the user manually hits the button again after the lights are turned on.  Otherwise, this button press could have been weeks in advance, in theory.  The bag concept is interesting in that we could capture a timestamp entering the state, and then compare with a button press to determine if the new event was after entering the state.  This could also be handled by using multiple states, but that could be somewhat ugly to maintain.

I'll think on it more, but curious if you have thought about this case.  I'm still not caught up on all the other features you've added so I might be missing a elegant solution.

x

I did not really try this for real but could something like that solve this problem ?

Offline tomtcom

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1050
  • Karma: +27/-31
Re: ALTUI: Workflows
« Reply #73 on: April 10, 2016, 10:34:39 am »
My apologies folks, quick question. I have read amg0's description and searched this thread. Is workflows supposed to replace scenes? Is it supposed to be more flexible than Vera scenes?

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +209/-8
Re: ALTUI: Workflows
« Reply #74 on: April 10, 2016, 10:47:52 am »
My apologies folks, quick question. I have read amg0's description and searched this thread. Is workflows supposed to replace scenes? Is it supposed to be more flexible than Vera scenes?

you can replace some scenes with workflow.  I would  not recommend going extreme on this and replace all scene. but sometime it make sense. I see 2 examples where it could make sense to use workflow instead of scene

a) scheduled scene ( every x min ) have a problem for instance. if they run before luup finished initializing and running your startup.lua ( which is a bug in my opinion that mcv should fix ) then scene code crashs and you sporadically get the "Global lua error" message unti l you force a manual restart of luup.   for these, workflow are good so I had a scene which ran every 15mn to update data in thingspeak and I replaced this with a workflow because of that bug

b) workflow are superior to scene when what you want to do requires a "memory" of what happened before.  workflows are a logical state machine ( like petri network ) and because the current active state drives which transitions happen, it means you can have dynamic behaviors which depends on what happened the past...   example : a motion will trigger a lamp on and switch it off later,  but only if the lamp was not set manually on before.  another example : a alert/message can be sent after a garage door has been left open for more than 30mn and after 9:00pm.   

All this is feasible with scene and lua , BUT  remember that lua set timer () are not persistent to reboot/reload so you can get in trouble. I have persistent timers for workflows...

to some extend workflows are superior to scenes , just like PLEG is superior to scenes, and workflows sit in between VERA scenes and PLEG. they are more powerful than scenes,  probably less powerful than PLEG , but with a wysiwig editor and you can track it visually in almost real time.

now workflows are still a "young" techno so far so we may encounter some issues/limits... and most importantly they are not native to VERA UIx so the drawback is they can only work if you use ALTUI . that is the price of it...
« Last Edit: April 10, 2016, 01:32:21 pm by amg0 »