Lua scripts as action in scenes

Who can translate this in to something that is understandable?

We all know somewhat how to use and create lua scripts on the Vera platform, there are many script snippets and examples on the forum that we can understand and expand upon.

But he might as well be talking Dutch here. I know I’m not the sharpest tool in the toolbox, but what was just stated?

How do I turn on a particular device via a script?

How do you turn it off?

How do I dim / brighten a device to a percentage?

How do I run a scene via a script?

I’m going to post on here some of my existing Vera lua scripts from my scenes.

And I’d like to see translated examples on the Ezlo platform.

Is it just me? Or have they made these new Ezlo APIs and scripts far too complex?

Vera Luup Requests and in turn its related lua scripts was simple and easy to understand for simple people like me LOL.

Translate this simple script to blink a light to an Ezlo script.

device = 291 -- Blink Globe Lamp
count = 4 -- number of times to blink
rate = 2 -- number of seconds between blinks

function blink_on()
    luup.call_action( "urn:upnp-org:serviceId:SwitchPower1", "SetTarget", { newTargetValue="1" }, device )
    luup.call_delay( 'blink_off', rate )
function blink_off()
    luup.call_action( "urn:upnp-org:serviceId:SwitchPower1", "SetTarget", { newTargetValue="0" }, device )
    count = count - 1
    if count > 0 then
        luup.call_delay( 'blink_on', rate )

-- Start blinking

Or how about this even more simple script that toggles a lamp?

local device=379
local switchOnOff = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", device)
    if (switchOnOff == "1") then
      -- Switch is on
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = "0"}, device)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = "100"}, device)


I’m quite sure your developers are extremely talented and know what they are doing.

However your users who will be buying and using this system are struggling to follow.

But I’ve said and thought this and battled with them for some time now to add back in some simplicity.

I had to shout and protest to get them to add the “feature” "to turn off complex token authentication against the local http server API.

It’s on my LAN!

If my router is compromised I have bigger things to worry about than the local API access to my Ezlo hub.

Vera Luup Request was functional and powerful and could be integrated with virtually anything because it was simple.

Every and all previous 3rd party integration done with Vera out there on the Internet to date are going to die on the new Ezlo platform.

From rich folks who used Vera hubs as Z-Wave gateways with their fancy and expensive Control4 systems to open source systems like Home Assistant that also used Vera hubs for the very same purpose.

To the many 3rd party dashboard control apps and the many other types of integrations which I can’t even think about or remember right now.

The Ezlo APIs are overly complex and the Lua scripting I don’t know where to even start with it.

I know things have to change and for reasons I might not understand.

But I had to sit down and try to translate for many days and work out for myself pretty much and I am no coder or developer…
How to use the new “user” facing http server API in my idiots guide I wrote and I still don’t know how to do simple variable value get requests dispite asking more than numerous occasions on the forum.

It’s all well and good them writing high level documentation but the pdf attached here means nothing to me, it shows me nothing for real world lua script usage.

I urge all Vera users to provide sample lua scripts from their existing Vera scenes and we’d like to see working examples of Ezlo equivalent Lua scripts in simple step by step terms.


Never mind GET I don’t even know how to SET a devices particular variable via http code.

I can’t even see the devices variables in the Vera mobile app as we have no UI7 Web GUI replacement that use to display them.

Luup Requests worked and was simple.

Seems you are just adding barriers to entry and complexity for what advantage?

Let’s ask a simple question?

I have a virtual motion sensor device on the Ezlo hub.

I read one of CW’s guides on the forum to work out how to create such a virtual device.


How do I set that virtual motion sensor to tripped via a simple one line http command from a 3rd party application such as Blue Iris?

1 Like

OK I do really know how to set variables on the Ezlo API, but how many others do know how to do that? From official documentation?

GET variables however is still a mystery…

I’ve only seen Rene do it once before a 3rd party dev.

Still my point stands its far too complex and breaks all previous 3rd party integrations with the existing platform.

And Ezlo maybe a new island but its losing traction by killing all previous 3rd party integrations with Vera from all other HA systems and apps out there that currently integrate with Vera.

Wanting Blue Iris to control a virtual motion sensor on an Ezlo hub is a very simple integration from a 3rd party application.

But not so simple by the fact of these new complex APIs. And not so simple to even create that virtual sensor in the first place.

How will Ezlo integrate with Harmony hubs as far as the very limited official Logitech “Home Control” aspect of the Harmony remotes is concerned?

Vera had no direct supported previously.

But guess what?

A 3rd party Java HA Bridge software did support Vera via its simple http luup requests.

Said Java HA Bridge acts as an emulated Hue Bridge which Logitech Harmony “Home Control” does support and can see.

So you linked your Harmony software to to HA Bridge / emulated Hue Bridge and now all your Vera devices and scenes you added on to the Java HA Bridge are exposed to the Harmony remote.

What is Harmony “Home Control”?

It’s the little buttons on their remotes that can be assigned to control smart home devices. And also on the Harmony Elite LCD screen there is access and control to all these devices.

This integration with Harmony is now not possible with an Ezlo hub.

And official Logitech Harmony “Home Control” is only the tip of a very big iceberg.

When compared to full and proper integration with Vera via the current 3rd party plugin for Harmony by Rene.

