Android: Andoid 10 phone only device_tracker, no battery level, geocoded location, wifi connection sensor and access rights grant problem

Created on 6 Mar 2020  路  20Comments  路  Source: home-assistant/android

Home Assistant Android version:
1.8.0-150 (Beta) and 1.8.0-142 (latest release)

Android version:
10

Phone model:
OnePlus 7t Pro

Home Assistant version:
0.106.5

Last working Home Assistant release (if known):
-none-

Description of problem:
First I wondered why my Samsung SM-T819 Tablet (Android 9) has the new Geocoded Location sensor and the phone does not, App has ALL rights I can enable in Android settings. I tried to reinstall the app, beforehand removed the integration and the webhook on Home Assistant. Now the integration has the device_tracker and nothing else anymore. If I do the same with the Tablet all sensors in the integration show up immediately again.

As 2nd try I granted all rights before first start the newly installed app and then the access rights grant message still shows up and it not removable. Selecting the grant rights buttons does nothing at all. (Rights are already granted and the app does not check for that as it seems). Integration problem still unchanged.

Traceback (if applicable):


Screenshot of problem:
image

Additional information:

bug sensor-tracking

All 20 comments

I was brave and edited the sensors in the .storage folder and the results were interesting...
The three missing sensors are now working as expected. So the problem is not the app, but the implementation in Home Assistant which did not create them first hand.
What I did:
I opened "mobile_app" and removed all webhook remnants which are not existent anymore. Then I copied the three Tablet sensors and changed the webhook_id and the name which has the same webhook_id included. There I replaced it with the phone one and that was that file. Then I hopped into "core.entity_registry" and did something similar. Cloned three missing sensors, changed config_entry_id, device_id, entity_id, original_name and unique_id to the right values. (first two stolen from device_tracker of the phone, Rest is just naming or webhook_id. Reboot. Some laments about he does not wanna re-register a already registered hook and BOOM, works. Another reboot and no more lamenting in the logs too... Strange, isn't it?

Here my files aka excerpts of them if too big:
core.entity_registry.txt
mobile_app.txt

EDIT: Or... not. The sensors work, but only after a phone reboot and then they stay in silence. So.... maybe it's a phone/app problem. (Power management of the app is disabled)

Please try these steps in this order: https://companion.home-assistant.io/docs/troubleshooting/faqs/#starting-fresh-with-the-android-app

You should try not to mess with things in .storage these steps are cleaner....make sure to clean up any old integrations too when you do it.

Did so incl. the reboots and the renaming. Now I am back to the state at the beginning. Tablet all sensors, phone only device_tracker. P.S. I ONLY did reset the phone now, Tablet works all the time, so I did not touch that one.

2020-03-07 12:11:21 INFO (SyncWorker_15) [root] Sending key KEY
2020-03-07 12:11:22 INFO (SyncWorker_17) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b5256980>
2020-03-07 12:11:23 INFO (SyncWorker_4) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b76f6e50>
2020-03-07 12:11:23 INFO (SyncWorker_10) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b4f91980>
2020-03-07 12:11:24 INFO (SyncWorker_6) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b4f91670>
2020-03-07 12:11:24 INFO (SyncWorker_8) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b5047980>
2020-03-07 12:11:36 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new device_tracker.mobile_app entity: device_tracker.hd1913
2020-03-07 12:11:36 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mobile_app
2020-03-07 12:11:36 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.mobile_app
2020-03-07 12:11:36 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.mobile_app
2020-03-07 12:11:36 INFO (MainThread) [homeassistant.components.automation] Executing Zu Hause Timer
2020-03-07 12:11:36 INFO (MainThread) [homeassistant.helpers.script] Script Zu Hause Timer: Running script
2020-03-07 12:11:36 INFO (MainThread) [homeassistant.helpers.script] Script Zu Hause Timer: Executing step call service
2020-03-07 12:11:43 INFO (SyncWorker_14) [root] Sending key KEY
2020-03-07 12:11:53 INFO (SyncWorker_2) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b4ec9f30>
2020-03-07 12:11:54 INFO (SyncWorker_8) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b4ec9c90>
2020-03-07 12:11:54 INFO (SyncWorker_18) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b86ef670>
2020-03-07 12:11:55 INFO (SyncWorker_16) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b50f4de0>
2020-03-07 12:11:55 INFO (SyncWorker_9) [pyfritzhome.fritzhome] <xml.dom.minidom.Document object at 0x7fa2b4eee3d0>
2020-03-07 12:12:05 INFO (SyncWorker_11) [root] Sending key KEY

Update. I waited until now and updated to the new beta versions of home assistant and some time in the past some sensors showed up again.
Screenshot_20200314-111857
Better, but that status was the best I ever reached in the past. The last one will not show up I guess...

With the latest beta you won't get the geocoded address if you don't have background location data turned on.

Well, it is and always was...
Screenshot_20200314-131629

Some more stuff from my log. After recent updates all other sensors added by them show p fine, but still no geocoded location here. Funny thing is that the logs say that it does not even try to pass that data...

03-30 13:40:36.171  1552  1584 I am_proc_start: [0,25120,10364,io.homeassistant.companion.android,service,{io.homeassistant.companion.android/androidx.work.impl.background.systemjob.SystemJobService}]
03-30 13:40:36.194  1552  2060 I am_proc_bound: [0,25120,io.homeassistant.companion.android]

03-30 13:41:47.053  1552  1582 I am_pss  : [25120,10364,io.homeassistant.companion.android,37474304,27205632,6434816,114995200,0,20,15]

03-30 13:42:51.162  1552  1582 I am_pss  : [25120,10364,io.homeassistant.companion.android,37474304,27205632,6434816,114995200,0,20,21]

03-30 13:46:08.374  1552  2784 I am_kill : [0,25120,io.homeassistant.companion.android,999,empty #31]

03-30 13:46:08.915  1552  4993 I am_proc_died: [0,25120,io.homeassistant.companion.android,999,20]

03-30 14:08:59.174 32053  6141 D OkHttp  : --> POST https://hooks.nabu.casa/CENSOR=: io.homeassistant.companion.android
03-30 14:08:59.174 32053  6141 D OkHttp  : Content-Type: application/json; charset=UTF-8: io.homeassistant.companion.android
03-30 14:08:59.174 32053  6141 D OkHttp  : Content-Length: 410: io.homeassistant.companion.android
03-30 14:08:59.174 32053  6141 D OkHttp  : {"type":"update_registration","data":{"app_version":"1.8.0-157 (157)","device_name":"HD1913","manufacturer":"OnePlus","model":"HD1913","os_version":"29","app_data":{"push_url":"https://mobile-apps.home-assistant.io/api/sendPush/android/v1","push_token":"CENSOR"}}}: io.homeassistant.companion.android
03-30 14:08:59.174 32053  6141 D OkHttp  : --> END POST (410-byte body): io.homeassistant.companion.android
03-30 14:08:59.513 32053  6235 D OkHttp  : --> POST https://hooks.nabu.casa/CENSOR=: io.homeassistant.companion.android
03-30 14:08:59.513 32053  6235 D OkHttp  : Content-Type: application/json; charset=UTF-8: io.homeassistant.companion.android
03-30 14:08:59.513 32053  6235 D OkHttp  : Content-Length: 20: io.homeassistant.companion.android
03-30 14:08:59.513 32053  6235 D OkHttp  : {"type":"get_zones"}: io.homeassistant.companion.android
03-30 14:08:59.513 32053  6235 D OkHttp  : --> END POST (20-byte body): io.homeassistant.companion.android
03-30 14:08:59.524 32053  6218 W cr_media: Requires BLUETOOTH permission: io.homeassistant.companion.android
03-30 14:08:59.536 32053  6238 D OkHttp  : --> POST https://hooks.nabu.casa/CENSOR=: io.homeassistant.companion.android
03-30 14:08:59.536 32053  6238 D OkHttp  : Content-Type: application/json; charset=UTF-8: io.homeassistant.companion.android
03-30 14:08:59.536 32053  6238 D OkHttp  : Content-Length: 21: io.homeassistant.companion.android
03-30 14:08:59.536 32053  6238 D OkHttp  : {"type":"get_config"}: io.homeassistant.companion.android
03-30 14:08:59.536 32053  6238 D OkHttp  : --> END POST (21-byte body): io.homeassistant.companion.android
03-30 14:08:59.573  3132 12110 I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=io.homeassistant.companion.android], packageName=io.homeassistant.companion.android]: com.google.android.gms.persistent
03-30 14:08:59.633 32053  6254 D OkHttp  : --> POST https://hooks.nabu.casa/CENSOR=: io.homeassistant.companion.android
03-30 14:08:59.633 32053  6254 D OkHttp  : Content-Type: application/json; charset=UTF-8: io.homeassistant.companion.android
03-30 14:08:59.633 32053  6254 D OkHttp  : Content-Length: 173: io.homeassistant.companion.android
03-30 14:08:59.633 32053  6254 D OkHttp  : {"type":"update_location","data":{"location_name":"","gps":[4x.xxxxx58,9.xxxxx37],"gps_accuracy":16,"battery":94,"speed":0,"altitude":242,"course":90,"vertical_accuracy":2}}: io.homeassistant.companion.android
03-30 14:08:59.633 32053  6254 D OkHttp  : --> END POST (173-byte body): io.homeassistant.companion.android
03-30 14:08:59.905 32053  6141 D OkHttp  : --> POST https://CENSOR: io.homeassistant.companion.android

Most likely I censored now what could be needed...

Same issue here, Pixel 3 has all the sensors.
LG G2 and Nokia 6.1 Plus does not eve have a sensor named Geo coded location in the entities list.
Happy to help with logs if you need more info

Not much news here. Except one thing. The newer apps versions (2.2.0+) show all sensors now, but the geolocation one stays dead (aka Unknown). Can someone lead me in the right direction, what data this function is aquiring as I start to wonder why I am one of a few having that problem... If ANY form of log helps you here, tell me which one. I am quite sure that a 1300MB logcat of 6 hours waiting for the app syncing is the wrong way to go. ^^

Screenshot_20200816-111354
Screenshot_20200816-111323
Screenshot_20200816-111312
Screenshot_20200816-111226
Screenshot_20200816-111140

Small addition, this almost shot through my eye on some logcat digging:

08-16 14:47:15.090 24915 24915 E GeocodeSM: Issue getting geocoded location : io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM: java.lang.IllegalStateException: Must not be called on the main application thread: io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at com.google.android.gms.common.internal.Preconditions.checkNotMainThread(Unknown Source:51): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at com.google.android.gms.common.internal.Preconditions.checkNotMainThread(Unknown Source:48): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at com.google.android.gms.tasks.Tasks.await(Unknown Source:16): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.GeocodeSensorManager.getGeocodedLocation(GeocodeSensorManager.kt:55): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.GeocodeSensorManager.getSensorData(GeocodeSensorManager.kt:45): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.SensorManager$DefaultImpls.getEnabledSensorData(SensorManager.kt:71): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.GeocodeSensorManager.getEnabledSensorData(GeocodeSensorManager.kt:13): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.SensorDetailFragment.refreshSensorData(SensorDetailFragment.kt:71): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.SensorDetailFragment.updateSensorEntity(SensorDetailFragment.kt:119): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.SensorDetailFragment.onCreatePreferences(SensorDetailFragment.kt:50): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:160): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.Fragment.performCreate(Fragment.java:2684): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:280): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1175): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1255): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1138): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:136): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1989): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1947): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1849): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at android.os.Handler.handleCallback(Handler.java:883): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at android.os.Handler.dispatchMessage(Handler.java:100): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at android.os.Looper.loop(Looper.java:219): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at android.app.ActivityThread.main(ActivityThread.java:7709): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at java.lang.reflect.Method.invoke(Native Method): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516): io.homeassistant.companion.android
08-16 14:47:15.090 24915 24915 E GeocodeSM:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM: Issue getting geocoded location : io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM: java.lang.IllegalStateException: Must not be called on the main application thread: io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at com.google.android.gms.common.internal.Preconditions.checkNotMainThread(Unknown Source:51): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at com.google.android.gms.common.internal.Preconditions.checkNotMainThread(Unknown Source:48): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at com.google.android.gms.tasks.Tasks.await(Unknown Source:16): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.GeocodeSensorManager.getGeocodedLocation(GeocodeSensorManager.kt:55): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.GeocodeSensorManager.getSensorData(GeocodeSensorManager.kt:45): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.SensorManager$DefaultImpls.getEnabledSensorData(SensorManager.kt:71): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.GeocodeSensorManager.getEnabledSensorData(GeocodeSensorManager.kt:13): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.SensorDetailFragment.refreshSensorData(SensorDetailFragment.kt:71): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at io.homeassistant.companion.android.sensors.SensorDetailFragment.onCreatePreferences(SensorDetailFragment.kt:67): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:160): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.Fragment.performCreate(Fragment.java:2684): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:280): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1175): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1255): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1138): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:136): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1989): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1947): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1849): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at android.os.Handler.handleCallback(Handler.java:883): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at android.os.Handler.dispatchMessage(Handler.java:100): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at android.os.Looper.loop(Looper.java:219): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at android.app.ActivityThread.main(ActivityThread.java:7709): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at java.lang.reflect.Method.invoke(Native Method): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516): io.homeassistant.companion.android
08-16 14:47:15.095 24915 24915 E GeocodeSM:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950): io.homeassistant.companion.android

