Present Detection error in script

Python and python framework
Post Reply
Btje
Posts: 26
Joined: Wednesday 05 October 2016 7:46
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Present Detection error in script

Post by Btje » Sunday 18 February 2018 22:02

I'm trying to run the present detection script provided by domoticz : http://www.domoticz.com/wiki/Presence_detection

It always starts with the phone is offline when running in a putty window:

command: python check_device_online.py 192.168.1.50 44 10 30

and this is the response:

20:56:36- script started.
20:56:36- according to domoticz, 192.168.1.50 is offline
20:56:37- 192.168.1.50 offline, waiting for it to come back
20:57:00- 192.168.1.50 online, tell domoticz it's back
Traceback (most recent call last):
File "check_device_online.py", line 117, in <module>
domoticzrequest("http://" + domoticzserver + "/json.htm?type=command&param=switchlight&idx=" + switchid + "&switchcmd=On&level=0" + "&passcode=" + domoticzpasscode)
File "check_device_online.py", line 96, in domoticzrequest
response = urllib2.urlopen(request)
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 435, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 473, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request

The logfile states it is offline and then online:

19:48:26- script started.
19:48:26- according to domoticz, 192.168.1.50 is offline
19:48:43- 192.168.1.50 offline, waiting for it to come back
19:49:29- 192.168.1.50 online, tell domoticz it's back

Question is why is it offline and then online and where does the error come from.The switches in domoticz are not turned on.

blauwebuis
Posts: 363
Joined: Wednesday 21 December 2016 10:11
Target OS: Raspberry Pi
Domoticz version: current
Contact:

Re: Present Detection error in script

Post by blauwebuis » Monday 19 February 2018 11:18


Btje
Posts: 26
Joined: Wednesday 05 October 2016 7:46
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Present Detection error in script

Post by Btje » Tuesday 20 February 2018 8:00

Tried changing the python version and this did not help.

Post Reply

Who is online

Users browsing this forum: N1co and 5 guests