home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.07k stars 587 forks source link

Device not connected to local push notifications #4363

Open kub3let opened 4 weeks ago

kub3let commented 4 weeks ago

Home Assistant Android app version(s): 2024.4.1-minimal (from f-droid)

Android version(s): 11

Device model(s): surya

Home Assistant version: core 2024.4.3

Last working Home Assistant release (if known):

Description of problem, include YAML if issue is related to notifications:

I'm making heavy usage of websocket push notifications (not using cloud integration!)

My Homeassistant instance is exposed publicly with my own domain via https and the app is set to Persistent connection: Always with only the external domain set, internal domain is left empty.

Every couple days they randomly stop working and if a automation is triggered it logs the following error in HomeAssistant 2024-04-22 16:20:48.366 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Error for call_service at pos 1: Device not connected to local push notifications

Just opening the app does not fix it, the app works but no push messages are received, it is not reconnecting automatically.

Killing the android app and opening it up again immediately fixes it but it usually takes me some time to notice the problem.

Restarting Homeassistant for example also works, in that case it reconnects just fine, I assume it's some weird edge case / deadlock.

Companion App Logs:

I just wiped and reinstalled the app in hope that it helps, I will add logs once the problem happens again.

Screenshot or video of problem:

Additional information:

dshokouhi commented 4 weeks ago

I just wiped and reinstalled the app in hope that it helps, I will add logs once the problem happens again.

yes please do add the logs they are required for troubleshooting this issue. We will need logs at the time of occurence.

When this happens does the persistent notification stay or disappears?

kub3let commented 4 weeks ago

When this happens does the persistent notification stay or disappears?

I actually don't since I had it hidden, I made it visible again to check on that.

Will update in the following days, thanks for the quick reply.

kub3let commented 3 weeks ago

@dshokouhi is it normal that the log only shows a couple minutes ? Whenever I checked it was just a couple minutes / hours not since the app start.

So I had the problem again 2 times, triggering a websocket message from homeassistant this time didn't even throw an error but it would still not pop up on the phone.

The persistent notification is displayed all the time.

As far as I can see from the logs the websocket ping seems to work.

image

Log during problem: homeassistant_companion_log_3-29-2024_10-13-28.txt

After killing Homeassistant App and starting it again it immediately works:

image

Log after restart: homeassistant_companion_log_3-29-2024_10-22-4.txt

dshokouhi commented 3 weeks ago

is it normal that the log only shows a couple minutes ? Whenever I checked it was just a couple minutes / hours not since the app start.

yes logs only generate for the provided UID the app gets which is controlled by the Android OS.

The persistent notification is displayed all the time.

As far as I can see from the logs the websocket ping seems to work.

Log during problem: homeassistant_companion_log_3-29-2024_10-13-28.txt

yup thats correct the pings are working which suggests the connection is still active. I think we may need some help from HA core now.