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

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.

That isn´t what MCakan says

Feb '21

Hello everyone,

As you know you can add lua codes in scenes as actions. [Here you can see how if you have not tried that yet ] (Ezlo controllers - Use LUA Script as an action in a scene - YouTube)

“That isn´t what MCakan says”

Your question was “Does the following sample, that I used with VERA, run on Ezlo?”

My anwser to that question is no it won’t work.

What MCakan says is not related to your question.

However, you can use the Vera mobile app connected to an Ezlo controller, to create and add a lua script to a scene, as shown in the YouTube video you linked to.

Currently on the EZLOgic Web GUI there is no support for lua codes however and you won’t be able to even edit or delete any scenes that reference a lua script, via the Web GUI.

And you need to use Ezlo LUA code which is different to Vera Lua code.

You can’t just copy and paste your existing Lua codes from your Vera scenes as they won’t work.

although @cw-kid is right, but something he doesn’t know is that we are launching this coming week an “Expression” feature where you can create any Lua code in MeshBots

1 Like

Hi
My question was if there is a LUA command to change a device paremeter. If it´s different that the one wich goes with Vera is not the problem. Because of it a wrote this command example:

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

. If it´s possible, could you tell me how do I have to write it for EZLO ?

I don’t know if there is an equivalent LUA command within Ezlo LUA code for directly setting a variable setting on a Z-Wave device.

@oleh @MCakan is there?

Also a similar unanswered question here about send data.

1 Like

Perhaps you can find the answer here - Lua - Ezlo API Documentation There is a section specific to z-wave devices.

1 Like

I haven’t seen anything in the docs that looks like it gives you the ability to set configuration parameters on a device. Maybe I’m missing it, but I’ve looked through everything ZWave-related I can find there. If it’s missing, that creates a big hole in functionality for many devices, because you need to be able to set configuration parameters on the fly to operate them (e.g. Zooz siren ZSE19 to tell it to play one of its preconfigured sounds).

The other apparent omission from the ZWave API, previously reported, is the ability to send any arbitrary byte string to a node (i.e. the old SendData action on Vera), which if present could be used as a workaround for the above (as one does on Vera), and also is just a necessary feature for managing some ZWave devices.

@rigpapa, admittedly, I shared the doc without reading it :wink: set_configuration_value() sets a z-wave configuration parameter. Is that one of the APIs you are talking about?

https://api.ezlo.com/scripting/zwave/functionality/index.html#set_configuration_value
https://api.ezlo.com/scripting/zwave/functionality/index.html#add_configuration

Looks like sending an arbitrary byte string to a node maybe missing…

1 Like

Well, I can confirm that set_configuration_value works fine from lua. I was still struggling with a iBlinds shutter where I had to set a parameter manually, but this parameter was not exposed in the Ezlo UI. Through a little Lua script and set_configuration_value() I was able to correct the parameter. Finally!

1 Like

Yes, thank you! The Z-Wave stuff is spread across so many areas of those docs, I didn’t even see that spot.

Edit… no, wait… not helpful. I need an API via HTTP or WebSocket. That’s what I’m looking for.

To specifically answer @melih’s question about LUA in scenes, I think of:

  • Custom IP integrations.

I have a LUA start-up function to control my QMotion roller shades. Qmotion Blinds - #36 by wilme2 Then I reference that function in scenes. This code was for 2rd generation QMotion requiring a QConnect and an IP2SL, but I also have a 3rd generation blind with a direct IP call to a QSync.

Move a Foscam PTZ camera based on an Event. Adjust Foscam FI9826P camera position when one of the doors is opened - #2 by ceefin

  • Access functions of devices that are not available via official integration or plug-in.

Re-sync all devices on a DSC alarm panel connected to Vera via Envisalink and the DSC plug-in. DSC Plugin Getting out of Sync with Alarm System state - #9 by wilme2

  • Control anything IR/RS232 via a Global Cache IP2IR/IS2SL

Turn on my kitchen TV:

SendiTachCommand("192.168.0.125,4998,sendir,1:1,1,38000,1,1,172,172,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,64,22,64,22,21,22,21,22,64,22,21,22,64,22,64,22,21,22,21,22,64,22,64,22,21,22,1820,\r") -- Turn On Samsung TV in Kitchen

Via Startup LUA:

function SendiTachCommand(ParamString)

	local IPAddress,Port, CommandtoSend = string.match(ParamString,"(%d+.%d+.%d+.%d+),(%d+),(.+)")
	print (IPAddress)
	print (Port)
	print (CommandtoSend)

	local socket = require("socket")
	c = assert(socket.connect(IPAddress, Port))
	c:settimeout(5)

	local sres, serr = c:send(CommandtoSend)
	print("Send:", sres, serr)
	local data, rerr = c:receive(5)
	print ("Receive:", data, rerr)

 	c:close()

end

Hi, Do you know if the “set_configuration_value” LUA code can be used from EZLO ATHOM or is it required EZLO PLUS controller?

@osman Gave me this example Ezlo LUA Code to randomly change the colours on an RGB light.

require "core"
local Child_Rgb_lamp_id = "62026a0b123e431861dde870"
local randomNum = math.random(1,7)
local redJson = {red=255,green=0,blue=0}
local greenJson = {red=0,green=255,blue=0}
local blueJson = {red=0,green=0,blue=255}
local yellowJson = {red=255,green=255,blue=0}
local purpleJson = {red=128,green=0,blue=128}
local pinkJson = {red=255,green=20,blue=147}
local orangeJson = {red=255,green=14,blue=0}

if (randomNum == 1) then
     core.set_item_value(Child_Rgb_lamp_id ,redJson)
end

if (randomNum == 2) then
     core.set_item_value(Child_Rgb_lamp_id ,greenJson)
end

if (randomNum == 3) then
     core.set_item_value(Child_Rgb_lamp_id ,blueJson)
end

if (randomNum == 4) then
     core.set_item_value(Child_Rgb_lamp_id ,yellowJson)
end

if (randomNum == 5) then
     core.set_item_value(Child_Rgb_lamp_id ,purpleJson)
end

if (randomNum == 6) then
     core.set_item_value(Child_Rgb_lamp_id ,pinkJson)
end

if (randomNum == 7) then
     core.set_item_value(Child_Rgb_lamp_id ,orangeJson)
end

The Child_Rgb_lamp_id is the rgbcolor item ID of the light device

image

Only issue is that sometimes the same random number can be selected twice in a row, so you may have the same colour twice or possibly more in a row.

The code ideally needs adapting, so the same random number cannot be generated twice in a row.