CoolKit-Technologies / ha-addon

Apache License 2.0
261 stars 119 forks source link

Login to HA when running addon as docker container #42

Closed IRus closed 2 years ago

IRus commented 2 years ago

Related: https://github.com/CoolKit-Technologies/ha-addon/issues/30

I'm using the current version from master branch.

After entering HA login/password, I redirected back to 192.168.1.x:3000 and see toast: "Get device list failed"

In HA I see the following message in logs:

image

Server logs:

Could not connect to HA-WS, please restart addon
HA-WS heartBeat: -1
Could not connect to HA-WS, please restart addon
HA-WS heartBeat: -1
Could not connect to HA-WS, please restart addon
HA-WS heartBeat: -1
Could not connect to HA-WS, please restart addon
HA-WS heartBeat: -1
Could not connect to HA-WS, please restart addon
HA-WS heartBeat: -1
getDataSync: user.json ->  no data
getDataSync: user.json ->  no data
Could not connect to HA-WS, please restart addon
HA-WS heartBeat: -1
getDataSync: user.json ->  no data
getDataSync: user.json ->  no data
getDataSync: user.json ->  no data
getDataSync: user.json ->  no data
Could not connect to HA-WS, please restart addon
HA-WS heartBeat: -1

ha-addon: v1.2.3 Home Assistant 2021.10.6

ShaMAD commented 2 years ago

Have the same issue, "Get device list failed" after login to HA and eWeLink, and Login attempt in logs HA

How to use Long-Living Access Tokens (Auth option) in Docker version?

pitama commented 2 years ago

I find it, and its working. Add SUPERVISOR_TOKEN environment with that token.

ShaMAD commented 2 years ago

I find it, and its working. Add SUPERVISOR_TOKEN environment with that token. What do you mean by supervisor_token? When installed in Docker, HA does not have Supervisor mode.

pitama commented 2 years ago

Under your user profile, you can gerenate an Long-Living Access Token

ShaMAD commented 2 years ago

Under your user profile, you can gerenate an Long-Living Access Token

I can, but how do I use it in an addon without supervisor mode when installed via docker?

pitama commented 2 years ago

Under your user profile, you can gerenate an Long-Living Access Token

I can, but how do I use it in an addon without supervisor mode when installed via docker?

Ok. So. If you are here, you start the ewelink with dockr. You need define more one environment variable under the HA_URL, that is the SUPERVISOR_TOKEN, And give that the token, what you give from ha

truclk commented 2 years ago

I find it, and its working. Add SUPERVISOR_TOKEN environment with that token. But then it would use homeassistant:8123 which is incorrect URL. We need to edit configuration to use the correct URL as well. 3000/api/devices?type=7 {"error":302,"data":"http://homeassistant:8123"}

ShaMAD commented 2 years ago

I have same problem after while. Now i can't login or logout to ewelink account bacause after load page is redirected to unavalable page http://homeassistant:8123/auth/authorize?response_type=code&redirect_uri=http%3A%2F%2F192.168.91.8%3A3000&client_id=http%3A%2F%2F192.168.91.8%3A3000

DavidFFerreira commented 2 years ago

Hi, can u show how and where to do this?

Under your user profile, you can gerenate an Long-Living Access Token

I can, but how do I use it in an addon without supervisor mode when installed via docker?

Ok. So. If you are here, you start the ewelink with dockr. You need define more one environment variable under the HA_URL, that is the SUPERVISOR_TOKEN, And give that the token, what you give from ha

IRus commented 2 years ago

Hi, can u show how and where to do this?

Under your user profile, you can gerenate an Long-Living Access Token

I can, but how do I use it in an addon without supervisor mode when installed via docker?

Ok. So. If you are here, you start the ewelink with dockr. You need define more one environment variable under the HA_URL, that is the SUPERVISOR_TOKEN, And give that the token, what you give from ha

 docker run -d \
  --restart=always \
  --network host \
  -e HA_URL=http://192.168.1.100:8123 \
  -e SUPERVISOR_TOKEN=blablabla \
  ewelink_smart_home