HTTP Poller and http error

Moderator: leecollings

Post Reply
MichelFrance
Posts: 17
Joined: Tuesday 19 November 2019 16:28
Target OS: Linux
Domoticz version: 2023.1
Location: France
Contact:

HTTP Poller and http error

Post by MichelFrance »

Hello,
(I a new on Domoticz...)
I am trying to interface a remote switch which responds to http get commands:
http://ip_adress/on
http://ip_adress/off
and
http://ip_adress/status
This last status command answers 0 or 1 depending on the state of the switch.

This switch can be switched on/off from Domoticz AND from other devices and I want the status in Domoticz to reflect the real status of the switch even if the switch is switched by one of the other devices...

I created an http poller with a virtual sensor (switch type).
The poller requests the status url every 5 seconds and a lua script that reads the http answer and update the status of the virtual sensor according to the answer.
The virtual sensor has 2 url : On Action : http://ip_adress/on and Off Action : http://ip_adress/off

I works good!..

BUT...

Some times the remote switch is offline, and then I would like to indicate this.
I tried to use a selector switch as virtual sensor, with 3 levels : 'off-line', 'off' and 'on'. and I would like to set the status to 'off-line' in case of http error during the poll.

Is it possible this way (how and where do I handle the http errors)?
if not, any idea about handling the case where the physical switch is off-line?

Regards.
MichelFrance
Posts: 17
Joined: Tuesday 19 November 2019 16:28
Target OS: Linux
Domoticz version: 2023.1
Location: France
Contact:

Re: HTTP Poller and http error

Post by MichelFrance »

up
User avatar
bewo
Posts: 74
Joined: Monday 13 July 2015 12:27
Target OS: Linux
Domoticz version: 2021.1
Location: Bavaria - Germany
Contact:

Re: HTTP Poller and http error

Post by bewo »

....and a lua script that reads the http answer and update the status of the virtual sensor according to the answer....
It woul'd be much easier to help you, if you describe the situation a bit more and if you post the script you use...
Individual projects:
Domoticz on a Intel Xeon Server | AeonLabs Z-Wave Gen.5 | RFXCOM RFXtrx433E USB | ESP-Wifi-Modules | Shellys
Wall-mounted 22" Touch Control Display (self construct) | LUA wind monitor| LUA heating control | and many many more :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest