DewGew / Domoticz-Google-Assistant

Google Assistant for Domoticz
https://github.com/DewGew/Domoticz-Google-Assistant/wiki
Apache License 2.0
79 stars 41 forks source link

Domoticz not connecting beacuse of 401 error #332

Closed znawcaphotona closed 1 year ago

znawcaphotona commented 1 year ago

Describe the bug:

Domoticz-Google-Assistant is not connecting to domoticz

Expected behavior:
i thought it's will connect to domoticz and work

Logs:

2023-06-25 19:36:28 - INFO - Connecting to Domoticz on http://127.0.0.1:8080
2023-06-25 19:36:28 - ERROR - Connection to Domoticz refused with error: 401 Client Error: Unauthorized for url: http://127.0.0.1:8080/json.htm?type=command&param=addlm=addlogmessage&message=Connected%20to%20Google%20Assistant%20with%20DZGA%20v1.23.8
2023-06-25 19:36:28 - ERROR - Service account key is not found. Report state will be unavailable
2023-06-25 19:36:28 - INFO - ========
2023-06-25 19:36:28 - INFO - Started DZGA v1.23.8 server at port 3030
2023-06-25 19:36:28 - INFO -
2023-06-25 19:36:28 - INFO -    Visit http://localhost:3030/settings to access the user interface
2023-06-25 19:36:28 - INFO -
2023-06-25 19:36:28 - INFO - =========
2023-06-25 19:36:28 - INFO - Visit the Actions on Google console at http://console.actions.google.com
2023-06-25 19:36:28 - INFO - Under Develop section, replace the fulfillment URL in Actions with:
2023-06-25 19:36:28 - INFO -    https://[your public url]/smarthome
2023-06-25 19:36:28 - INFO -
2023-06-25 19:36:28 - INFO - In Account linking, set the Authorization URL to:
2023-06-25 19:36:28 - INFO -    https://[your public url]/oauth
2023-06-25 19:36:28 - INFO -
2023-06-25 19:36:28 - INFO - Then set the Token URL to:
2023-06-25 19:36:28 - INFO -    https://[your public url]/token
2023-06-25 19:36:28 - INFO -
2023-06-25 19:36:28 - INFO - Finally press 'SAVE' and then 'TEST' button
2023-06-25 19:36:28 - INFO - =======

Desktop (please complete the following information):

DewGew commented 1 year ago

Do you have domoticz on the same computer as DZGA?

lec668 commented 1 year ago

@znawcaphotona: maybe watch out for the ${USER} part

I had the same trouble 1st time downloading the container as a regular user, as docker deamon runs as root

config file was created at first run in /home/root/Domoticz-Google-Assistant/config/ instead of /home//Domoticz-Google-Assistant/config/

leading to the situation described above/ message displaying every second about domoticz not connected, I was simply not modifying the correct config file

julric689 commented 1 year ago

Same issue, since update to last version.

2023-08-07 07:17:26 - INFO - Connecting to Domoticz on http://XXXXXXXXXXXXXX:9090 2023-08-07 07:17:26 - ERROR - Connection to Domoticz refused with error: 401 Client Error: Unauthorized for url: http://XXXXXXXXXX:9090/json.htm?type=command&param=addlogmessage&message=Connected%20to%20Google%20Assistant%20with%20DZGA%20v1.23.10

DZGA and Domoticz on the same PI

Domoticz version: 2023.2 Python Version: 3.7.3

DewGew commented 1 year ago

Activate 'allow basic-auth' then restart domoticz

https://www.domoticz.com/wiki/Security#API_Protection

julric689 commented 1 year ago

Activate 'allow basic-auth' then restart domoticz

https://www.domoticz.com/wiki/Security#API_Protection

Fixed for me

aurelhh commented 1 year ago

With Docker Same issue, no devices, no connection to domoticz, error: " error getting devices and settings" allow basic auth ok, back to 1.23.7 everything is ok

Xavier82 commented 1 year ago

Having the same issues: Domoticz-Google-Assistant is not connecting to domoticz 401 error

RPI3B Buster Domoticz: 2023.2 DZGA beta

updated DZGA to beta Enabled API Protection in Domoticz, saved new settings, restarted Domoticz, restarted DZGA, still the same issue, "can't connect to Domoticz"

updated and upgraded RPI, rebooted RPI

all no result, error keeps coming...

agapovmax commented 1 year ago

@Xavier82 please check next: Create new user in Domoticz, set password something 8 chars with *()&^%$ and add this creds to dzga config.yaml It helps me.

DewGew commented 1 year ago

_Since Domoticz has improved its security, you have to enable Allow Basic Authentication over plain HTTP in menu Security .
Its recomended to add a new user in Domoticz dedicated for DZGA and add devices to this user. See User Management._

Xavier82 commented 1 year ago

Got it working, enbled "Allow Basic Authentication over plain HTTP", thanks