New to openLuup, issues with scenes
-
I got tired on waiting for a stable release of Vera FW so finally took the leap to installing openLuup.
Unfortunately I haven't even got a simple scene to work.
Trigger - If device 1 is turned on
Action - Delay 2 seconds and turn device 2 on.I see the call to turn device 1 on in log but nothing else related after that.
What am I doing wrong? -
Welcome to the openLuup club!
Sorry you're having teething trouble.
It would be helpful to see the scene setup, but my guess is that you've set up a standard Vera/UPnP-type scene, rather than an AltUI Device Variable Watch.
If that makes no sense at all to you, then ask again right away!
Always happy to help.
AK
-
If I watch SwitchPower1:Status on device 1 I want to run the scene when Status changes to 1. What do I put in Lua Expression?
On the other hand isn't a Vera/UPnP-type scene suppose to work as well?@crille said in New to openLuup, issues with scenes:
If I watch SwitchPower1:Status on device 1 I want to run the scene when Status changes to 1. What do I put in Lua Expression?
On the other hand isn't a Vera/UPnP-type scene suppose to work as well?I think I asked this when I first started too and it may not be intuitive.
The lua expression is actually fairly simple. You can think of it as a conditional for the trigger to occur.By default you should use:
new ~= old
Which would trigger the scene whenever the value changes.
Then for your use case:new == "1"
Will trigger only if the new value is 1. (for example when a sensor trips)
You can also put a conditional on what the old value was.
old == "0"
You can also go much more complex with and/or logic.
old == "0" and new == "3" or old > 4
etc... it is pretty powerful with multilevel sensors, parsing string values etc... I am having openLuup for example parse a text value and trigger a scene on which face my doorbell recognized as it comes up as a name...
-
@crille said in New to openLuup, issues with scenes:
If I watch SwitchPower1:Status on device 1 I want to run the scene when Status changes to 1. What do I put in Lua Expression?
On the other hand isn't a Vera/UPnP-type scene suppose to work as well?I think I asked this when I first started too and it may not be intuitive.
The lua expression is actually fairly simple. You can think of it as a conditional for the trigger to occur.By default you should use:
new ~= old
Which would trigger the scene whenever the value changes.
Then for your use case:new == "1"
Will trigger only if the new value is 1. (for example when a sensor trips)
You can also put a conditional on what the old value was.
old == "0"
You can also go much more complex with and/or logic.
old == "0" and new == "3" or old > 4
etc... it is pretty powerful with multilevel sensors, parsing string values etc... I am having openLuup for example parse a text value and trigger a scene on which face my doorbell recognized as it comes up as a name...
-
@rafale77 Yes, thanks!
I went withnew > old
for SwitchPower1 that should be the same as
new == "1"
Good info about AND, OR. I did not realise, at first, you could use that too.
@crille said in New to openLuup, issues with scenes:
@rafale77 Yes, thanks!
I went withnew > old
You might want to test that to make sure it works as I get a bit paranoid with lua getting you these variables as strings instead of integer but it could be that openLuup handles these cases. Otherwise I would do
tonumber(new) > tonumber(old)
just to be sure.
-
Ok, I figured out the Lua Expressions. I don't understand why a standard scene wouldn't work though but perhaps thats an AltUi issue.
@crille said in New to openLuup, issues with scenes:
I don't understand why a standard scene wouldn't work though but perhaps thats an AltUi issue.
No, not that. It's a design choice for openLuup, as described in the User Guide (v2020.05.12, p.18):
More about Scenes
Scene timers and actions can be defined with the AltUI interface in exactly the same way as on Vera. Triggers, however, are treated differently, because %(#941100)[the Vera approach, itself based on UPnP definitions in various files, is deeply flawed and inflexible]. Instead, the AltUI-supported mechanism of device variable triggers are used.
Using the appropriate button under the scene / trigger definition menu, you may select any device and variable as a trigger. The trigger will fire whenever the variable changes value, and using a small amount of Lua code, or the blocky graphical interface, you can construct arbitrary logic expressions combining, times, old and new variable values, other device variables, in fact almost anything you want, to determine whether or not the scene should actually execute.Still, you seem to be getting the hang of it now, thanks to forum help!
-
@crille said in New to openLuup, issues with scenes:
@rafale77 Yes, thanks!
I went withnew > old
You might want to test that to make sure it works as I get a bit paranoid with lua getting you these variables as strings instead of integer but it could be that openLuup handles these cases. Otherwise I would do
tonumber(new) > tonumber(old)
just to be sure.
@rafale77 It works unlike Vera where I do tonumber() on every number for the same reason as you
I changed it tonew == "1"
as that is "more" correct.
I guess you can't do AND for a different serviceId in the same expression?
Example "SwitchPower1:Status == "1" AND Dimming1 ~= "55"
If not I'll try SwitchPower1 AND Dimming1 as triggers. -
@crille said in New to openLuup, issues with scenes:
I don't understand why a standard scene wouldn't work though but perhaps thats an AltUi issue.
No, not that. It's a design choice for openLuup, as described in the User Guide (v2020.05.12, p.18):
More about Scenes
Scene timers and actions can be defined with the AltUI interface in exactly the same way as on Vera. Triggers, however, are treated differently, because %(#941100)[the Vera approach, itself based on UPnP definitions in various files, is deeply flawed and inflexible]. Instead, the AltUI-supported mechanism of device variable triggers are used.
Using the appropriate button under the scene / trigger definition menu, you may select any device and variable as a trigger. The trigger will fire whenever the variable changes value, and using a small amount of Lua code, or the blocky graphical interface, you can construct arbitrary logic expressions combining, times, old and new variable values, other device variables, in fact almost anything you want, to determine whether or not the scene should actually execute.Still, you seem to be getting the hang of it now, thanks to forum help!
-
@rafale77 It works unlike Vera where I do tonumber() on every number for the same reason as you
I changed it tonew == "1"
as that is "more" correct.
I guess you can't do AND for a different serviceId in the same expression?
Example "SwitchPower1:Status == "1" AND Dimming1 ~= "55"
If not I'll try SwitchPower1 AND Dimming1 as triggers.No not really. Remember that this is a variable watch so you are working on the variable being watched with the values being stored in the "new" and "old" variables.
You can however trigger the scene with multiple variable watches and then put a conditional inside the lua code as you would do on the vera. Or just trigger with one variable and check the second variable as a conditional with the lua code... this part again is no different from the vera.Note that the scene trigger mechanism is probably the major difference with the vera in terms of setup. Once you are passed that everything else should be pretty transparent.
-
No not really. Remember that this is a variable watch so you are working on the variable being watched with the values being stored in the "new" and "old" variables.
You can however trigger the scene with multiple variable watches and then put a conditional inside the lua code as you would do on the vera. Or just trigger with one variable and check the second variable as a conditional with the lua code... this part again is no different from the vera.Note that the scene trigger mechanism is probably the major difference with the vera in terms of setup. Once you are passed that everything else should be pretty transparent.
@rafale77 said in New to openLuup, issues with scenes:
Note that the scene trigger mechanism is probably the major difference with the vera in terms of setup
Indeed!
There is additionally, in fact, an in-built trigger mechanism that is a sort of a blend of the two, in that the trigger happens when a variable changes, but, unlike AltUI and just like Vera, each trigger can have its own Lua code and the scenes have full Lua code capability too (not just a logical variable.). The best of both worlds, IMHO.
However, I haven't developed the console interface for it, since I really think that scenes are becoming a rather out-moded concept, in favour of the amazing work the @toggledbits is doing with Reactor / MSR.