New Ezlo Plus user initial thoughts

Its from that other thread I linked too earlier I see.

Turn on one light by the name :
For this to work you just need to change NAME_OF_DEVICE to the the unique name of the device you want to turn on.

require "core"
local items = core.get_items()
if items then
    for _, item in ipairs(items) do
        if item.name == "switch" then
            local device = core.get_device(item.device_id)
            if device and device.name == "NAME_OF_DEVICE" then
                core.set_item_value(item.id, true)
            end
        end
    end
end

So lets assume we have in the app one lamp with the name Bedroom Lamp. So the lua code will be as shown below if we want to turn it on with this code.

require "core"
local items = core.get_items()
if items then
    for _, item in ipairs(items) do
        if item.name == "switch" then
            local device = core.get_device(item.device_id)
            if device and device.name == "Bedroom Lamp" then
                core.set_item_value(item.id, true)
            end
        end
    end
end

Il’l have to try it myself later and see.

Seems to work OK for me, I just created two new LUA scripts in the web GUI one for “Fan” ON and one for “Fan” OFF.

image

image

When I pressed the Play buttons next to the scripts my Fan in the room was turned ON and OFF OK.

What’s the firmware version of your Ezlo controller?

There was a bug with LUA scripts not running recently and that was only fixed for me in the last release they put out.

image

I’m at 2.0.28.1978.1 which I thought was the current. but I guess not.

That’s why LUA codes are not running for you. Try rebooting your controller to update it.

I don’t think that its related to FW version @cw-kid since @curiousB is getting an error means it is running…
The error is “core.setItemValue: an incorrect number of parameters” so maybe the device itself requires some additional parameters or maybe it is a typo or sth.

@curiousB can you dump the output of apitool hub.item.list for that device items like this :

1 Like

Thank you both. Osman is correct I think.

If I comment out the line …" – core.set_item_value(item.id, false) – >> something wrong with this line"… the script runs fine. I un-comment it and the I get the error below. I tried all sort of things to solve this but no luck. Something in the action of setting the switch state is getting an error.

require "core"
local deviceName = "PlugSwitch"   -- name of device to control
local items = core.get_items()
if items then
    for _, item in ipairs(items) do
        if item.name == "switch" then
            local device = core.get_device(item.device_id)
            if device and device.name == deviceName then
                core.set_item_value(item.id, false)   -- >> something wrong with this line
            end
        end
    end
end



[string "anonymous:62cdec1ad4e1dc12c8628a00"]:9: core.setItemValue: an incorrect number of parameters.
stack traceback:
	=[C]
	anonymous:62cdec1ad4e1dc12c8628a00:9

Hi @curiousB ,

It looks like core.set_item_value is asking for more than two parameters.

Could you please try core.set_item_value(item.id, false,nil) and let me know?

2 Likes

Yes adding the , nil corrected the problem in all the experimental scripts I was playing with. Not sure why I need the third parameter and others haven’t needed to. Would be interesting to understand why that is but for now this clears a big roadblock. Thanks!

Here is a script that works (don’t know why I lost the indenting via pasting script here).

This script toggles the switch state of a device by its name and not its iD.

require "core"
local deviceName = "PlugSwitch"   -- name of device to control
local items = core.get_items()
if items then
    for _, item in ipairs(items) do
        if item.name == "switch" then
            local device = core.get_device(item.device_id)
            if device and device.name == deviceName then
                 core.set_item_value(  item.id, not( item.value), nil ) -- toggles state from prior
            end
        end
    end
end
2 Likes

I’ve been a Vera user for as long as there has been Vera…LOL. I am on my 4th box.
I have 40 devices, 31 scenes and use some plugins like Harmony. I need the ability, for example to Turn on my Projector, turn on the Yamaha Amp, change input, adjust the temperature, set the lights,close the curtains and turn on appleTV. Seemingly what many would like for a media room. I have held off in going to Ezlo since many of the actions are on Harmony, which I don’t think is supported yet.
How are others dealing with what would seem like a baseline requirement for setting up a “room” for a movie? I am probably missing something.

Hi @Paulb4333 , we are trying to build an easier experience on the whole platform, as well as the plugin development and usage flows. The syntax has been changed and now we are building back the marketplace you love from vera in a much better way. We already developed plugins as Ezlo and put it freely on the marketplace. we would love to create more examples and also encourage other developers to engage with the platform. And we absolutely love to hear feedback from experienced users like you to improve the platform.
Would you please share which plugins you are using on your scenes and what kind of automation rules you are using ?

Thanks

You need to put 3 tick characters before and after your code to have it formatted properly on the forum.

" ``` "

I think you can do everything you ask today. It would be easier if there was a harmony plug in but this new environment permits HTML calls so you could find the Harmony HTML command structure and embed the various ir command strings into your scenes. Further if some of your devices are on the same LAN they may have HTML commands to control them without ir.

Thanks! The advantage of the Harmony is that it allows both IR and html.
For example, Our media room is upstairs and I want to get the room set up before we get there.
So fire up the projector so it warms up; IR command through Harmony; No HTML available; Turn on Yamaha amplifier, switch to proper input IR command through Harmony;; Close curtains; Harmony triggers IR command; :Lower AC temperature using Vera commands, Turn on lighting using Vera. Lock doors using Vera. So the key missing ingredient is Harmony, or a solution to trigger IR commands through EzLo. Does this help with the requirement?

Ezlo Hubs only support Broadlink RM Pro hubs currently for IR stuff.

There was talk of them doing a Harmony plugin but as yet no news.

The original Harmony plugin for the Vera hub does have a HTTP API, so you could use an Ezlo hub and the new Meshbot automation rules, to send http requests out to the Vera hub / Harmony plugin.

But is there much point doing that? As you’d still need the Vera hub.

I’m still using my Vera Plus as my main hub.

No Harmony plugin on the Ezlo hub is also a bit of a show stopper for me also. Although Harmony remotes are now EOL, so who knows if Ezlo will actually spend time and money doing a new plugin?

OK just an update:

My earlier problem with requiring an extra , nil to fix the command below is no longer needed. I was migrated to newer firmware 2.0.29.2027.3 and just for fun I took the , nil out and the LUA script works. So a bit of a fire drill for nothing. It must have been a bug they fixed in the current release.

core.set_item_value(  item.id, not( item.value), nil ) -- toggles state from prior

Hi @curiousB ,

Indeed, the latest firmware includes some fixes and improvements related to Lua and expressions.

Thank you for the constant feedback, this really helps us to improve the platform.

Find more:

@curiousb is correct – Generic IP cameras do not work with the Ezlo. The app won’t install them (throws an error about the URL being incorrect, even though its the same URL that worked with a Vera), and the new web interface won’t install devices of any kind.

I’ve installed some generic IP cameras (all Foscam) with the Vera App on an Ezlo Plus. With the web interface this seem to be not possible at the moment.

1 Like

trcollins, Actually I did get my FOSCAM PTZ camera to work with Ezlo Plus using the generic IP Camera selection. Now when I say “working” I mean it renders video. None of the PTZ functions are operational.

That said I was able to test PTZ movements using an HTTP Request GET as the action in a Scene. I just pasted in the HTTP CGI command line and the camera did what is was supposed to. pan, tilt, zoom, jump to preset, … Its a bit awkward creating a bunch of scenes to replicate all the pan and zoom functions but you can do it today. Of course you need a way to trigger the scenes while in the video viewing window so I assigned them to a mini-mote handheld buttons. This all works fine but not exactly a clean interface. I would think the Plug in for this would be easy for a software developer but I only dabble in scripts so its probably beyond my talents.

For PTZ commands you have to have two HTTP GETs. One to start the movement, then approx 750msec later issue a PT or Zoom stop command or else the PTZ movement continues to the outer limits of travel.

I made an excel spreadsheet to generate all the PTZ and preset command strings based on a specific camera ip address, userid, and password but I can’t seem to upload it here. I’ll paste the body of the spreadsheet below for any one interested. All FOSCAM cameras use the same CGI command string format.

p.s. all of the scenes were created from the ezlogic.mios.com web interface which is very nice for editing these kinds of scenes. I don’t know how you would do it from your iPhone/Android. Adding the IP Camera was done from the IPhone client.

|ptzMoveUp|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveUp&usr=admin&pwd=passwerdy|

|ptzMoveRight|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveRight&usr=admin&pwd=passwerdy|

|ptzMoveLeft|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveLeft&usr=admin&pwd=passwerdy|

|ptzStopRun|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=ptzStopRun&usr=admin&pwd=passwerdy|

|ptzGotoPresetPoint|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=pointName&usr=admin&pwd=passwerdy|

|zoomIn|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=zoomIn&usr=admin&pwd=passwerdy|

|zoomOut|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=zoomOut&usr=admin&pwd=passwerdy|

|zoomStop|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=zoomStop&usr=admin&pwd=passwerdy|

|ptzAddPresetPoint|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=ptzAddPresetPoint&name=pointName&usr=admin&pwd=passwerdy|

|ptzDeletePresetPoint|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=ptzDeletePresetPoint&name=pointName&usr=admin&pwd=passwerdy|

|getPTZPresetPointList|http://192.168.2.12:80/cgi-bin/CGIProxy.fcgi?cmd=getPTZPresetPointList&usr=admin&pwd=passwerdy|

Mine (not a Foscam) doesn’t use a cgi-based script like yours and the Vera app device installer refuses to accept the URL. Again, this is the same URL that works with the old Vera web interface, so there’s an issue to address here.