Virtual Switch - HTTP Request

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
TimmermanTim
Posts: 4
Joined: Friday 19 February 2016 9:45
Target OS: Linux
Domoticz version:
Location: Northern Holland
Contact:

Virtual Switch - HTTP Request

Post by TimmermanTim »

I have a virtual switch that sends HTTP requests for the On and Off action of the switch.

Now if the device that receives the requests is unavailable in the network, in the Domoticz log there is an error saying "Error opening url:" but the virtual switch still changes it's state.

Is there a way to produce a popup error saying the device can't be reached when the HTTP request fails?
paulvha
Posts: 40
Joined: Friday 29 January 2016 16:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Virtual Switch - HTTP Request

Post by paulvha »

The current implementation will only provide a log entry on failure. The best way forward is to create a script that is called in the on-off action of the switch instead of http-request directly. That way you could also implement with json() calls to reset to switch in case it was not successful.
TimmermanTim
Posts: 4
Joined: Friday 19 February 2016 9:45
Target OS: Linux
Domoticz version:
Location: Northern Holland
Contact:

Re: Virtual Switch - HTTP Request

Post by TimmermanTim »

paulvha wrote:The current implementation will only provide a log entry on failure. The best way forward is to create a script that is called in the on-off action of the switch instead of http-request directly. That way you could also implement with json() calls to reset to switch in case it was not successful.
Thanks. I will try that. So it is possible to reset the switch with JSON? That way I can update the status of the switch but not actually run the switch action?
TimmermanTim
Posts: 4
Joined: Friday 19 February 2016 9:45
Target OS: Linux
Domoticz version:
Location: Northern Holland
Contact:

Re: Virtual Switch - HTTP Request

Post by TimmermanTim »

Okay, I found out I can update the status of the switch but not actually execution the action of the switch via "/json.htm?type=command&param=udevice&idx=1&nvalue=0" So by using "nvalue".
paulvha
Posts: 40
Joined: Friday 29 January 2016 16:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Virtual Switch - HTTP Request

Post by paulvha »

Yyour number 1 for idx could be correct :-), but make sure you idx number is the same as for the device in the devices tab
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest