core: state_class missing for Android battery sensors after Home Assistant core update or restart
The problem
The state_class attribute for the battery_level, battery_temperature and battery_power sensors of my Android phone has disappeared since Home Assistant 2022.12.
This causes the sensor data to be now longer recorded into the long term statistics.

I have confirmed that the state_class attribute reappears when downgrading Home Assistant to 2022.11.5.
What version of Home Assistant Core has the issue?
core-2022.12.1
What was the last working version of Home Assistant Core?
core-2022.11.5
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Mobile App
Link to integration documentation on our website
https://www.home-assistant.io/integrations/mobile_app
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 36 (10 by maintainers)
For me it helped to set the
state_classmanually in the configuration.yaml. It took some time but now i have statistics for my android devices:Seeing same issue again.
Last date for getting state was just prior update: https://ss.codeone.pl/ss-2023-06-13-22-30-49-1686688249-aTMenRla.png And after that: https://ss.codeone.pl/ss-2023-06-13-22-31-26-1686688286-EfruXX0W.png
Same for battery temperature as well as other sensors from phone (OnePlus LE2123)
For a long time, including the last version I am getting the following warnings in the logs:
I am using:
Can this please get fixed?
Suffering from this for months, being redirected from https://github.com/home-assistant/android/issues/2847#issuecomment-1346869360.
Now that the entity popup only shows statistics and not the raw data anymore, thanks to this bug NOTHING is shown for affected entities (in short: things got worse):