We have moved at community.getvera.com

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

Offline tedp

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +6/-2
Re: ALTUI: Workflows
« Reply #30 on: April 03, 2016, 02:22:50 pm »
I am trying to set up a workflow that sends VeraAlert notifications. It seems that I am forced to enter the "recepients" parameter as well as the "housemode" parameter (see attachment). My understanding with Vera Alerts is that if I leave "recepients" blank it should send the message to default recepients. Moreover, I think the Housemode parameter is something that has to do with UI7, and I am still on UI5.

So -- is the requirement to complete the fields self-imposed, or are they really necessary? If anyone has successfully integrated VeraAlerts with Workflows, perhaps they can post an example?

Thanks
-Ted

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #31 on: April 03, 2016, 03:10:20 pm »
I am trying to set up a workflow that sends VeraAlert notifications. It seems that I am forced to enter the "recepients" parameter as well as the "housemode" parameter (see attachment). My understanding with Vera Alerts is that if I leave "recepients" blank it should send the message to default recepients. Moreover, I think the Housemode parameter is something that has to do with UI7, and I am still on UI5.

So -- is the requirement to complete the fields self-imposed, or are they really necessary? If anyone has successfully integrated VeraAlerts with Workflows, perhaps they can post an example?

Thanks
-Ted
it was self imposed, here is a hotfix to try for now

Offline tedp

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +6/-2
Re: ALTUI: Workflows
« Reply #32 on: April 03, 2016, 03:42:53 pm »
Perfect -- successfully sent a message!

Thanks :)

Offline tedp

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +6/-2
Re: ALTUI: Workflows
« Reply #33 on: April 03, 2016, 03:57:23 pm »
Perfect -- successfully sent a message!

Thanks :)

well... maybe I spoke too soon. I'm not sure if it's related to the hotfix or not, but nothing happens when I "submit" transitions. It just does nothing. If I close the transition screen, it's not saved.

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #34 on: April 03, 2016, 05:00:03 pm »
Perfect -- successfully sent a message!

Thanks :)

well... maybe I spoke too soon. I'm not sure if it's related to the hotfix or not, but nothing happens when I "submit" transitions. It just does nothing. If I close the transition screen, it's not saved.
Make sure you close the transition screen with the save button
The to make it effective, on the workflow diagram, click the save button which should have been highlighted in red.

Just to be sure , then go back to the main page where all the workflows are shown and click save. You should get several green messages and it will force the Lua driver to reload workflows.
From that point on changes should be effective.
In doubt once all is setup, reload luup.

if it continues to behave funny , here is a full release of beta v 1400
« Last Edit: April 03, 2016, 05:03:24 pm by amg0 »

Offline tedp

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +6/-2
Re: ALTUI: Workflows
« Reply #35 on: April 03, 2016, 05:12:20 pm »

Make sure you close the transition screen with the save button
The to make it effective, on the workflow diagram, click the save button which should have been highlighted in red.

Just to be sure , then go back to the main page where all the workflows are shown and click save. You should get several green messages and it will force the Lua driver to reload workflows.
From that point on changes should be effective.
In doubt once all is setup, reload luup.

if it continues to behave funny , here is a full release of beta v 1400

The general workflow "save" worked as you said (got the "green"). I tried restarting luup, and just went for a full reboot as well. However, I still can't seem to get the "link" screen to take. The attached screengrab shows where I get stuck. For this test, I simply tried to change the name of the link to "xyz" and then submit -- nothing happens.

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #36 on: April 03, 2016, 05:18:53 pm »

Make sure you close the transition screen with the save button
The to make it effective, on the workflow diagram, click the save button which should have been highlighted in red.

Just to be sure , then go back to the main page where all the workflows are shown and click save. You should get several green messages and it will force the Lua driver to reload workflows.
From that point on changes should be effective.
In doubt once all is setup, reload luup.

if it continues to behave funny , here is a full release of beta v 1400

