Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is using native unit of measurement 'None' which is not a valid unit for the device class ('battery') #3202

Closed
nicolaasuni opened this issue Jan 5, 2023 · 13 comments · Fixed by #3977
Labels
bug Something isn't working sensor-tracking

Comments

@nicolaasuni
Copy link

The problem

After upgrading to Home Assistant core 2023.1 I am seeing new WARNING logs like:

2023-01-05 11:27:47.301 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.firetablet_battery_state (<class 'homeassistant.components.mobile_app.sensor.MobileAppSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('battery') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mobile_app%22

This is an automatic integration and there are not manual settings I can see.

What version of Home Assistant Core has the issue?

2023.1

What was the last working version of Home Assistant Core?

2022.12.8

What type of installation are you running?

Home Assistant Core

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?

2023-01-05 11:27:47.301 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.firetablet_battery_state (<class 'homeassistant.components.mobile_app.sensor.MobileAppSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('battery') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mobile_app%22

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jan 5, 2023

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (mobile_app) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of mobile_app can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign mobile_app Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


mobile_app documentation
mobile_app source
(message by IssueLinks)

@frenck
Copy link
Member

frenck commented Jan 5, 2023

Hi there @nicolaasuni 👋

Which mobile app are you using for the reported entities? As in, this is an issue with the mobile app itself, reporting incorrect values.

../Frenck

@thedanbob
Copy link

thedanbob commented Jan 5, 2023

I’m currently seeing this error from both my iPhone and my wife’s android tablet, both using the latest versions of the companion app. However, it’s not showing up for my iPad or my wife’s android phone. I’ve noticed similar messages before on the Developer Tools > Statistics page for one or more of those four devices, but it’s not consistent. They would randomly appear and disappear from the list across server restarts. My guess is the only thing different in this release is the error is being reported in the logs rather than the statistics page.

@nicolaasuni
Copy link
Author

I am using The Home Assistant app Version 2022.12.0-full.
This error is appearing for the "battery_state" entity for multiple Android devices.

@bobofruit1970

This comment was marked as off-topic.

@frenck
Copy link
Member

frenck commented Jan 6, 2023

I can see very similar WARNING from other integration reporting battery state of my laptop to HA via mqtt.

@bobofruit1970 That is a different error, please don't stack multiple issues in a single issue. Thanks 👍

This error is appearing for the "battery_state" entity for multiple Android devices.

Alright, moving this issue to the Android app issue tracker, as this is not provided or taken care of in Core. This is a bug in the Android app.

@frenck frenck transferred this issue from home-assistant/core Jan 6, 2023
@jpelgrom
Copy link
Member

jpelgrom commented Jan 6, 2023

The battery state sensor shouldn't include a device class of battery 🤔

It was removed in late 2020 (#1101), was the app added before then? Can you get the attributes from developer tools > states, which will show the all the battery state sensor details?

@jpelgrom jpelgrom added bug Something isn't working sensor-tracking and removed integration: mobile_app labels Jan 6, 2023
@bobofruit1970
Copy link

bobofruit1970 commented Jan 6, 2023

For my Xperia phone I can see device class battery.
It is possible it was added before late 2020.
What should I do to remove this device class battery from this sensor?

image

@dshokouhi
Copy link
Member

@thedanbob please open a separate issue in the iOS repo so the team can look into the issue from their end.

@jpelgrom while the device class is no longer being sent, its probably never removed during re-registration. Not sure if thats the something the app can do or not?

@bobofruit1970 @nicolaasuni and @thedanbob for the android app to resolve this issue for now, you will need to start fresh with the app so the correct data can be loaded.

https://companion.home-assistant.io/docs/troubleshooting/faqs/#starting-fresh-with-the-android-app

@bobofruit1970
Copy link

@dshokouhi Thank You.

After fresh installation off app "device_class: battery" disappeared.

image

@jpelgrom
Copy link
Member

jpelgrom commented Jan 7, 2023

while the device class is no longer being sent, its probably never removed during re-registration. Not sure if thats the something the app can do or not?

I'm not sure we can, I've tried sending null during registration like this:

{"type":"register_sensor","data":{"unique_id":"battery_state","state":"discharging","type":"sensor","icon":"mdi:battery-minus","attributes":{},"name":"Battery State","device_class":null,"entity_category":"diagnostic","disabled":false}}

but core ignores it as it will only accept non-null values, triggering an error:

Logger: homeassistant.components.mobile_app.webhook
Source: components/mobile_app/webhook.py:156
Integration: Mobile App ([documentation](https://www.home-assistant.io/integrations/mobile_app), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+mobile_app%22))
First occurred: 15:35:51 (1 occurrences)
Last logged: 15:35:51

Received invalid webhook payload: value must be one of ['apparent_power', 'aqi', 'atmospheric_pressure', 'battery', 'battery_charging', 'carbon_dioxide', 'carbon_monoxide', 'cold', 'connectivity', 'current', 'data_rate', 'data_size', 'date', 'distance', 'door', 'duration', 'energy', 'enum', 'frequency', 'garage_door', 'gas', 'heat', 'humidity', 'illuminance', 'irradiance', 'light', 'lock', 'moisture', 'monetary', 'motion', 'moving', 'nitrogen_dioxide', 'nitrogen_monoxide', 'nitrous_oxide', 'occupancy', 'opening', 'ozone', 'plug', 'pm1', 'pm10', 'pm25', 'power', 'power_factor', 'precipitation', 'precipitation_intensity', 'presence', 'pressure', 'problem', 'reactive_power', 'running', 'safety', 'signal_strength', 'smoke', 'sound', 'sound_pressure', 'speed', 'sulphur_dioxide', 'tamper', 'temperature', 'timestamp', 'update', 'vibration', 'volatile_organic_compounds', 'voltage', 'volume', 'water', 'weight', 'wind_speed', 'window'] for dictionary value @ data['device_class']. Got None

I'd argue that the validation core is performing is correct, but that does mean it is not possible to fix this without removing the device + entities on the server.

@CSRLabs
Copy link

CSRLabs commented Jan 28, 2023

Similar error here.
The device is working fine but I see this error in the log.
My device is using a custom quirk, maybe there is someting I can tweak in it.

2023-01-28 19:29:18.373 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.csrlabs_pzem004t_instantaneous_demand (<class 'homeassistant.components.zha.sensor.SmartEnergyMetering'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('power') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+zha%22
2023-01-28 19:29:18.381 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.csrlabs_pzem004t_summation_delivered (<class 'homeassistant.components.zha.sensor.SmartEnergySummation'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('energy') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+zha%22

@dshokouhi
Copy link
Member

@CSRLabs I dont know how you ended up in the android repo, but you should file a core bug as the error suggests. These errors can only be solved by their own integration. Although the error is similar, the fix will definitely not be :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sensor-tracking
Projects
None yet
7 participants