It’s features are extremely powerful and even expose a full http server Api via Vera to communicate with IR devices on the Harmony hub.

This allowing even more none related 3rd party apps to be able to send simple http requests to Vera to then relay those commands on to the Harmony hub to control those IR devices either at just the Harmony Activity level on / off etc or even down to per IR device per button command level.

Let’s set my IR only AVRs audio mode for example from Yatse at 3rd party control app for Kodi all relayed through and via Vera.

The levels of 3rd party integrations you are breaking I’m not sure you even understood they existed…

Reactor Multi System logic engine is well timed.

Im going to be moving all my complex PLEG rules off the Vera box and on to the Raspberry Pi running Multi System Reactor.

Least then I’ll maybe have some options in the near future to move to other systems like Home Assistant with a Z-Wave USB stick or Hubitat…


I totally agree. The userfriendliness is below zero and the learning curve seems very steep :frowning_face:

Dev story is still too early to really follow it. You can’t compare 10+ years with less than 1 week of scene scripting.

I still think an editor with auto completion could make a huge difference.
Something based on VS Code could be a huge improvement. Some link:

I agree that luup engine APIs are not bad at all and maybe a compatibility layer built on the new APIs could have been better than starting from scratch, but it is what it is now, and you have to adapt (or leave for a complete different platform, in fact).


Come on guys, a lot of complaining and no reading of Oleh’s post. I have limited coding skills, however reading the code example I read the following 2 lines of code to turn on a device from a Lua script:

require "core"
core.set_item_value(, true )

Same, but now turning of the device:

require "core"
core.set_item_value(, false ) would be the device id.

This code looks a lot more elegant and readable than the Luup.call_action alternative!

Ok it can be done albeit it is cumbersome. The code to toggle a switch is:

require "core" 
local itemId = "5f6210c4124c4110f359e042"
local item =core.get_item(itemId)
core.set_item_value(itemId, not( item.value))

So first step is to use the API tool to get the device id and then the item id for the item with name switch.
Now create the scene and add a Lua script for the action. Carefully type over the item id value.

If you need to edit the script. It is hidden under Settings, Lua Scripts. You cannot edit the script in the scene editor.

This especially makes me want a web GUI again. It is a pain to do anything but trivial on a tablet, and I will not even go here on a phone.

Have fun .

Cheers Rene


In my Vera Lite I could run lua right in the scene action. Now I don’t even see a way forward with this.

This isn’t working for me.

@reneboer example of a Toggle does work however.

I just found some more examples here and this one does work to turn on a “Switch”

require "core"
local items = core.get_items()
if items then
    for _, item in ipairs(items) do
        if == "switch" and item.device_id == "<Device-ID-Here>" then
            core.set_item_value(, true)

You have to use the device ID not the item ID of the switch component of that device.

There is one in your examples that use the device name instead of the device ID. I use it in a sceen to turn on my garage light when motion is detected by a Zooz motin sensor.

Does anybody can help me to write a script where you will get a current level from a dimmer in to a variable and than pass it to a http request?

Hello @JSNB,
You can use the code below to get the current level of a dimmer:

require "core"
local current_level = core.get_item("item_id").value

You will need to use the API to find the ID of the item with the name “dimmer”. This item is responsible for the intensity of the dimmer.
Kind regards!


Is there an equivalent command using the HTTP server API? To retrieve a devices items value?

E.g. To send a http command to the Ezlo Controller to return the desired devices current value. Say for a temperature sensor.


Hello @cw-kid,
As far as I know, there is no command or API call that is equivalent to the core.get_item() function. However, it is possible to get the value of an item with HTTP requests by filtering the response. You can use the function grep for example but I recommend using jq to parse the response and get the desired value. It would be something like this:

curl --http1.1 "http://IP:17000/v1/method/hub.items.list" | jq '.result.items | .[] | select(._id=="ITEM_ID") | .value'

You would only need to replace the values IP and ITEM_ID. By the way, I used unsecured and unauthenticated access just to make the access easier. I hope that helps.
Kind regards!

1 Like

I know nothing about Lua or scripts. I did just upgrade to a Ezlo secure. on my vera edge, I was able to use a plugin (timer) to turn off a Device after a set amount of time, can I do that with ezlo? if so how? I also had a plugin called day or night which I could set outdoor light by. canU dither of these?
please help
thank you

A related thread here about running an Ezlo scene only when it’s “night”.

Unless Ezlo have improved this functionality? It does not work and seems to me they made a complete mess of it and it’s not easily possible.

None of the old Vera plugins can be used on the new Ezlo hub.

I think you will need to create a virtual switch and have a scene(s) to change it to on / off depending on if its after sunrise or after sunset and then use that virtual switch and its current state in your other scenes logic.

I will test this later what they previously said and show that the Ezlo staff were talking nonesense in that other thread I linked to.

And they think they can create a Reactor alternative? When they can’t even do a simple scene with a condition of “night”.

They don’t even have conditions or they don’t call them that at least, they say its a “Group of Events”.

An event as far as I can see it, in their Vera app is a trigger as it’s under the “Activation” heading.

It not a condition?

The whole Vera app work flow is a mess for scene logic.

Thank you, This will work for one of my needs. the other need is still a count down timer. that will shut a light off 5 minus after it turns on. 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