HTTP Poller and http error
Posted: Tuesday 19 November 2019 17:02
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.
(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.