Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access Tilboard outside Hassio #37

Open
amura11 opened this issue Dec 6, 2022 · 1 comment
Open

Can't access Tilboard outside Hassio #37

amura11 opened this issue Dec 6, 2022 · 1 comment

Comments

@amura11
Copy link

amura11 commented Dec 6, 2022

Description

Trying to access TileBoard from outside of Hassio shows a blank screen and the following error in the console:

DOMException: An invalid or illegal string was specified Possibly unhandled rejection: {}

This error seems to be an issue with the web sockets failing to connect. Debugging the code it appears that the window.WS_URL_OVERRIDE is set to null/api/websocket and will ignore any wsUrl value provided in the config file.

Steps to Reproduce

  1. Install the TileBoard Addon
  2. In the Configuration section, under Network add a valid port
  3. Access the TileBoard using <hassio-ip-or-url>:<port-from-step-3>

Notes

When looking at the page source it seems there is a line in the index.html file that is setting the url override: window.WS_URL_OVERRIDE = "null/api/websocket"; but looking at the TileBoard source this should be window.WS_URL_OVERRIDE = null;. If I put a breakpoint in the JS and change the override URL to null the page loads correctly.

Searching through this repository there is the direct.gtpl file that seems like it's supposed to handle the direct connection to TileBoard (as opposed to the ingress connection). In this file there is this chunk of code which seems like the culprit:

{{ if .websocket_url }}
    sub_filter 'WS_URL_OVERRIDE = null' 'WS_URL_OVERRIDE = "{{ .websocket_url }}/api/websocket"';
{{ end }}

But it seems like this shouldn't be executing as I haven't set .websocket_url as far as I know.

Environment

Below are my settings and the config I'm trying to get loading on my device.

config.js

var CONFIG = {
    serverUrl: "http://homeassistant.local:8123",
    wsUrl: 'ws://homeassistant.local:8123/api/websocket',
    authToken: "nOtMyReAlToKeN",
    pages: [
        {
            title: 'Home Page',
            icon: 'mdi-home-outline',
            header: DEFAULT_HEADER,
            groups: [
                {
                    title: 'Test Group',
                    items: [
                        
                    ]
                }
            ]
        }
    ]
}

Addon Settings

image

@rchl
Copy link
Contributor

rchl commented Dec 6, 2022

Related to resoai/TileBoard#827 I guess.

I don't have time to figure this one out. Ideally we should figure out if HA API provides some way to auto-detect it (like it did back when this was implemented).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants