Credits to @reneboer @crille @blacey
Also see the “Ezlo Linux firmware - HTTP documentation preview” here
PART 1 - Running scenes with authentication turned on
OK after a lot of trial and error and help from some of you guys on the forum, I now have basic control of devices and scenes working via HTTPS commands.
In Vera as you may know we had the Luup Requests API where we could easily send simple one line HTTP commands to Vera to control devices, run scenes and set device variables etc.
This was very useful for all sorts of things and integrations with different devices and apps on your local LAN.
In Ezlo we now have similar functionality but it is much more difficult to get working, at least for me hence the Idiots Guide…
By default the Ezlo hub will require a username and token (password) and will use HTTPS.
You can now turn off the authentication to enable you to use more simple one line HTTPS commands similar to Vera Luup Requests.
Scene example with authentication turned on:
If you wish to leave authentication turned on you will need to use this Python script here to get your token from your Ezlo hub / Ezlo cloud.
@Oleh I don’t think we know yet how long these tokens last for? Or when they will expire?
I am using my Raspberry Pi for testing all this. Using WinSCP on my Windows 10 laptop I uploaded the Python script “Ezlo_create_curl_config.py” to my Pi into my “Ezlo” directory.
Then using Putty and SSH connecting to the Pi, I ran this command to get my token for my Ezlo Plus hub:
python3 Ezlo_create_curl_config.py HubIP HubSerialNumber Username Password
Note: It’s your regular Vera account username and password you use here.
If it works you will get a long token string copy all of this to a notepad for later.
Note: If it doesn’t work and you get no token given back, remove your Ezlo Plus hub from your Vera account and add it back in again. I had to do this to get my token.
On the Pi I then created a file to store my token called “ezlo_plus_curl_auth” in my “Ezlo” directory, and pasted in the token to this file. It should look something like this:
Now we can use CURL to test it’s working, enter the IP address of your Ezlo Plus hub.
curl -K ezlo_plus_curl_auth https://192.168.0.11:17000/v1/method/hub/info/get
You should get an output like this if it works with the hub info:
Now we need to use the online API tool to find out some scene ID numbers, so we can try and run a scene via HTTPS command line.
Go to Ezlo API Tool and login with your Vera username and password.
UPDATE: They have redesigned the webpage layout somewhat. The “Api Calls” is now called “Commands” and the “Query” button is now called “Send”.
Select your Ezlo hub’s serial number and click the Connect button.
Then from the API Calls drop down list select hub.scenes.list and press the Query button.
Scroll down to the Response section and this will list all the scenes on your Ezlo hub.
You can expand them to find the scene you are looking for:
I want to run my “Turn On Diffuser” scene via HTTPS command line, make a note of the scene’s _id number.
In this example its: “5f4d6a2f120bab10a13b6916”
Now we can construct our HTTPS command to run in Curl.
curl -K ezlo_plus_curl_auth --http1.1 --insecure https://192.168.0.11:17000/v1/method/hub/scenes/run?sceneId=5f4d6a2f120bab10a13b6916
Running the scene command in Curl:
Your scene should have run if it worked OK !
That’s it for now more to come later…