Python Script for Ezlo FW HTTP API Curl commands

I am getting the same thing… anyone resolve this ticket?

C:\Users\TestUser>curl -v -K ezlo_plus_curl_auth https://192.168.74.20:17000/v1/method/hub/info/get

  • Trying 192.168.74.20:17000…
  • Connected to 192.168.74.20 (192.168.74.20) port 17000 (#0)
  • schannel: disabled automatic use of client certificate
  • schannel: using IP address, SNI is not supported by OS.
  • ALPN: offers http/1.1
  • ALPN: server did not agree on a protocol. Uses default.

GET /v1/method/hub/info/get HTTP/1.1
Host: 192.168.74.20:17000
User-Agent: curl/7.83.1
Accept: /
Authorization: Basic YmFl…

  • schannel: server closed abruptly (missing close_notify)
  • Closing connection 0
  • schannel: shutting down SSL/TLS connection with 192.168.74.20 port 17000
    curl: (56) Failure when receiving data from the peer

C:\Users\TestUser>

It has been a while since I tried, but the last time it indeed failed. It seems Ezlo made some change in the authentication.

Hi @mgalaty

Which hub model are you trying to connect ?

Hi Osman,

RE: “Which hub model are you trying to connect ?” >>>
I have a PlubHub 2 (Model: PlugHub Energy). Date code 2039. FCCID: 2AMY9PLUGHUB. IC ID: 22968 - Plughub.

I believe this uses the WebSocket protocol. I was provided this REST API call below which I can get a token. I’ve not figured out how to get WebSockets to work.

POST: https://api-cloud.ezlo.com/v1/request
{
“call”: “login_with_id_and_password”,
“params”:{
“user_id”: “”,
“user_password”: “”,
“oem_id”: 1
}
}

Can you give me some simple test steps which I can expand on?

Michael

I am able to get to the dashboard website, login and operate the APIs from this site:
https://apitool.ezlo.com/dashboard

Run the method: “hub.info.get” to get a reply with this information: (partial paste serial number removed)

model: “ATOM32”
architecture: “esp32”
firmware: “0.8.542”
kernel: “v4.2-rc-2-g511965b269”
hardware: “plug3”
serial: “84xxxxx”

I am able to run the “Ezlo_create_curl_config.py” Python script to generate a token. The problem I see is that the authentication shows “Basic: ” and most of the time I use “Bearer: ”.

@osman ^^^ I posted two posts above replies. I’d like to be able to integrate with my devices.

I can run the script “python3 Ezlo_create_curl_config.py”, all passwords and info removed here…
see below:
c:\Ezlo>Ezlo_create_curl_config_test.bat
c:\Ezlo>echo “Running Ezlo Create Curl config file”
“Running Ezlo Create Curl config file”

c:\Ezlo>python3 Ezlo_create_curl_config.py 192.168.86.xx 84xxxxx username password
-H "Authorization: Basic YmFlMWVjODAtODFiNy0xMWVkLTliOGE
–insecure
–http1.1

I tried again, and still get the “56” error:

c:\Ezlo>curl -K auth.txt https://192.168.86.20:17000/v1/method/hub/info/get
curl: (56) Failure when receiving data from the peer

The auth.txt file has the token as shown in the documentation.

Note: I see all my devices on this site:

I tried following the instructions in the document “CW’s IDIOT GUIDE - Ezlo platform HTTP API commands aka Luup Requests”. I don’t see these “offline…” values at all.

Also… How do I get my PlugHub to display the wifi “Ezlo-xxx” address? It’s already configured on my network.

Seems I am being directed by support to the MiOS website as being the proper API… I am I am reading about that website, I found the Lua Language is the basis of development and it seems to be in a container form, almost like docker. Am I on the right track here for being able to work with my PlugHub???

The Lua language is used for developing plugins for MiOS, which is a home automation platform. Plugins are used to extend the functionality of MiOS systems by adding custom features or integrating with other devices or services. Lua is a lightweight and easy-to-learn scripting language that is commonly used for embedded systems and scripting tasks. It is well-suited for creating MiOS plugins due to its flexibility, speed, and ability to interface with other programming languages and systems. Lua is often used in home automation systems due to its simplicity and versatility, making it a popular choice for developing plugins for MiOS.

NOTE!!! A light bulb is finally going off about this MiOS website… It actually looks really cool…

Hi @mgalaty

Sorry for responding late.
You have already figured out to use the apitool website. That site obviously uses cloud API endpoints but still can send/receive commands to the plughub. SO you can use the API mentioned in the developer.mios.com through apitool.
But I think your main request is to use it locally via local IP am I right ?

Hello @osman,
Yes, my main interest is to use my PlugHub locally using local IP first… please help me solve that but…
I’m interested in exploring the programming capabilities of my Ezlo hardware for home automation. Specifically, I want to learn how I can integrate locally with my hardware to automate tasks such as monitoring the battery levels of my shades. If I find this system useful, I plan to purchase more interfaces. Can you provide me with organized information, starting from the basics and guiding me on what to try first, including details about Ezlo’s API and Mios/Lua systems?

Thank you for your assistance.

Hi @mgalaty

I would kindly ask you to go through the help files first then. There you will find what capabilities our platform have and how to use them.

And then please share your feedback or any trouble points, so that we can set up your automations.
We will be more than happy to help.

Reviewing the help is in progress (THE HELP IS EXCELLENT — why no one in support pointed me there first is surprising). I was able to create one MeshBot… images below. I would like to locally access my PlugHub… where do I get exact instructions for that? That is in line with this thread. I’ll move my questions about MiOS to another thread. Can we get back to the question of using IP calls to access my PlugHub???

1 Like

hi @osman
To keep this thread focused on the purpose can you direct me to how to access my PlugHub locally?