(Solved) Zigbee4domoticz: Constant 401 Error Logs

Xiaomi, Ikea TRÅDFRI, Philips Hue and more.

Moderator: leecollings

Post Reply
Caspian392
Posts: 3
Joined: Wednesday 03 January 2024 15:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

(Solved) Zigbee4domoticz: Constant 401 Error Logs

Post 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)
Attachments
zigbee-error-logs.png
zigbee-error-logs.png (36.86 KiB) Viewed 1147 times
zigbee-broker.png
zigbee-broker.png (71.63 KiB) Viewed 1147 times
Last edited by Caspian392 on Friday 05 January 2024 11:00, edited 1 time in total.
Caspian392
Posts: 3
Joined: Wednesday 03 January 2024 15:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Zigbee4domoticz: Constant 401 Error Logs

Post 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)
Attachments
error-logs2.png
error-logs2.png (99.99 KiB) Viewed 1139 times
Caspian392
Posts: 3
Joined: Wednesday 03 January 2024 15:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: (Solved) Zigbee4domoticz: Constant 401 Error Logs

Post 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!
Attachments
config-2.png
config-2.png (47.58 KiB) Viewed 1105 times
trusted-networks.png
trusted-networks.png (7.27 KiB) Viewed 1105 times
User avatar
waltervl
Posts: 5859
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: (Solved) Zigbee4domoticz: Constant 401 Error Logs

Post 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).
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