home-assistant / android

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

WearOS - tiles / sensors are not working-updated when phone is on mobile data and wifi on watch is not connected #3863

Closed sfortis closed 1 year ago

sfortis commented 1 year ago

Home Assistant Android app version(s):

Android version(s): 13 / wearos 4 / oneui 5

Device model(s): galaxy watch 5

Home Assistant version: 2023.9.2

Last working Home Assistant release (if known):

Description of problem, include YAML if issue is related to notifications: Tiles and sensors are not working when phone is on mobile data and wifi is not connected on watch. There is no connectivity issues, HA on android phone is working perfectly, background access is granted, sensors are getting updated but it seems that watch companion app is trying to connect thru wifi interface which is disconnected.

At the same time, If i open the watch companion app everything is fine. The problem based on the watch logcat is located on tiles / sensors.

Companion App Logs: 09-14 07:00:05.255 17482 27194 E SensorReceiver: io.homeassistant.companion.android.common.data.integration.IntegrationException: java.net.ConnectException: Failed to connect to ha.*******.net/***.67.138.190:443 09-14 07:00:05.255 17482 27194 E SensorReceiver: Caused by: java.net.ConnectException: Failed to connect to ha.********.net/***.67.138.190:443 09-14 07:00:05.255 17482 27194 E SensorReceiver: Suppressed: java.net.ConnectException: Failed to connect to ha.********.net/*.21.62.194:443 09-14 07:00:05.255 17482 27194 E SensorReceiver: Caused by: java.net.ConnectException: failed to connect to ha.********.net/*.21.62.194 (port 443) from /192.168.167.239 (port 54038) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused) 09-14 07:00:05.256 17482 27194 E SensorReceiver: Caused by: java.net.ConnectException: failed to connect to ha.*******.net/***.67.138.190 (port 443) from /192.168.167.239 (port 33244) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused) 09-14 07:00:08.428 17482 17482 E TileActionReceiver: io.homeassistant.companion.android.common.data.integration.IntegrationException: java.net.ConnectException: Failed to connect to ha.********.net/***.67.138.190:443 09-14 07:00:08.428 17482 17482 E TileActionReceiver: Caused by: java.net.ConnectException: Failed to connect to ha.********.net/***.67.138.190:443 09-14 07:00:08.428 17482 17482 E TileActionReceiver: Suppressed: java.net.ConnectException: Failed to connect to ha.********.net/*.21.62.194:443 09-14 07:00:08.428 17482 17482 E TileActionReceiver: Caused by: java.net.ConnectException: failed to connect to ha.*********.net/*.21.62.194 (port 443) from /192.168.167.239 (port 54046) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused) 09-14 07:00:08.433 17482 17482 E TileActionReceiver: Caused by: java.net.ConnectException: failed to connect to ha.********.net/***.67.138.190 (port 443) from /192.168.167.239 (port 33252) after 10000ms: isConnected failed: ECONNREFUSED (Connection refused) 09-14 07:00:12.372 17482 17482 E TileActionReceiver: io.homeassistant.companion.android.common.data.integration.IntegrationException: java.net.ConnectException: Failed to connect to ha.********.net/***.67.138.190:443

Screenshot or video of problem:

Additional information:

dshokouhi commented 1 year ago

Failed to connect is not really an error the app can solve. This is typically solved on the network end like maybe enabling NAT loopback.

sfortis commented 1 year ago

@dshokouhi There is no connectivity/network issue, everything is OK when i open the watch companion app (phone app is working great from every network). The connectivity errors are coming only from watch and tiles / sensors. (essentially background processes).

Additionally there is no NAT involved, im connected via cloudflare tunnel (cloudflared addon).

dshokouhi commented 1 year ago

The app doesn't handle connectivity like that. Wear OS does it's own proxying here as you can see in the logs.

If it's happening in the background then try checking the battery optimizations setting inside the Samsung companion app for the watch. It's going to be separate setting than the phone app.

sfortis commented 1 year ago

Yes i see the tunneled ip should be 192.168.167.239, but where is the battery optimization on watch app? I don't see any related settings. Also i've a feeling that this started after the oneUI 5.0 update on watch 2-3 days ago (which ,btw ,decreased significantly the vibration when pressing a tile, but its another story).

09-14 06:58:20.628 522 1414 D VibratorManagerService: vibrate - uid: 10136, opPkg: io.homeassistant.companion.android, effect: Mono{mEffect=Composed{segments=[Prebaked{effect=CLICK, strength=MEDIUM, fallback=true}], repeat=-1, mMagnitudeType=TYPE_EXTRA}}, attrs: VibrationAttributes: Usage=UNKNOWN Audio Usage= USAGE_UNKNOWN tags= Flags=0, reason: null, token: android.os.BinderProxy@87797d0

** update, found it on "Galaxy Wearable" app -> Device care --> Battery. Home assistant is not included in the list with sleeping apps and background activity toggle is enabled.

jpelgrom commented 1 year ago

Also i've a feeling that this started after the oneUI 5.0 update on watch 2-3 days ago (which ,btw ,decreased significantly the vibration when pressing a tile, but its another story)

For the record, I do not see this issue with Wear OS 4 / One UI 5.0 Watch on my Galaxy Watch 4. Could still be update related but not just the update.

Vibration change can happen: the app asks the system to vibrate for a 'click', if Samsung changed the vibration for a click that also affects the app.

sfortis commented 1 year ago

This is strange because until some days ago it was fine and really nothing else was changed. My HA/network setup is rock stable so i don't have much to do there :).

Vibration, is not a real issue. You can barely feel it now in tile press, but its not my concern.

sfortis commented 1 year ago

So i reset the watch and tiles are back in business! Thank you all for your prompt replies!

ciclapt commented 1 year ago

So i reset the watch and tiles are back in business! Thank you all for your prompt replies!

What do you mean by resetting? Factory reset? I'm having the same problem...

sfortis commented 1 year ago

So i reset the watch and tiles are back in business! Thank you all for your prompt replies!

What do you mean by resetting? Factory reset? I'm having the same problem...

Yes, a factory reset did the trick for me.