Home Assistant, ReferenceError: auth is not defined
-
Looks like you are using the wrong kind of access token. The instructions specify that you have to use a long-lived access token, and these are usually very long on Hass. Yours is very short (at least, much shorter than the LLATs I've seen on my own system). Did you use a Long-Lived Access Token?
@toggledbits said in Home Assistant, ReferenceError: auth is not defined:
Looks like you are using the wrong kind of access token. The instructions specify that you have to use a long-lived access token, and these are usually very long on Hass. Yours is very short (at least, much shorter than the LLATs I've seen on my own system). Did you use a Long-Lived Access Token?
The lengts seems random I think.
I did 3 tokens, first one super long.
When it didn't work i created another one, in first post.
Now I created the third one, and this became super long, and it works. -
Hi! My HA does not connect either. I get a "websocket error" over and over again. This is my reactor.yaml:
- id: hass enabled: true implementation: HassController name: Home Assistant config: source: 'ws://192.168.50.167:8123' access_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI0ZDg4MzVjZmJkMjQ0ODYwODZhYzc1ZTExZDk2MGU1OSIsImlhdCI6MTYxNTczMzMyMSwiZXhwIjoxOTMxMDkzMzIxfQ.eMGyHpM"
-
In CMD it looks like this:
2021-03-14T15:20:27.492Z HassController:NOTICE HassController#hass attempting reconnection to ws://192.168.50.167:8123/api/websocket
2021-03-14T15:20:27.492Z HassController:NOTICE HassController#hass connecting to ws://192.168.50.167:8123/api/websocket
2021-03-14T15:20:27.501Z HassController:WARN HassController#hass socket error during open: Error: socket hang up
2021-03-14T15:20:27.502Z HassController:NOTICE HassController#hass socket to ws://192.168.50.167:8123/api/websocket closed during open
2021-03-14T15:20:27.505Z HassController:ERR HassController#hass connect error with ws://192.168.50.167:8123/api/websocket: websocket error
2021-03-14T15:20:27.505Z HassController:WARN HassController#hass failed to connect/initialize communication: websocket error -
Make sure you have the websocket API enabled in your Hass configuration.
-
That's all that's necessary. I also add the documented
sensor
lines so I can see how many connections are active, but it's not strictly necessary to functionality. -
I'm afraid it doesn't work @toggledbits. Shouldn't there be anything after the ":", an IP-adress or something?
@fanan said in Home Assistant, ReferenceError: auth is not defined:
Shouldn't there be anything after the ":", an IP-adress or something?
If you are referring to the "websocket-api:" line in your Home Assistant configuration, no, that line stands by itself. It needs to be properly formatted and placed in your HomeAssistant configuration file. Check your HomeAssistant log for any errors related to its configuration file.
Oh, and just to make sure I've asked, are you keeping up with the builds? Are you testing on the latest build?
Ref: https://www.home-assistant.io/integrations/websocket_api/
-
@toggledbits ; Just a stupid question, since I´m kind of new to this.... Do I have to install the websocket api? I have HACS installed and have tried to add it to the custom resporitories. I tried to add the URL:
I don't want to waste your time with these newbie questions, but after hours and days of failure, I´m becoming desperate... 🥴 -
I just installed Hass via docker, and all I needed to do was add that line to my Hass config and generate the Long-Lived Access Token and everything connected right up. I've never had a problem connecting to Hass, and I didn't have to install anything additional. This is what my configuration file looks like:
# Configure a default setup of Home Assistant (frontend, api, etc) default_config: http: server_host: 0.0.0.0 websocket_api: sensor: platform: websocket_api group: !include groups.yaml automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml
-
T toggledbits locked this topic on