codechimp-org/ha-menu

problem to setup HA menu

pilot1981 opened this issue ยท 21 comments

Hi,
I follower wiki instruction but I don't see any switches and I think there is some problem with connection to my HA instance.

this is UI of HA Menu:

Schermata 2019-11-22 alle 09 19 41

and this is my troubleshooting output:

$ curl -i https://danielevelardi.duckdns.org:8123 -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjNDdiMjRlZGFjODE0MDQ2YWUxYzc4NTZmNjE2MGI0ZCxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 3086
Date: Fri, 22 Nov 2019 08:16:53 GMT
Server: Python/3.7 aiohttp/3.6.1

<style>body{font-family:Roboto,sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:400;margin:0;padding:0;height:100vh}</style><title>Home Assistant</title><style>#ha-init-skeleton::before{display:block;content:"";height:112px;background-color:#03A9F4}</style>
<script>function _ls(e){var t=document.documentElement,s=t.insertBefore(document.createElement("script"),t.lastChild);s.defer=!0,s.src=e}window.Polymer={lazyRegister:!0,useNativeCSSProperties:!0,dom:"shadow",suppressTemplateNotifications:!0,suppressBindingNotifications:!0},"customElements"in window&&"content"in document.createElement("template")||document.write("<script src='/static/polyfills/webcomponents-bundle.js'><\/script>");var isS101=/\s+Version\/10\.1(?:\.\d+)?\s+Safari\//.test(navigator.userAgent)</script><script type="module" crossorigin="use-credentials">import "/frontend_latest/core.f63e676b.js";
  import "/frontend_latest/app.38af62d9.js";
  import "/frontend_latest/hass-icons.53a6eeed.js";
  window.customPanelJS = "/frontend_latest/custom-panel.99a8af4b.js";</script><script nomodule>(function() {
    // // Safari 10.1 supports type=module but ignores nomodule, so we add this check.
    if (!isS101) {
      window.customPanelJS = "/frontend_es5/custom-panel.aeb4b321.js";
      _ls("/static/polyfills/custom-elements-es5-adapter.js");
      _ls("/frontend_es5/compatibility.8b90988f.js");
      _ls("/frontend_es5/core.fa29f9d2.js");
      _ls("/frontend_es5/app.ab5d8bbe.js");
      _ls("/frontend_es5/hass-icons.37d005f7.js");
      }

Related to issue #24
I can now replicate the issue but this is going to take some time.

I found that adding a trailing slash in preferences causes this. Ensure your server is
http://yourip:8123 only
Added a fix in version 1.6

my problem isn't related to slash...

now at version 1.6 I have this situation

I have some problem to see output of HA menu:
Schermata 2019-11-22 alle 17 31 40

and some other times I see this error:

Schermata 2019-11-22 alle 17 34 47

I'll have to spend time adding a lot more error handling in this to be able to easily diagnose what issue your having rather than just guessing. I'll work on a new version next week.

Hi,
I update to v.1.7; this is the result:
Schermata 2019-11-24 alle 19 59 24

please re-open this ticket; I'm unable to do it!

That indicates an incorrect URL, see you are using duckdns. Try your direct ip to start with.

I'm seeing the same problem, using my duckdns OR internal ip

http://192.168.xx.54:8123
https://xxxxxxxxxxx.duckdns.org

When pasting those 2 url's in browser
Schermafbeelding 2019-11-26 om 11 02 18

Also when clicking on Open Home Assistant I get redirected to a login page
Schermafbeelding 2019-11-26 om 11 04 29

I'm on v1.7(7)

That would indicate there's something wrong with the data returned from the API. The proper curl statement to test the API is as follows.
curl -i http://YOURIP:8123/api/states -H "Authorization: Bearer YOURTOKEN" > apitest.txt

This will save the output to a file in your current folder (usually user home folder if new terminal).

That should return json which is in the following structure
https://developers.home-assistant.io/docs/en/external_api_rest.html#get-apistates

Whilst this data probably contains lots of information you won't want to share, if HA is returning something odd in this then that will trip up the parser. If you obscure sensitive stuff and share then I can read through and try and spot something.

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 411991
Date: Tue, 26 Nov 2019 10:49:26 GMT
Server: Python/3.7 aiohttp/3.6.1
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 411991
Date: Tue, 26 Nov 2019 10:49:26 GMT
Server: Python/3.7 aiohttp/3.6.1

There should be a LOT more than that returned, it's basically acknowledging the API call but returning nothing about state.
I've never seen this not enabled by default but trying adding the API component to configuration.yml

https://www.home-assistant.io/integrations/api

Yes there is a lot more... too much to search for sensitive stuff

if you let me know what to look for.....

Unfortunately the parser has to work through everything, so if something is wrong with an element I'm not even interested in it could still trip it up.
email is andrew@codechimp.org if you deem it non-sensitive enough to share directly. It does not contain connection details/secrets, only the names/states of devices.

I've mailed you the .txt file

I've mailed you the .txt file

Thanks, just received. That's exactly the type of data I'm expecting to be returned so connection URL and token are working fine.
I'll run that data manually through the parser when I'm at home tonight and see what error it throws.

Pretty sure I'll be able to diagnose this weird issue now.

Having that sample data made it trivial to track this down.
V1.8 just released should hopefully finally fix this.

I'll await feedback before closing.

I can confirm v1.8 is working for me

Chiming in another confirmation here too! Thanks @andrew-codechimp

Thanks for confirmations and sticking with this. My HA instance isn't as complex as others it seems and I'm still learning a lot. It's taught me a lot solving this one and made the app more defensive/cleaner in the process.

Hi,
I can confirm v1.8 solve all my problems.

thanks