mlogcat log.txt

Whole logcat is here, starting about 20 secs before I disabled and reenabled the sensor.

@dreimer1986 do you have google services installed?

Yes I do. This phone is 99% stock. (Magisk installed. Thats it) More precisely: Oxygen OS OP7TPro_02_BETA_07 by now.

@dreimer1986 can you try the latest beta and see if it improves things? We had a geocoded fix in the latest release. Also enable debug logging for the integration in home assistant so we can see whats going on with the sensors

logger:
  default: info
  logs:
    homeassistant.components.mobile_app: debug

Lets see what the logs do when you launch the app and take a look at the data we get if you still have an issue after updating to the latest beta

https://hastebin.com/ehetimizeb.sql

Sadly still the same. Using 2.2.1-19-g101e519-293-full
As I have no clue what we are looking for... This is the whole log after reboot and then opening the sensors in app config and switching off and on geocode. Then a bit of waiting and copied from app web ui.

and the only entity missing is geocoded or all of them?

I don't think HA is the problem, looks like an app problem.

Using 2.2.1-19-g101e519-293-full

So you are a couple of commits behind the latest (2.2.1-27), the play store reviews are taking longer than normal so hopefully today they roll the latest release out. In the latest you should get updates every 10 seconds when you are on the sensor pages which will help us to collect any potential problems with the sensor.

Oh there are two more with no data, but geocoding is the only one which should work as long as tracking works and that works for months now. pressure_sensor and next_alarm are marked with a red ! in Home Assistant (geocoded NOT, but has no data anyways). As my OP7t Pro has no pressure sensor and I don't use any alarms that is fine I guess.

OK, a new version on Play Store, a new result on my phone: https://hastebin.com/ucelipupov.cs
And most important... IT WORKS!
Screenshot_20200827-161730
Thanks for the help! I think this one can be closed now. But maybe we should wait for #830 being fixed and this one still working?

If your issue is fixed lets close it, we'll work the crash in the other issue. I don't think the two are related based on the logs.

Alright, will be closed now. Thanks once more 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

N-Schaef picture N-Schaef  路  5Comments

kmlucy picture kmlucy  路  3Comments

Hypfer picture Hypfer  路  3Comments

rradar picture rradar  路  4Comments

ofalvai picture ofalvai  路  5Comments