home-assistant / android

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

Internal URL - HA Android app seems to stop responding in certain areas of the app every 24 hours around #4524

Closed thewookiewon closed 1 month ago

thewookiewon commented 1 month ago

Home Assistant Android app version(s): 2024.7.3-full Android version(s): 14 Device model(s): Galaxy S24 ultra Home Assistant version: Core 2024.7.2 Supervisor 2024.06.2 Operating System 12.4 Frontend 20240710.0 Last working Home Assistant release (if known): NA Description of problem, include YAML if issue is related to notifications: Using a Raspberry Pi 5 with POE+ hat and NVME base plate. The SSD was flashed with HA using raspberry pi image.

I’ve started to notice an odd issue whereby HA Android app seems to stop responding in certain areas of the app every 24 hours around. Any automations run at expected, the issue resolves itself in time but I’ve not yet pin pointed a time when.

I can’t access things like logs during this issue, in the app, I know when the issue occurs because Settings > home assistant cloud will show as “loading” (see photo).

Only seems to be written in on my home wifi, switching to mobile then force wuiting the app resolves the issue. I'm using the home WiFi SSID (broadcast on multiple APs) to determine internal URL.

I can see this in the companion app logs WebSocketRepository: kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 30000 ms

Companion App Logs: homeassistant_companion_log_6-18-2024_17-4-22.txt

Screenshot or video of problem: 324284172-6a480bbd-fb48-44ec-b7be-f5a0af1a9477

Additional information:

thewookiewon commented 1 month ago

Worth noting I don't use Home Assistant cloud

dshokouhi commented 1 month ago

Do you see the same issue in Chrome for Android on the same device?

thewookiewon commented 1 month ago

I've only noticed it through the HA app, haven't tried via android Web browser yet.

My mac on the same home WiFi connects fine, I'm away atm so connecting with external URL which always works.

dshokouhi commented 1 month ago

Is the only issue you see about the cloud loading or is there something else?

thewookiewon commented 1 month ago

If I can't access certain areas of the android app or the area just gives a spinning circle, 99% of the time the home assistant cloud menu will say loading

dshokouhi commented 1 month ago

can you tell us anythig else about your networking setup? the timeout error is not one the app can fix

dshokouhi commented 1 month ago

judging by the logs some calls are successful and others are not which points to a possible networking issue. Have you tried restarting things like HA host, router, proxy etc...?

thewookiewon commented 1 month ago

Ubiquiti network (WiFi APs and switches) Firewalla Gold+ router

No VPN used, the Pi5 is on a IoT VLAN, different subnet with outbound connections blocked to my personal VLAN

Personal VLAN is allowed inbound to IoT VLAN

thewookiewon commented 1 month ago

So I've enabled bi-directional flows between my phone and the Raspberry pi5 which seems to be holding steady and fault free so far.

Sounds like HA isn't always responding back on the same connection request from the phone and initiates a separate outgoing request to my phone which is blocked by the firewall.

dshokouhi commented 1 month ago

at least for the app the internal and external URL are used with the same APIs and connection methods, the only thing that changes is when we use each URL. Given that this seems to be a local networking issue I am going to close this issue for now.

thewookiewon commented 1 month ago

@dshokouhi I don't think this issue is purely my internal network, I think I'm looking at a NAT hairpin issue.

Accessing my Home Assistant URL whilst on my home network doesn't work, so I need to look at that issue BUT I'm on my home Wi-Fi so it should be using the internal address which is IP based and that is accessible on my android device.

dshokouhi commented 1 month ago

if you havent already seen it check https://companion.home-assistant.io/docs/troubleshooting/networking

Also check the companion app logs we will print the decision making process for using the internal or external URL. For example if wifi has no data/internet then external URL may be prefered

thewookiewon commented 1 month ago

I have read that, my router does support NAT hairpin so waiting to hear from their support team.

I'll have to check the logs when it occurs again, is there anything specific to mesh networking to consider? Multiple APs but same WiFi SSID

thewookiewon commented 1 month ago

I also forgot to say I'm using the cloudflare tunnel integration for my home assistant url