The general workflow "save" worked as you said (got the "green"). I tried restarting luup, and just went for a full reboot as well. However, I still can't seem to get the "link" screen to take. The attached screengrab shows where I get stuck. For this test, I simply tried to change the name of the link to "xyz" and then submit -- nothing happens.
did you try to fully load the v1400 I attached earlier ( maybe I changed something which required other files than just the one I sent you as hot fix ?

also, can you check javascript console log for any error ?

Offline tedp

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +6/-2
Re: ALTUI: Workflows
« Reply #37 on: April 03, 2016, 05:50:15 pm »
I missed the v1400 attachment, so I (think) I uploaded it (I still get v.1.30.1398 at the bottom). However, the behavior has not changed.

I opened up the console, and when I click on "submit" the following error pops up:
J_ALTUI_utils.js:2280 Uncaught TypeError: Cannot read property 'length' of undefined

the function in question is (just in case we're on different versions)

function _getLinkScheduleScene(workflow_altuiid, linkid) {
      var scheduled_scene = null
      var scenes = MultiBox.getScenesSync();
      $.each(scenes, function(i,scene) {
         J_ALTUI_utils.js:2280 Uncaught TypeError: Cannot read property 'length' of undefined
            var action = scene.groups[0].actions[0];
            if ( (action.device == g_MyDeviceID)
               && (action.service == "urn:upnp-org:serviceId:altui1")
               && (action.action == "TriggerTransition")
               && (action.arguments.length>0)
               && (action.arguments[0].value == workflow_altuiid)
               && (action.arguments[1].value == linkid) )
            {
                  scheduled_scene = scene;
                  return false;

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #38 on: April 03, 2016, 06:15:26 pm »
I missed the v1400 attachment, so I (think) I uploaded it (I still get v.1.30.1398 at the bottom). However, the behavior has not changed.

I opened up the console, and when I click on "submit" the following error pops up:
J_ALTUI_utils.js:2280 Uncaught TypeError: Cannot read property 'length' of undefined

the function in question is (just in case we're on different versions)

function _getLinkScheduleScene(workflow_altuiid, linkid) {
      var scheduled_scene = null
      var scenes = MultiBox.getScenesSync();
      $.each(scenes, function(i,scene) {
         J_ALTUI_utils.js:2280 Uncaught TypeError: Cannot read property 'length' of undefined
            var action = scene.groups[0].actions[0];
            if ( (action.device == g_MyDeviceID)
               && (action.service == "urn:upnp-org:serviceId:altui1")
               && (action.action == "TriggerTransition")
               && (action.arguments.length>0)
               && (action.arguments[0].value == workflow_altuiid)
               && (action.arguments[1].value == linkid) )
            {
                  scheduled_scene = scene;
                  return false;
I see ... Side effect of making arguments optional I suppose. You can try to modify the test to accept action.argument ==undefined OR ...
I ll update tomorrow otherwise.



Offline tedp

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +6/-2
Re: ALTUI: Workflows
« Reply #39 on: April 03, 2016, 07:11:20 pm »
I took a shot, but couldn't get it to work. I'll await your next update. Thanks!!!

FYI: this was my interpretation of what you were proposing:
   function _getLinkScheduleScene(workflow_altuiid, linkid) {
      var scheduled_scene = null
      var scenes = MultiBox.getScenesSync();
      $.each(scenes, function(i,scene) {
         if ( (scene.groups.length>0) && (scene.groups[0].actions.length>0) ) {
            var action = scene.groups[0].actions[0];
            if ( (action.device == g_MyDeviceID)
               && (action.service == "urn:upnp-org:serviceId:altui1")
               && (action.action == "TriggerTransition")
               && (action.arguments == undefined || (action.arguments.length>0))
               && (action.arguments[0].value == workflow_altuiid)
               && (action.arguments[1].value == linkid) )
            {

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #40 on: April 04, 2016, 02:01:58 am »
I took a shot, but couldn't get it to work. I'll await your next update. Thanks!!!

FYI: this was my interpretation of what you were proposing:
   function _getLinkScheduleScene(workflow_altuiid, linkid) {
      var scheduled_scene = null
      var scenes = MultiBox.getScenesSync();
      $.each(scenes, function(i,scene) {
         if ( (scene.groups.length>0) && (scene.groups[0].actions.length>0) ) {
            var action = scene.groups[0].actions[0];
            if ( (action.device == g_MyDeviceID)
               && (action.service == "urn:upnp-org:serviceId:altui1")
               && (action.action == "TriggerTransition")
               && (action.arguments == undefined || (action.arguments.length>0))
               && (action.arguments[0].value == workflow_altuiid)
               && (action.arguments[1].value == linkid) )
            {

I am having second thoughts about this, you can revert to previous code, and go it your scene , find one called workflow 0-1 or something like that. Delete it.
Then back into your workflow edit the link with the schedule and save it again. It should recreate the scene.

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #41 on: April 04, 2016, 03:37:42 am »
I took a shot, but couldn't get it to work. I'll await your next update. Thanks!!!

FYI: this was my interpretation of what you were proposing:
   function _getLinkScheduleScene(workflow_altuiid, linkid) {
      var scheduled_scene = null
      var scenes = MultiBox.getScenesSync();
      $.each(scenes, function(i,scene) {
         if ( (scene.groups.length>0) && (scene.groups[0].actions.length>0) ) {
            var action = scene.groups[0].actions[0];
            if ( (action.device == g_MyDeviceID)
               && (action.service == "urn:upnp-org:serviceId:altui1")
               && (action.action == "TriggerTransition")
               && (action.arguments == undefined || (action.arguments.length>0))
               && (action.arguments[0].value == workflow_altuiid)
               && (action.arguments[1].value == linkid) )
            {

I am having second thoughts about this, you can revert to previous code, and go it your scene , find one called workflow 0-1 or something like that. Delete it.
Then back into your workflow edit the link with the schedule and save it again. It should recreate the scene.

you can also try this beta 1401

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #42 on: April 04, 2016, 12:00:02 pm »

you can also try this beta 1401
I released 1406 so you can try this one

Offline tedp

  • Sr. Member
  • ****
  • Posts: 288
  • Karma: +6/-2
Re: ALTUI: Workflows
« Reply #43 on: April 04, 2016, 01:34:33 pm »
"Bob's your uncle!!!"

I was able to prototype my workflow to send me a notification every X minutes if I leave my garage door open! I did it with 3 states.

A few followups:
* Does the "on exit" execute when all of the transitions conditions are true? If so I can see doing what I'd like with only two states, but I cannot seem to have a transition to go from a state back to itself. The idea would be to have a "wait state" with a link back to itself when a timer expires at which point the "exit state" would send a notification and the link would go back to the same state awaiting the timer to expire again. Is this consistent with your architecture?

* An idea: would it be possible to abstract a workflow into a subroutine like structure? I'd love to implement the same notifications for when other sensors are left open for too long (i.e. front door, etc.) I can copy/paste the workflow I suppose, but it would be sexier if I could just "call" my generic workflow with the device ID (and other parameters) as variables into the function.

* I had a crash of AltUI at some point when experimenting. After reloading LUA from UI5, altUI came back, but my workflows that were previously saved were gone. No big deal now, as I'm just experimenting. I think I saw something in a previous thread about the ability to backup the workflows.

Looks great!
-Ted

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3174
  • Karma: +210/-8
Re: ALTUI: Workflows
« Reply #44 on: April 04, 2016, 03:02:42 pm »
"Bob's your uncle!!!"

I was able to prototype my workflow to send me a notification every X minutes if I leave my garage door open! I did it with 3 states.

A few followups:
* Does the "on exit" execute when all of the transitions conditions are true? If so I can see doing what I'd like with only two states, but I cannot seem to have a transition to go from a state back to itself. The idea would be to have a "wait state" with a link back to itself when a timer expires at which point the "exit state" would send a notification and the link would go back to the same state awaiting the timer to expire again. Is this consistent with your architecture?

* An idea: would it be possible to abstract a workflow into a subroutine like structure? I'd love to implement the same notifications for when other sensors are left open for too long (i.e. front door, etc.) I can copy/paste the workflow I suppose, but it would be sexier if I could just "call" my generic workflow with the device ID (and other parameters) as variables into the function.

* I had a crash of AltUI at some point when experimenting. After reloading LUA from UI5, altUI came back, but my workflows that were previously saved were gone. No big deal now, as I'm just experimenting. I think I saw something in a previous thread about the ability to backup the workflows.

Looks great!
-Ted

1/OnEnter executed when the state is entered
OnExit is executed when the state is exsited, that is , when at least one of of the transaction leaving that state is evaluated as true. when that happens, OnExit of the source state is called, then the active state moves to the new state , then the OnEnter of the new state is called

2/ interesting idea but would be quite a change. it would mean an active state of a workflow could be a state of another workflow. that would require complex changes internally

3/ that is possible, especially if the box is getting full , and especially if you run in DEBUG mode.  another thing I have seen happen is when Luup reloads, if any scene are executed too soon before the lua startup is finished, it will crash VERA and it will restart luup again. ( with a GLOBAL failure message ). that is a strange bug that I do not understand why MCV is not fixing.  note that using workflow and scheduled transtion, you protect yourself from that bug as no trigger happens before ALTUI driver is ready. that is a good side effect of using workflows