Page 1 of 1
Enable hardware with script or API
Posted: Saturday 29 September 2018 18:53
by rolandbreedveld
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
Re: Enable hardware with script or API
Posted: Saturday 29 September 2018 20:54
by waaren
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

] 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¶m=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¶m=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¶m=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.
Re: Enable hardware with script or API
Posted: Sunday 30 September 2018 19:40
by rolandbreedveld
@waaren
Thanxzz, this wil do the job, didn't find this on the forum/wiki
regards, Roland
Re: Enable hardware with script or API
Posted: Saturday 22 December 2018 12:38
by HansieNL
@rolandbreedveld I have the same problem. Once in a while the P1 stops working and disabling/ enabling the hardware solves the problem.
Can you share your script you are using to solve this problem?
Thanks in advance.
Re: Enable hardware with script or API
Posted: Saturday 22 December 2018 12:53
by rolandbreedveld
@HansieNL
solution is simple, set in the P1 hardware, the timeout at 15 minutes, this will restart the P1 service if dead.
Re: Enable hardware with script or API
Posted: Saturday 22 December 2018 13:05
by HansieNL
@rolandbreedveld Thanks. Didn't think about that solution. Sometimes things can be that simple

Re: Enable hardware with script or API
Posted: Tuesday 23 April 2019 18:35
by kofec
How to enable device ?
I'm able to disable but not enable:
Code: Select all
wget -q -O - "http://192.168.1.11:8080/json.htm?type=command¶m=updatehardware&htype=41&name=MySensorsKinowaNano&enabled=false&
idx=2"
{
"status" : "OK",
"title" : "UpdateHardware"
}
wget -q -O - "http://192.168.1.11:8080/json.htm?type=command¶m=updatehardware&htype=41&name=MySensorsKinowaNano&enabled=true&i
dx=2"
{
"status" : "ERR"
}
Re: Enable hardware with script or API
Posted: Tuesday 23 April 2019 20:31
by waaren
kofec wrote: ↑Tuesday 23 April 2019 18:35
How to enable device ?
I'm able to disable but not enable:
On my system I to add &port=%2Fdev%2FttyUSB-RFtrx433 to the http to get it working for my RFtrx433 device.
Re: Enable hardware with script or API
Posted: Tuesday 23 April 2019 21:04
by kofec
It works. Thanks a lot:
Code: Select all
wget -q -O - "http://192.168.1.11:8080/json.htm?type=command¶m=updatehardware&htype=41&name=MySensorsKinowaNano&enabled=true&i
dx=2&port=/dev/ttyUSB0"
{
"status" : "OK",
"title" : "UpdateHardware"
}
Re: Enable hardware with script or API
Posted: Sunday 21 July 2019 9:30
by Marcel62
I've got the same problem. During disable/enable the hardware is not available. I noticed that just "update" the hardware (with no changes, just press the update button) also fixes the problem, the hardware is still available. In my case Aeon Labs Aeotec Gen 5, one of the nodes seems lost the connection (Heal Node does not work). During the update all other nodes are still available.
So i prefer an update.
Is it possible to call update from commandline (script) ?
It would be perfect to test the nodes first, and only call the update if one of the devices are not ok
thanks
Re: Enable hardware with script or API
Posted: Sunday 21 July 2019 10:29
by Marcel62
found it, in the reply of warren , thanks