Page 1 of 1

Retrieve HTTP GET data

Posted: Saturday 16 October 2021 19:25
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.

Re: Retrieve HTTP GET data

Posted: Sunday 17 October 2021 10:52
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?

Re: Retrieve HTTP GET data  [Solved]

Posted: Sunday 17 October 2021 23:13
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

Re: Retrieve HTTP GET data

Posted: Tuesday 19 October 2021 7:04
by Number8
Thanks a lot, this is good to now

Re: Retrieve HTTP GET data

Posted: Tuesday 19 October 2021 14:20
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.

Re: Retrieve HTTP GET data

Posted: Tuesday 19 October 2021 16:44
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.