NickM-27 / swatch-hass-addon

Color detection in images to capture presense of known objects.
Apache License 2.0
6 stars 1 forks source link

Broken reference to flutter.js #6

Open niesink opened 1 year ago

niesink commented 1 year ago

When opening the Swatch UI (e.g. at http://192.168.1.123:8123/69755fa6_swatch/dashboard) it tries to load in flutter.js from http://192.168.1.123:8123/flutter.js where it isn't found, resulting in no UI. I'm not really familiar with HASS addons, but I believe it'll be located at something like http://192.168.1.123:8123/api/hassio_ingress/..?../flutter.js?

niesink commented 1 year ago

@NickM-27 I'm asking this with the best possible intentions, is there any chance of this being fixed in the near future or might I be better off looking for an alternative add-on?

In case it helps, this comment in the html that's served might be related:

<iframe title="Swatch" src="/api/hassio_ingress/Xkafe3tYTLMEPX_OmnKYdnxHHzj5oSpDszs6DCUUox4//">
<html>
<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    For more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

    This is a placeholder for base href that will be replaced by the value of
    the `--base-href` argument provided to `flutter build`.
  -->
  <base href="/">

   ...[snip]...

  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer=""></script>
</head>
<body>
  ....
</iframe>

It tries to load flutter.js from https://example.ui.nabu.casa/flutter.js which results in a 404, but when I point my browser to https://example.ui.nabu.casa/api/hassio_ingress/Xkafe3tYTLMEPX_OmnKYdnxHHzj5oSpDszs6DCUUox4/flutter.js it does succesfully return the contents of flutter.js

NickM-27 commented 1 year ago

This isn't a bug that needs to be fixed, it is a feature request. Swatch does not support ingress so if you want to use it in the addon you need to access it as http://192.168.1.123:4500

niesink commented 1 year ago

Aah, awesome, indeed that works! Thanks!

This might be something to add to a DOCS.MD file and if I understand this correctly setting ingress to false here might prevent the 'Open Web UI' button from showing up in the addon's info panel in HA? 🤔

Either way, thanks again for clearing things up and the work you do on this and other projects.

NickM-27 commented 1 year ago

Weird, I definitely thought I set that to false, anyway hopefully that helps future users.