Presence detection error since 2023.2

Python and python framework

Moderator: leecollings

Post Reply
steef27
Posts: 30
Joined: Friday 26 August 2016 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Presence detection error since 2023.2

Post 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?
User avatar
waltervl
Posts: 5760
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Presence detection error since 2023.2

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest