Phone state never shows ringing

I think so…

yea looks like its setup, its possible the app may have crashed as the logs from teh companion app do not cover the gap

I can consistently reproduce the issue but I don’t know how to detect if the app crashed. Let me know what else to check.

if you open the app again and it loads from the start instead of where you last left it. Also if the logs dont keep accumulating.

The Pixel 6 was left on overnight as usual. The first entry in the companion log was at 06:48 this morning (the approx. time the phone was starting to be used again). HA Host, Supervisor, and Core logs looked ok.

Did some more testing. The phone does not appear to be crashing - the companion app logs seem to contain only the last ~1.5 hours of activity.

MA Pixel companion app log does show the received intent.

11-30 12:58:49.586  9188  9188 D SensorReceiver: Received intent: android.intent.action.PHONE_STATE
11-30 12:58:49.587  9188  9188 D MediaPlayCtrlsWidget: Broadcast received: 
11-30 12:58:49.587  9188  9188 D MediaPlayCtrlsWidget: Broadcast action: android.intent.action.SCREEN_OFF
11-30 12:58:49.587  9188  9188 D MediaPlayCtrlsWidget: AppWidgetId: -1
11-30 12:58:49.587  9188  9188 D SensorReceiver: Received intent: android.intent.action.PHONE_STATE

But the HA mobile app debug log does not show receiving the webhook payload from MA Pixel (only Marks Pixel)

2023-11-30 12:56:25.588 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from Marks Pixel for type get_config: {}
2023-11-30 12:56:25.901 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from Marks Pixel for type update_sensor_states: [{'unique_id': 'battery_temperature', 'state': 27.1, 'type': 'sensor', 'icon': 'mdi:battery', 'attributes': {}}, {'unique_id': 'battery_power', 'state': -5.54, 'type': 'sensor', 'icon': 'mdi:battery-minus', 'attributes': {'current': -1.451722, 'voltage': 3.818}}, {'unique_id': 'phone_state', 'state': 'offhook', 'type': 'sensor', 'icon': 'mdi:phone-in-talk', 'attributes': {}}]
2023-11-30 12:56:43.517 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from Marks Pixel for type get_config: {}
2023-11-30 12:56:43.789 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload from Marks Pixel for type update_sensor_states: [{'unique_id': 'battery_temperature', 'state': 27.2, 'type': 'sensor', 'icon': 'mdi:battery', 'attributes': {}}, {'unique_id': 'battery_power', 'state': -4.81, 'type': 'sensor', 'icon': 'mdi:battery-minus', 'attributes': {'current': -1.256409, 'voltage': 3.828}}, {'unique_id': 'phone_state', 'state': 'idle', 'type': 'sensor', 'icon': 'mdi:phone', 'attributes': {}}]

image

Note: there is a 2 second time stamp discrepancy between the mobile phones and HA server.

Also, MA Pixel is successfully sending the diagnostic info.

image

So, there is data getting from/to the HA server from MA Pixel but the phone state sensor is not being updated real-time.

Well, I’ve tried everything suggested in troubleshooting and I have reached the point where I can have a stable real-time phone_state or low battery use but not both.

Not really, It is still very hit and miss.

Had a similar thing with location from Android too where sometimes HA would just ignore it.

Good Day All,
Was there a resolution to this issue of the phone/HA not communicating? I have this same issue where when the app is open and the main focus, HA sees and responds via an automation correctly. But when the app is closed or not the main focus (open and displayed on the android phone), the automation does not work.

So an issue for this was reported on Github. The developers have been unable to reproduce the issue. We have made an attempt to fix the issue based on some assumptions as to what the issue cause is but need end user confirmation if the fix is working. Details on how to test the fix can be found here:

https://github.com/home-assistant/android/issues/4040#issuecomment-1960385762

1 Like

@dshokouhi Thank you. Reading to understand.

How many folks are testing this issue?

none that im aware of, just submitted the PR yesterday

Ah - that makes sense.

Question - very, very new to HA. What is “PR”?

It means Pull Request, on github. Like here:

https://github.com/home-assistant/android/pulls

Can the culprit be ‘Use adaptive Battery’ ?

This is the legend on the setting:

" Tip: Adaptive Battery learns from your phone usage to continuously optimize how apps use battery. To extend battery life, it may reduce performance and delay notifications."

I have the same issue, and now have desactivated de setting to check the result.

@mcarty Thanks.

Just a quick update: On the adaptive battery tip - many thanks. But…mixed results. Tried it twice …automation did not run on either attempt.

Than…tried about an hour later…worked fine. Odd.

Will continue to monitor.

Hey dudes, I just stumbled upon this page while working on my app. I have not a clue what you’re talking about, but I vaguely remember reading something about android 14 and foreground service. I think the point of it was to gain hype about androids new release. anyways, android 14 may or may not restrict use of background services, I didn’t get into it. But there are workarounds im sure. Hope that helops