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

Widget update when screen on while not connected #1120

Closed
engrbm87 opened this issue Oct 29, 2020 · 14 comments · Fixed by #1122
Closed

Widget update when screen on while not connected #1120

engrbm87 opened this issue Oct 29, 2020 · 14 comments · Fixed by #1122
Labels
bug Something isn't working widget

Comments

@engrbm87
Copy link

Home Assistant Android version:
beta-482-b97a69a
Android version:
10
Phone model:
OnePlus 6t
Home Assistant version:
0.117
Last working Home Assistant release (if known):

Description of problem:
Following PR #1115 every time the screen is unlocked while there is no connection to HA the entity widget shows 'null' and a toast notification is displayed saying: unable to fetch data for configured entity.
I recommend that the widget only gets updated when the screen turns on if there is a connection to HA. Otherwise it should keep the last value (perhaps with an indication that this is not up to date). As for the toast notification I don't recommend displaying it every time the screen turns on.

Traceback (if applicable):


Screenshot of problem:

Additional information:

@engrbm87 engrbm87 added the bug Something isn't working label Oct 29, 2020
@dshokouhi
Copy link
Member

We need a way to tell the users that we couldn't update the widget. If we remove the toast then they have no way knowing it failed. We also only store entity information to retrieve the data. We added a toast recently to tell users when there is a problem updating widgets. You should not see this error unless your HA server is unreachable. At which point the error is informative.

@engrbm87
Copy link
Author

I understand that the error appears when HA server is unreachable. In case for example the phone is not connected to wifi or mobile data this error will show up every time the phone is unlocked. For me, I don't like to keep seeing a toast notification every time I unlock my phone.

@dshokouhi
Copy link
Member

dshokouhi commented Oct 29, 2020

So the issue with the text coming in as null has always been there but is now more prominent since we attempt to update via the screen on event. It looks we will have to store the state information to our local db in order to avoid this issue because widgets are write-only and we can't read from them before the update. Once a widget is told to update it must provide an update.

Regarding the toast message I can make it show up only if an active network connection is present. Then it will show up if it can't connect to HA. If HA is down for a long period of time then this error will continue to show.

One thing I will try to do is skip the entire update if an active connection is not present, that may correct both issues here :)

@dshokouhi
Copy link
Member

@engrbm87 just submitted a fix for when the network connection is not active, the error will still appear if HA is unreachable. If we need to do any extra handling there then we will need to take that on as part of #1033

@dshokouhi
Copy link
Member

@engrbm87 would you find it useful if widgets updated when the network connection is restored? Trying to find ways to make them feel more up to date :)

@engrbm87
Copy link
Author

That would be great. But I think it should only update if there is a successful connection to HA. Otherwise, if network is back but no connection to HA then just show a notification.
Once connection is established with HA show another notification that connection is back and update the widget.

@theCheek
Copy link

theCheek commented Nov 7, 2020

I'm getting this toast message even though I don't have any widgets installed. Running v3.0.0-full on Android 11 (Pixel 3XL) if it helps.

@EdwinekVG
Copy link

Same as with @theCheek here, I'm getting these messages all the time and I don't even have a widget on my home screen. It looks like I even get two in very quick succession.

This is extremely annoying.

Maybe interesting to know that I did have a widget until this morning, but removed it before updating to 0.117.5. I've tried rebooting and deleting cache, but that didn't make any difference. I'm running v3.0.0-full on Android 11 (Pixel 4 XL).

@JBassett
Copy link
Collaborator

JBassett commented Nov 7, 2020

@theCheek and @EdwinekVG if you go into App Configuration -> Manage Widgets do you see widgets listed there? If you don't have any widgets this should be empty, if you see records open and delete them.

@theCheek
Copy link

theCheek commented Nov 8, 2020

@theCheek and @EdwinekVG if you go into App Configuration -> Manage Widgets do you see widgets listed there? If you don't have any widgets this should be empty, if you see records open and delete them.

Thanks for this. Yes I had one widget listed there that I must have added to my home screen a while back but then removed. The toast seems to have stopped now so all good.

@EdwinekVG
Copy link

@theCheek and @EdwinekVG if you go into App Configuration -> Manage Widgets do you see widgets listed there? If you don't have any widgets this should be empty, if you see records open and delete them.

Thanks for that, I never knew. There were three switches and two entity widgets, I've deleted them now. I hope that's enough to solve this.

@teemujalonen
Copy link

teemujalonen commented Nov 18, 2020

I'm connecting to HA using zerotier, and for some reason I was getting these toast messages every time when the screen was unlocked. So it seems that this update made widgets unusable for me. I'm ok with that, but I don't think that it was the intention for this change.

And why doesn't the toast message say that the message comes from HA? Suddenly these started showing up, and I didn't know which app they are coming from (Samsung Galaxy S10e)

Edit: nevermind, figured out what was going on when reading #1164

@RonSpawnson
Copy link

Piling on - this is super annoying for me - it constantly draws this warning toast over my other applications over and over and over while I'm trying to use my phone. I'm debating removing the widgets entirely as this is unusable as-is sadly.

@teemujalonen
Copy link

Yeah, I removed my widgets already. Toast is so annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working widget
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants