-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Problem using the dashboard in companion app #123
Comments
Hey man, honestly there's so many ways to add it, I host through the http server and just open it directly on my phone with a bookmark link, that way I Don't have to open the companion app at all I've also got this rendering through a custom card, and the addon is working just fine for me Do you see any logs either in the addon or the console of the browser that indicate what the issue is? |
I'm thinking it could be the iframe inside the iOS app. Will think of another approach, I like the way the companion app switches between internal/external url so will see if I can find a solution that works. Will let you know for future questions 😊 |
I have tested it with my wife's phone too and it is rendering and logging in fine, it might benefit you to check your logs within HA it might point you to the solution, I also remember another issue that was kind of related to this which might help you, maybe have a flick through closed issues and see if something stands out! |
I've seen some threads where people have problems with iframe in the companion app. Will try to do some remote debugging when I get the chance 😊 |
Last time this was reported to me through discord by one of the other contributors - he said But then again, mine is set to my phone and works fine :/ |
I don't get the URI error when changing from my homeassistant.local url to the ip address of the HA instance in the companion app, not rendering yet though. I'll continue investigating tomorrow evening 😊 |
I believe this can be the solution for the issue, I'm hoping they will release a new patch soon :) |
Nice! Looks like it was merged, that entire method seems extremely over simplified but i guess they don't care, it's been merged haha - i assume this will go out with the next patch - glad it wasn't something i've done wrong :D |
A small update on this one. After upgrading to the latest HA version, I now get to a login screen when navigating to the dashboard inside the companion app, but after a successful signin I end up in a 401 unauthorized state. Thinking there might be a problem with storing the credentials or similar within the app/iframe combination. It's a bit odd that it works in the browser though, where I don't have to sign in. Maybe iOS restrictions? |
I'll have to update when I get a chance, things have been a bit wild for me with work / life, I'm not exactly sure but I'll check the addon on my wife's phone after we update, after all, all it does is set the token to local storage and attempt to re-read, if you're getting a 401 that's even weirder that the token isn't authenticated, I'll check when I can man! |
No worries, I'll continue to investigate on my end. It does work in the companion app on Mac I just realized, so this seems to be isolated to the iOS app. Might be that Apple is a bit more restrictive there perhaps. Otherwise I'll try and kill the server in the app and set it up again to see if that makes any difference |
Just tried and can confirm its not letting me get passed login on my wife's phone either anymore, I'll have to remote debug when I get a chance if you've not solved it by then! This was working, but as we know, software changes and dependencies change independently, should be something silly that may not be supported on IOS! |
I've been experimenting with this this weekend and my closest attempt has been to create a custom card that mounts the react app as an es module. (I think that approach would be beneficial, since one could run a normal dashboard in panel mode and thus be able to make it the default dashboard). Unfortunately, in the companion app I once again get to the login form, but once I'm logged in, I get thrown back out to the login form again. Has been a bit hard to debug since it's from within an app, but I guess the problem is that the storing of credentials doesn't behave like in the context of a browser. Since we do have a valid session in the app itself, maybe a possibility could be to modify the HassProvider to optionally accept props, since I believe the hass object of home assistant contains the authorization stuff. But I haven't had time to look into that. |
Thanks for diving into this more, I do have an experimental addon that can render the Web app in a card, that is working on my wife's phone I haven't had time to look at it man I've been quite sick but I will when I can dude! |
Maybe this experimental addon is not ready for the real world, but if you want, you could perhaps privately share the code with me, might be that I can find some time during the evenings this week to experiment with it! |
Sure, I'll happily share it with you, the idea was to have card on a panel that would render full screen, and even cover the toolbars etc with another button to expand it / collapse it, just never really got any further with it 😉 |
Just added you as a collaborator on the repo - https://github.com/shannonhochkins/hakit-designer Honestly, this isn't anywhere close to production ready, the difference being this isn't rendered within an iframe, but rather on the lovelace dashboard itself The idea here was to basically have this card swap between a few different states
|
If you like, I can write up some proper acceptance criteria with the goal of this, even if you get it part of the way there, we might be able to deprecate the addon if the car works better in the long run |
Of course, always good to align! |
Installation and Configuration
HTML File Path Specification
Edit Mode Behavior
Normal Mode Rendering
Full Screen Mode
Path Validation
Rendering and Style Isolation
Compatibility and Performance
Hopefully this is clear enough - obviously i don't expect you to do all this, but if you want to, go for it! |
@shannonhochkins Has been a busy week, but I just found some time to clone the repo and check it out. For local development, I found a way to be able to skip the copy/paste steps.
http://0.0.0.0:5000/hakit-designer.js Then it will be loaded from the dist folder but served from the rollup dev server :) |
Oh that's wicked, nice find man I never really was able to spend too much time on it! That will make the experience much nicer for sure! |
I haven't forgotten about this - been very busy with personal life and will get to this soon! |
Going to close this for now @jenseo I've made a bunch of refactors to the HassConnect / Provider around authentication and it should be resolved assuming the iframe is of the same origin and or storage is not full. Release notes |
Awesome work, for some reason my other fixed had stopped working, I'll give this a try shortly |
Do you mind explaining what has stopped working for you? |
Accessing the dashboard from my tablet, but I can say that after updating to the latest and greatest, everything now works very well 🚀 |
Perfect! Sounds like the adjustments made to the auth flow fixed it for you! Thanks for reporting back! |
Describe the bug
When using the HAKIT addon to add my dashboard to the sidebar, I get
Invalid redirect URI
as an error message when I try to visit it in the companion app . This when accessing the local instance.When I visit the cloud instance through Nabu Casa, the dashboard loading animation spins up, but it never renders the dashboard.
To Reproduce
Steps to reproduce the behavior:
Additional context
I'm thinking this might be a problem with the lack of a local SSL certificate in my case. Since I run Nabu Casa when being out of the house, I haven't bothered adding a local SSL certificate.
I'm thinking maybe the allowNonSecure param might be doing something fishy perhaps, when it's loaded over SSL in the companion app? Although then it should work when running it on the local network I guess.
A bit puzzled here, not sure if this is the best approach to add the dashboard to HA? Is the addon still the suggested approach? I was thinking maybe I could create a custom panel for it otherwise, but haven't explored it yet
The text was updated successfully, but these errors were encountered: