custom-components / ble_monitor

BLE monitor for passive BLE sensors
https://community.home-assistant.io/t/passive-ble-monitor-integration/
MIT License
1.93k stars 248 forks source link

[Bug]: The unit of this entity changed #1391

Open Draghmar opened 1 month ago

Draghmar commented 1 month ago

What happened?

After upadting HA to 2024.10 there are messages about few ATC (Atc1441) devices having:

The unit of 'ble voltage Lazienka' (sensor.ble_voltage_lazienka) changed to '' which can't be converted to the previously stored unit, 'V'.
If the historic statistic values have a wrong unit, you can update the units of the old values. The values will not be updated.
Otherwise you can choose to delete all historic statistic values, and start over.

HA suggests either deleting offending entries or update the unit. Tried both of them but I don't think anything happened. Is this something related to the BLE Monitor?

Sensor type

ATC (Atc1441) [custom firmware]

Relevant log output

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:731
integration: Sensor (documentation, issues)
First occurred: 3 October 2024 at 14:14:29 (10 occurrences)
Last logged: 3 October 2024 at 14:14:29

Entity sensor.ble_voltage_salon (<class 'custom_components.ble_monitor.sensor.MeasuringSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('voltage') it is using; expected one of ['V', 'mV']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_humidity_serwerownia (<class 'custom_components.ble_monitor.sensor.HumiditySensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('humidity') it is using; expected one of ['%']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_battery_serwerownia (<class 'custom_components.ble_monitor.sensor.BatterySensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('battery') it is using; expected one of ['%']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_humidity_sypialnia (<class 'custom_components.ble_monitor.sensor.HumiditySensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('humidity') it is using; expected one of ['%']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_voltage_sypialnia (<class 'custom_components.ble_monitor.sensor.MeasuringSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('voltage') it is using; expected one of ['V', 'mV']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
etakpte commented 1 month ago

Hi,

I have similar issue with Xiaomi Mi Scale V2 after 2024.10 update:

`The unit of 'ble stabilized weight' (sensor.ble_stabilized_weight) changed to '' which can't be converted to the previously stored unit, 'kg'.

The unit of 'ble non-stabilized weight' (sensor.ble_non_stabilized_weight) changed to '' which can't be converted to the previously stored unit, 'kg'. `

BR, P.

Draghmar commented 1 month ago

Hm...Weird thing. I had reboot Pi for other reason and after that those messages are gone. So maybe the fix did something but it needed reboot to show it up? But I still got something in the log:

Source: components/sensor/__init__.py:731
integration: Sensor (documentation, issues)
First occurred: 10:20:50 (10 occurrences)
Last logged: 10:20:50

Entity sensor.ble_voltage_salon (<class 'custom_components.ble_monitor.sensor.MeasuringSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('voltage') it is using; expected one of ['V', 'mV']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_humidity_serwerownia (<class 'custom_components.ble_monitor.sensor.HumiditySensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('humidity') it is using; expected one of ['%']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_battery_serwerownia (<class 'custom_components.ble_monitor.sensor.BatterySensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('battery') it is using; expected one of ['%']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_humidity_sypialnia (<class 'custom_components.ble_monitor.sensor.HumiditySensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('humidity') it is using; expected one of ['%']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues
Entity sensor.ble_voltage_sypialnia (<class 'custom_components.ble_monitor.sensor.MeasuringSensor'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('voltage') it is using; expected one of ['V', 'mV']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/custom-components/ble_monitor/issues

Could that mean that those logs are related to something else?

Ernst79 commented 1 month ago

I thought I have seen the first error in the opening post somewhere, in some other issue. The solution, if I remember correct, was to to clear the cache and reboot, which is most likely the reason the error is gone now. But I can’t find back the issue where I have seen the solution.

The other issue can be ignored, you just received a BLE message without data, or the restore of the sensor data after a restart did not work. If it only happens after a reboot, try to change the setting to restore the sensor data after a reboot.