Homebridge gives HTTP Status code 401 when starting

Moderator: leecollings

Post Reply
djpj12345
Posts: 4
Joined: Friday 19 January 2018 22:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Homebridge gives HTTP Status code 401 when starting

Post by djpj12345 »

Hello,

I just installed Homebridge using this page:
https://www.domoticz.com/wiki/Homekit_Siri

I followed it to the letter, but when I start homebridge and check the log, I see al lot of these messages:

0|homebrid | <html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
0|homebrid | [1/19/2018, 10:44:32 PM] [Domoticz] There was a problem connecting to Domoticz. (HTTP Status code 401)

It looks like a very clear message (authorization issue), but I'm not able to solve it. I tried:

- add my Domoticz userid/pass to the config.json file
- allow local networks without userid/password (via settings, in Domoticz)
- start homebridge as root, via sudo
- Try the SSL port instead of the default port 8080
- Change the 127.0.0.1 loopback address to the real ip address of the Pi

But nothing helps. I have googled, of course, but didn't find any solution that works for me.

Anyone who can help me?

My current config.json file:
Spoiler: show

Code: Select all

{
    "bridge": {
        "name": "Homebridge van Piet",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },
    "description": "Configuration file for Domoticz platform.",
    "platforms": [
        {
            "platform": "eDomoticz",
            "name": "Domoticz",
            "username": "pieter",
            "password": "xxxxx",
            "server": "127.0.0.1",
            "port": "8080",
            "ssl": 0,
            "roomid": 3
        }
    ],
    "accessories": [
    ]
}
Thanks in advance,
Pieter
djpj12345
Posts: 4
Joined: Friday 19 January 2018 22:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Homebridge gives HTTP Status code 401 when starting

Post by djpj12345 »

Ok, I found the solution myself. If someone else encounters the same issue: you have to provide userid/password in de config.json file, even when you exclude local addresses from the need of authentication.

To provide userid and password in de config.json, change the server rule to:

"server": "username:[email protected]",
stipe
Posts: 1
Joined: Tuesday 13 March 2018 23:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Homebridge gives HTTP Status code 401 when starting

Post by stipe »

I just register to say you: THANK YOU VERY MUCH GUYS!!!! you make my day!!!
Cdzn
Posts: 18
Joined: Monday 02 March 2020 10:09
Target OS: -
Domoticz version:
Contact:

Re: Homebridge gives HTTP Status code 401 when starting

Post by Cdzn »

djpj12345 wrote: Saturday 20 January 2018 12:45 Ok, I found the solution myself. If someone else encounters the same issue: you have to provide userid/password in de config.json file, even when you exclude local addresses from the need of authentication.

To provide userid and password in de config.json, change the server rule to:

"server": "username:[email protected]",
I would like o say thanks too. Thanks man! I can solve the problem after Your research!!!
digisaster
Posts: 6
Joined: Monday 28 November 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Homebridge gives HTTP Status code 401 when starting

Post by digisaster »

Thanks for pointing me in the right direction.
For me the solution was to include the loop-back in the security tab.

So i entered:

192.168.1.*;127.0.0.*

In the part:
Local Networks (no username/password):

And the homebridge can connect again.
neveride
Posts: 8
Joined: Saturday 30 March 2024 10:23
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Homebridge gives HTTP Status code 401 when starting

Post by neveride »

I registered on the forum, because this thread is the first result when people look for "Homebridge Domoticz 401". In my case the Domoticz user password contained '$' character. This character is used to depict variables in many scripting languages, so I thought this could be the problem and...it was it! After changing the password the communication works as expected.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests