You can now use Lua code in Ezlo scenes - How to Examples

what kind of Lua code are you putting in your scenes?
would love to hear your ideas and how you are using this capability in your scenes please.

I would like examples of the equivalent to luup.variable_watch and not having it run in a scene, more like the Startup Lua on Vera.
My use case is watching humidity sensors in bathrooms/showers, comparing to other sensors in the house and control ventilation fans according.

1 Like

hi
would you expand on this please. What does it do exactly I personally haven’t used that function on vera.
Is it a “Trigger” or “Action”?

It’s a function. Whenever a variable for specified device changes it calls another function, in my case my function that compare the sensors and regulate fan speed if needed.

2 Likes

http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_watch

Yep, was just reading that…its a callback function if certain criteria is met…checking with the guys…

1 Like

Hi @Crille,

This type of functionality would more need a plugin than code in a scene. A plugin you can subscribe to events and you can set a filer for the device you are interested in. Then change a setting in another zwave device may not yet be supported in Lua as each plugin runs in its own space (called gateway) and you cannot control a device of another gateway. We have asked to allow it, but I have not yet heard it can be done. How to create your first plugin with Ezlo LUA API - Ezlo Library - Ezlo Community

Cheers Rene

1 Like

I suspected the subscribe to events function but writing a plugin seems a bit overkill for this purpose and overwhelming for me.
I know it’s not suitable for a scene and maybe the only way to mimic Startup Lua is a plugin.
If I find the time, perhaps I should start digging in that direction to be prepared when we can interact between gateways, thanks for the link!

Hello @reneboer,
all provided examples change items of any gateway and you can use it in your plugins.
Ezlo Firmware provides:
core.update_item_value() - it can update items of your plugin only. It updates value in firmware database.

core.set_item_value() - it can update any item of any gateway. This call redirects to the plugin which is responsible for the target item.

Hello @Crille,
It depends how you want to see it and control. It’s possible to do via Lua in scenes if control part is enough. If you also want to see some states then better to do it via own plugin as @reneboer advised.
Could you describe expected flow for your case?

Hi @andryist,

Aha, i was trying to understand what the API documentation about the set_item_value. On it self it does not state it can work on any item of any gateway. I guess it is implied by the section “Methods for using in external gateways” i now know what that heading means. And i think that I understand what you mean with internal and external gateways. Is external also on a different hub, or is it only the gateways(plugins) on one hub?

Cheers Rene

Only on the same controller now.

@andryist thank you for the information!
I don’t really need to see any states as the fans automatically acts on input from humidity, house modes and scene controllers for timed manual extraction.
So some Lua in a scene would do, but I will wait for a proper GUI before moving this logic from my Vera to my Ezlo controller, since coding this in an app on my phone is a bit troublesome.

1 Like

is there someone who could write a script to turn off a device/light after a set duration? I would be happy to pay for someones time. I know NOTHING about this stuff.

in our webui you can do that

In the “Action”
you can select the device you want “off” and add a “Delay” to the action.

or in your SmartPhone you can do the same:

I have tried the delay. Here is what I have setup.

Action Event: Whenever switch state is changed :on (device 123)
Action: Off( device 123) Delay 1 Min

It dose not seem to do anything, I never got it to work for my vera Edge also. I ended up with a plugin, which worked perfect.

Hello
Thank you for your feedback. We found an issue on our Web UI, and now we are fixing it. The issue will be fixed in 1 hr.

Thanks again for your feedback.
We updated the WebUI with new functionality and also fixed the problem with the offset for the Action section.

1 Like

So it still does not work

Could you try to create a new scene and let us know if it works? The “old” scene that you’d created before we applied the fix, won’t work.

Hi Everybody

Does the following sample, that I used with VERA, run on Ezlo ? Change device paremeters from a scene with LUA

luup.variable_set(“urn:micasaverde-com:serviceId:ZWaveDevice1”,“VariablesSet”,“50,1d,137,51,1d,132,52,1d,100,53,1d,95”,5680)

No it will not work. None of your existing Vera Lua code will work on an Ezlo hub.

Seems they have changed lots of things, even the coding format is totally different in Ezlo hubs it seems.

I don’t know how to convert my existing Vera lua code to a working Ezlo equivalent.