Page 1 of 1

(Solved) Zigbee4domoticz: Constant 401 Error Logs

Posted: Wednesday 03 January 2024 16:06
by Caspian392
Hello everybody,

A while ago I have added Zigbee4domoticz to my system, using Sonoff Zigbee 3,0 Dongle Plus-E. This all seems to work fine.
I have also added the SNZB-02D Temp/Hum sensor to my system, and this also seems to work fine. The device shows up in the Zigbee4domoticz dashboard, and the values update correctly on my sensor dashboard in domoticz.

Even though the Zigbee additions seem to work correctly, I get the following error messages in my Domoticz Log:
(See attachment)

The "Zigbee Broker" is my Zigbee4Domoticz Hardware. (See image attached image for configuration).
The 86 and 85 device ids seem to refer to the device ids of the Temperature sensor of the SNZB-02D, and the Temperature + Hum sensor.

As can be seen, these errors re-occur every 5 minutes. As the error suggests it is probably an authorization issue, but I don't really know what is unauthorized and/or which credentials are missing. Does anyone has an idea what is wrong? Thanks in advance!

(Couldn't paste the images or error logs themself in the post, so they are added as image attachments. Sorry for the inconvenience)

Re: Zigbee4domoticz: Constant 401 Error Logs

Posted: Wednesday 03 January 2024 17:13
by Caspian392
It also seems that the intervals in which the temperature and humidity update are pretty weird. Maybe that has something to do with it? (See image for lager error log)

Re: (Solved) Zigbee4domoticz: Constant 401 Error Logs

Posted: Friday 05 January 2024 11:09
by Caspian392
I managed to solve it, it indeed was an authentication error.
First I tried to reach the link which gives an 401 from my regular browser where I am logged in into Domoticz (ofcourse replacing the localhost ip to the relevant ip of my pi). Here I could reach the endpoint, and also see what the response should be. After this I tried to reach this URL using the localhost ip from my pi using a curl command. This did give me a 401, confirming that my pi could not reach it normally.

My first try to fix it was to add the localhost ip to the "Settings > Security > Trusted Networks" setting, since I thought maybe my domoticz install doesn't allow API calls from this ip. (See attachments).

This however did not fix the whole issue, and the errors still persisted. After this, I changed the configuration of my Zigbee2Domoticz hardware entity to specifically include the domoticz username and password. I first tested it using the curl command to make sure that the url was in the right form, and that the response was what I expected. After this I changed the configuration accordingly (see attachments, and note <USR> and <PASS> need to be changed to the username and password of your domoticz user).

After this the authentication errors are no more!

Re: (Solved) Zigbee4domoticz: Constant 401 Error Logs

Posted: Friday 05 January 2024 14:39
by waltervl
User:password should not be needed if 127.0.0.1 is in trusted network (you have) and the Domoticz security setting "Allow basic authorisation on HTTP" is switched on (by default switched off).