Enable hardware with script or API

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
Post Reply
User avatar
rolandbreedveld
Posts: 63
Joined: Wednesday 09 March 2016 12:25
Target OS: Raspberry Pi
Domoticz version: stable
Contact:

Enable hardware with script or API

Post by rolandbreedveld » Saturday 29 September 2018 18:53

Hi all

I sometimes have an issue with my P1 interface, I have to disable and enable the "P1 Smart Meter USB" hardware to make it work again.
I want to do this automatic from my (=self-made) monitor-script, if possible with a api-call, but can't find how to do this, only to create/delete hardware.
Does anybody know how?

regards, Roland
Raspberry Pi2+3 | P1 SmartMeter | Z-Wave Razberry 2.0 | 4 Greenwave devices | FIBARO FGS223 +FGRM222 | Aerotec MultiSensor 6 | 4 NeoCoolCam PowerPlug | Logitech Harmony Hub | FritzBox
Interface to 123Solar + PowerOne 3.0 and SMA SB1200

User avatar
waaren
Posts: 1227
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Enable hardware with script or API

Post by waaren » Saturday 29 September 2018 20:54

rolandbreedveld wrote:
Saturday 29 September 2018 18:53
I sometimes have an issue with my P1 interface, I have to disable and enable the "P1 Smart Meter USB" hardware to make it work again.
I want to do this automatic from my (=self-made) monitor-script, if possible with a api-call, but can't find how to do this
@rolandbreedveld, [Me being political correct :D ] I think it would be much more preferable if you can find the root cause of this problem and get that out of the way.

Unfortunately there seem to be no generic api-call to enable /disable hardware. The call varies per hardware type and other settings.
e.g. the call to disable my RFXcom is:

Code: Select all

http://DOMOTICZ_IP:DOMOTICZ_PORT/json.htm?type=command&param=updatehardware&htype=1&port=%2Fdev%2FttyUSB-RFtrx433&extra=&name=RFtrx433&enabled=false&idx=3&datatimeout=0&Mode1=0&Mode2=11&Mode3=0&Mode4=44&Mode5=46&Mode6=64
and the call to diable my P1 link is:

Code: Select all

http://DOMOTICZ_IP:DOMOTICZ_PORT/json.htm?type=command&param=updatehardware&htype=4&port=%2Fdev%2FttyUSB-P1&extra=&name=P1&enabled=false&idx=6&datatimeout=0&Mode1=1&Mode2=0&Mode3=0&Mode4=0&Mode5=0&Mode6=0
only sending

Code: Select all

http://DOMOTICZ_IP:DOMOTICZ_PORT/json.htm?type=command&param=updatehardware&enabled=false&idx=3
does result in an {"status": "ERR"} return

you can find the api-call for your domoticz system by entering developer mode ( [CTRL][SHIFT]I in chrome) and there choose network when accessing the hardware tab in domoticz and disable / enable the hardware you are looking for. In the developer window you will see the json domoticz uses to perform the requested action.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
rolandbreedveld
Posts: 63
Joined: Wednesday 09 March 2016 12:25
Target OS: Raspberry Pi
Domoticz version: stable
Contact:

Re: Enable hardware with script or API

Post by rolandbreedveld » Sunday 30 September 2018 19:40

@waaren
Thanxzz, this wil do the job, didn't find this on the forum/wiki

regards, Roland
Raspberry Pi2+3 | P1 SmartMeter | Z-Wave Razberry 2.0 | 4 Greenwave devices | FIBARO FGS223 +FGRM222 | Aerotec MultiSensor 6 | 4 NeoCoolCam PowerPlug | Logitech Harmony Hub | FritzBox
Interface to 123Solar + PowerOne 3.0 and SMA SB1200

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests