Retrieve HTTP GET data  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Retrieve HTTP GET data

Post by Number8 »

Hello
I'm using among others Shelly Door/2 device. In device setup there is room for an URL that will "Report as GET parameters to HTTP url".
The parameters are described in the documentation
https://shelly-api-docs.shelly.cloud/ge ... gs-actions
The device beeing in sleep mode, there is no way to send a request to the device. I have to let it send the URL when a wake up condition arises.
There is no way to pass value as we would normaly do and then trigger a custom event. There is no way to wake it up be sending a kind of wake up command.
Here below is an example of the HTTP GET when sending http://ip_of_shelly/status after wake-up (hardware action)

Code: Select all

{"wifi_sta":{"connected":true,"ssid":"saintpierre","ip":"192.168.21.218","rssi":-67},"cloud":{"enabled":false,"connected":false},"mqtt":{"connected":false},"time":"","unixtime":0,"serial":1,"has_update":false,"mac":"483FDA824BFB","cfg_changed_cnt":0,"actions_stats":{"skipped":0},"is_valid":true,"tmp":{"value":21.70,"units":"C","tC":21.70,"tF":71.06, "is_valid":true},"lux":{"value":0, "illumination": "dark", "is_valid":true},"accel":{"tilt":-1, "vibration":-1},"sensor":{"state":"open", "is_valid":true},"bat":{"value":93,"voltage":5.72},"act_reasons":["poweron"],"update":{"status":"idle","has_update":false,"new_version":"20211004-121334/v1.11.5-gdedfb52","old_version":"20211004-121334/v1.11.5-gdedfb52"},"ram_total":51360,"ram_free":38444,"fs_size":233681,"fs_free":149847,"uptime":127}
How could I in Domoticz environment retreive all the data described in the documentation? (I hope I make myself understandable). Thanks a lot in advance for any idea that will steer me in the right direction.
Debian buster on NUC and three RPi with buster.
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Retrieve HTTP GET data

Post by Number8 »

Some experiments have been made thanks to http://ptsv2.com/ "a service that you can point your HTTP clients' POSTS and GETS to which receives and dumps them so you know what is being transmitted"
So, in order to handle GET, shoud I set-up a simple http server, decode the values and send it to Domoticz as a custom event?
Debian buster on NUC and three RPi with buster.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Retrieve HTTP GET data  [Solved]

Post by Dnpwwo »

You could try using the example HTTP Listener plugin that comes with Domoticz.

Look under domoticz/plugins/examples for HTTP Listener.py.

Create a new folder under plugins (name not important) copy HTTP Listener.py into it and rename it plugin.py. Restart Domoticz and add it as a piece of hardware (look for "Listener Sample Plugin" in the drop down). Set the port number, Add it and watch the log
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Retrieve HTTP GET data

Post by Number8 »

Thanks a lot, this is good to now
Debian buster on NUC and three RPi with buster.
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Retrieve HTTP GET data

Post by waltervl »

@Number8
You know there is a Shelly MQTT plugin? That seems to support your door device: https://github.com/enesbcs/Shelly_MQTT

Saves you perhaps from developing something new.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Retrieve HTTP GET data

Post by Number8 »

@waltervl: thanks. As a matter of fact, I already setup mqtt as well as shelly plugin. Indeed this would answer the question. It was more of a general question.
Debian buster on NUC and three RPi with buster.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest