Page 1 of 1

Presence detection error since 2023.2

Posted: Wednesday 26 July 2023 10:27
by steef27
Hi guys,
Recently I installed 2023.2. From that moment on, the presence detection (Check_device_online.py) gives an error:

Code: Select all

2023/07/26 10:25:07- pid file exists
2023/07/26 10:25:07- Seems to be an old file, ignoring.
2023/07/26 10:25:07- script started.
Traceback (most recent call last):
  File "/home/pi/domoticz/scripts/check_device_online.py", line 120, in <module>
    lastreported = domoticzstatus()
  File "/home/pi/domoticz/scripts/check_device_online.py", line 96, in domoticzstatus
    json_object = json.loads(domoticzrequest(domoticzurl))
  File "/home/pi/domoticz/scripts/check_device_online.py", line 115, 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 401: Unauthorized
I am using the script from https://www.domoticz.com/wiki/Presence_detection
I can't figure out what is causing this. Does anyone have an idea?

Re: Presence detection error since 2023.2

Posted: Wednesday 26 July 2023 10:35
by waltervl
Check your security settings in Domoticz.
The python script is using http API commands to update devices.
The security for this has been tightened (already in version 2023.1).
See wiki page https://www.domoticz.com/wiki/Security#The_Security-tab