CW's IDIOT GUIDE - To Ezlo platform HTTP API commands aka Luup Requests

PART 3 - Controlling a device with authentication turned on

Note: If you want to create some virtual devices on you Ezlo controller so you have more devices to test with, see here.

See Part 1 first on how to get your auth token.

Here are some HTTPS command examples for turning on a Z-Wave appliance plug.

Here we are using value_bool=true

curl -K ezlo_plus_curl_auth --http1.1 --insecure "https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f4e5871120bab1069c13c4c&value_bool=true"

Or alternatively we can also use this command using value_int=1 to turn on the plug:

curl -K ezlo_plus_curl_auth --http1.1 --insecure "https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f4e5871120bab1069c13c4c&value_int=1"

Here are some HTTPS command examples for turning off a Z-Wave appliance plug.

value_bool=false

curl -K ezlo_plus_curl_auth --http1.1 --insecure "https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f4e5871120bab1069c13c4c&value_bool=false"

or alternatively using value_int=0

curl -K ezlo_plus_curl_auth --http1.1 --insecure "https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f4e5871120bab1069c13c4c&value_int=0"

OK lets try these ON / OFF commands in Curl from the Raspberry Pi:

image

Your appliance plug or device should be turned on and then off.

How to find your devices ID number?

So in our HTTPS commands to control the device we need to specify the devices item object _id number.

To find out what this ID number is? We need to use the online API Tool again.

Go to Ezlo API Tool and login with your Vera username and password.

Select your Ezlo Hub’s Serial number and click the Connect button.

From the Calls API drop down select “hub.devices.list” and hit the Query button.

Scroll down to the “Response” section and expand “Result”.

You will then see all your devices listed you can expand them further to see what the devices are.

For example here you can see my Everspring appliance plug.

Make a note of the _id number in this example its “5f4e5871120bab1069c13c49”

Now in the Calls API drop down list select “hub.items.list” and hit the Query button.

EDIT: Better to select the hub.items.list - filter by device ID and enter the devices ID. It will then only return the items for that particular device.

Go to the “Response” section again and expand “Result” and then “Items”.

Now I only have two Z-Wave devices paired to my Ezlo Plus the Everspring appliance plug and an Everspring door contact sensor.

Yet I can see 7 item objects.

image

Each physical device can have multiple “item objects”.

So if I start expanding these item objects I have discovered that my Everspring appliance plug has 4x item objects.

Note: I know I am looking at the right device I want because its “deviceid” is the same as the one we saw earlier when using the “hub.devices.list” query e.g. “5f4e5871120bab1069c13c49”

Here you can see the 4x item objects for my Everspring plug:

Basic -

image

Switch -

image

electric_meter_watt

image

electric_meter_kwh

image

So now knowing this, I now need to use the correct item object to control the ON / OFF via HTTPS commands.

In this example I can use either “switch” or “basic”.

Lets use “swtich”.

It’s here on this “switch” item object we find the correct _id number we need to use in our HTTP commands

In this example its “5f4e5871120bab1069c13c4c”

image

So if we look at one of our HTTPS commands again we can see we have the same _id in that command:

https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f4e5871120bab1069c13c4c&value_bool=true

Controlling a Dimmable Light or Device

To control the dim value of a device we can use “value_int=” and then a percentage e.g. “value_int=50” to dim to 50%

Using the “hub.items.list” query in the API Tool we can see that a dimmable light has 5x items.

In this example I am using the “Dimmer” item and its _id number.

image

Example Curl command using Auth to dim to 50%

curl -K ezlo_plus_curl_auth --http1.1 --insecure https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f58c63a120bab1065bc0e7e&value_int=50

Example Curl command no Auth to dim to 50%

curl --http1.1 --insecure https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f58c63a120bab1065bc0e7e&value_int=50

Example HTTPS command no Auth to dim to 50%

https://192.168.0.11:17000/v1/method/hub.item.value.set?_id=5f58c63a120bab1065bc0e7e&value_int=50
1 Like