Ezlo API, how to get item value?

I’ve seen the question in many other threads, but never seen an answer.

How do I get the valueFormatted of a temperature sensor by requesting a local http get to the Ezlo Plus?
(I’m already set up with offlineAnonymousAccess and can set values etc)

1 Like

Hi,

You have to use the hub.items.list method and include the device ID of the temp sensor. That will return a json with the valueFormatted. See https://api.ezlo.com/hub/items_api/index.html

In http that would be something like:
https://:17000/v1/method/hub/items/list?deviceIds=

(the parameter deviceIds is not yet correct, having trouble to find the right use.)

Cheers Rene

The main goal is to have the Ezlo Plus to update a virtual sensor on my Vera Secure when value changes (like luup.variable_watch) but the lack of examples and me not understanding the docs for the new firmware stops me from doing that.

One would think since there is hub.item.value.set there would be a hub.item.value.get but not that I have found in the docs.

So my idéa is to poll the sensor from Vera in a scene with a simple http request.

I can get the value with the api tool with hub.data.list:

{
    "api": "1.0",
    "method": "hub.data.list",
    "id": "_id_",
    "params": {
       "items":{ 
            "ids":["5fd35167129e0711ffa44a75"], "fields": { "include":["valueFormatted"] }
         }
    } 
}

But I can’t figure out how to filter nested objects in a url.
I guess it’s quite simple to script this request and extract the value from the json response if you know how, but I’m still a novice in Lua.

It seems we are stuck at the same thing then. I asked the developers but no reply yet.

1 Like

Hi @Crille,

I was reading past the most powerful request “v1/request”. With that you can post the exact json data to the hub.

https://<ip>:17000/v1/request -d '{ "method": "hub.data.list", "id": "16081108876", "params": {"items":{"ids":["5f747430124c411719483753"],"fields":{"include":["valueFormatted"]}}}}'

Cheers Rene

1 Like

Rene

I tried this command in Postman, to get the temperature off a Fibaro motion sensor, but I get an error:

https://192.168.0.11:17000/v1/request -d '{"method": "hub.data.list", "id": "5f749301120bab105e88c463", "params": {"items":{"ids":["5f749301120bab105e88c464"],"fields":{"include":["valueFormatted"]}}}}'

image

I tried HTTP and HTTPS.

You have to use a POST request, not a GET.

I tried POST also.

Let me try again.

You can use GET to run a scene or control a device on the Ezlo Plus hub OK.

I think you need to look at the PostMan documentation on how to specify the data in the POST request. The example I gave is for a curl command.

I get this with Curl

There was an extra space in front of the “method”. I removed the space and now see this:

If I remove all the spaces from within the command like this:

curl --insecure --http1.1 https://192.168.0.11:17000/v1/request -d '{"method":"hub.data.list","id":"5f749301120bab105e88c463","params":{"items":{"ids":["5f749301120bab105e88c464"],"fields":{"include":["valueFormatted"]}}}}'

I don’t get any errors now but I get no value back either.

Its the same with this command and using the other ID number “1608117651467” , still no value returned.

curl --insecure --http1.1 https://192.168.0.11:17000/v1/request -d '{"method":"hub.data.list","id":"1608117651467","params":{"items":{"ids":["5f749301120bab105e88c464"],"fields":{"include":["valueFormatted"]}}}}'

Thats great, now I just have to figure out how to send that from Vera and parse the json response :thinking:

I see you are using curl in a Windows command shell. That handles quotes differently than Unix/Linux. The single quote does not help to make the rest of the command a simple string. You need a lot more quotes. Some thing like:

-d "{ """method""":"""hub.data.list""", """id""":"""1234"""..... }"

As always, I ended up doing what I know best and wrote a powershell script to do the job.

I wish there was a simple url to get the value, then I could poll directly from Vera instead.

Indeed.

Just tried it from my Pi instead and that does indeed work OK and return the temperature value.

image

This is the first thread on the forum I believe with a working example of retrieving values via the Ezlo API !

I’ve asked this same question several times and never gotten any response or reply from the Ezlo devs about it.

Its a shame its not as easy as Vera Luup Requests and a single one line HTTP command can be used with no method payload needed.

For the record here is a Vera command example:

http://192.168.0.12/port_3480/data_request?id=variableget&DeviceNum=537&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature

Much easier…

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules