HA widget (entity status) not updating

I have two android phones (Samsung), and have installet HA companion app on both of them. It connects fine and cards with info updates as expected.

However, when I’m creating a widget supposedly showing entity status, only one of the phones updates “instantly” when the status change, whereas the other only updates when you tap the widget.

I have tried “everything”. Yes, background run is allowed, Yes, datasaver is disabled for the companion app, Yes all permissions has been set…

I have no idea why this is happening on only one of the phones (they are different models), and I’m kind of lost here.

Anybody with any ideas?

Thomas

check the companion app logs on the device having issues to see if there is a failure

I see a lot of:

2022-12-29 16:17:46.017 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547804355200] Error handling message: Unauthorized (unauthorized) from x.x.x.x (Home Assistant/2022.12.0-3026 (Android 11; SM-A805F))

2022-12-29 16:24:16.980 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547831596896] Error handling message: Unauthorized (unauthorized) from y.y.y.y (Home Assistant/2022.12.0-3026 (Android 11; SM-A805F))

where x.x.x.x and y.y.y.y are a mix of addresses.

Unauthorized is definitely the cause. Please start fresh to clean things up.

I have done that just about 99 times, with the exact same result every time. I can open the fresh Companion app, go through the installation with tracking and everything. The companion app itself works flawlessly and so does tracking. No error messages.

The second I try to add a widget, I start getting unauth messages. The call service widget work flawlessly and the entity state widget only works when i tap it. No auto update on state change (which is my problem).

When I start from fresh I do the following:

  1. Close the companion app
  2. Go to app data and clear out both data and cache
  3. Go to home assistant (server) and clear out the phone entity
  4. Restart home assistand server - and wait for it to come online
  5. Open companion app again, it prompts for URL to server etc.
  6. Log in with my wifes account (non-admin)
  7. Everything works - autoupdate on cards works inside the compagnion app
    (at this point no error messages in the server log)
  8. Create a widget
    (unauth messages start to appear in the server log)…

When I do the same on my phone, everything works as expected. Both phones are samsung/android although different models.

My server-url is an external url and my router does local redirect. I have port forwarded 8123 to my raspberry pi. No SSL involved yet.

The action button works on both phones both internally and externally - it is only the auto-update that doesn’t work.

So you are removing the integration right? Did you check to see if there is more than 1 from the same device that needs to be removed?

Maybe check to see if the websocket from the app is being blocked on the network. This works different from the frontend for widget updates.

Have you also checked companion app logs for errors? The logs you posted above are from HA core and not the app directly. You need to go to Settings > Companion App > show and share logs to get the actual on device logs which may show the actual issue.

I still have the issue. So, to rule out basically everything, I started from fresh - I removed the user, the person, the device, cleared data and cache so there was no trace of the app on the phone nor the server.

I set up a SSL tunnel with cloudflare, so now everything is running https and there are no port forwards.

I can still use both the app and the widgets on my phone, without any log entries on the server.

Then i created a new user/person pair and reinstalled the companion app on the troublesome phone. Logged in and navigated around in the app - everything works, and the server log is empty.

Then i created a widget (entity status) and immidiately i get the “unauthorized” error in the server log and it repeats itself everytime i turn on/off the screen, which makes sense.

I then collected the log from the phone which is included - clearly there is something about web-services not connecting, but why?

Thanks for any input.

Link to companion app log file: Companion app log file

Are there any Experts out there, that could take a look at the log?

I’m lost here…

Thanks.

Same issue there.

in your case the websocket is having an issue authenticating, REST seems to be fine. You should allow all API traffic to your HA system.

what error do you see in the companion app logs?

I’ve some good news for you, and of course for me :stuck_out_tongue:

I’ve compaired both log files and found the ‘culprit’.

01-30 03:29:44.532 27316 27316 D ButtonWidget: Broadcast action: android.intent.action.SCREEN_ON

You will need to switch on the sensor ‘Interactive’ in the companion app settings>Companion App>sensors>Manage Sensors>Power Sensors>‘Enable sensor’

I have also enabled the sensor ‘Sleep Confidence’ under ‘Activity Sensors’, just to make sure.

After enabling those two sensors, the widgets started to immediately updating automatically. :slightly_smiling_face:

1 Like

It works !!!
Life saver thx a lot @Giovanni85

:heart_eyes: