core icon indicating copy to clipboard operation
core copied to clipboard

Unifi Temperature entities do not contain proper state_class

Open Petro31 opened this issue 4 months ago • 16 comments

The problem

NOTE: This does not appear to be an overarching issue, just 2 separate issues for Unifi and Derivative. There's already a separate derivative issue, so this is being repurposed into a Unifi only issue.

I have 3 entities that do not have a proper device_class or state class, yet the integration should be already providing it.

I think what's happening is, these entities existed prior to the integration having a state_class or device_class. Over time, the integration has been updated to provide this information but the entity_registry was never updated. And now, during the beta, we are getting repairs.

The listed integrations are Derivative and Unifi Network. The derivative integration's entity has a source sensor that is a % sensor. If I recall correctly, that means the ending UOM should be %, the state_class should be measurement, and the device_class should be none.

The other 2 entities are network switch temperature entities. Both are missing a device_class and state_class, however the integration provides this information. The entity_registry has the device_class as null and state_class is completely missing.

image

Here's one of the unifi sensors

      {"aliases":[],"area_id":null,"categories":{},"capabilities":null,"config_entry_id":"2600d55673de4f45aa72c80b4aa0031d","created_at":"1970-01-01T00:00:00+00:00","device_class":null,"device_id":"3419568b8da04da98a7e55b9cb5250ba","disabled_by":null,"entity_category":"diagnostic","entity_id":"sensor.bonus_room_switch_temperature","hidden_by":null,"icon":null,"id":"267196f14b2e70515fdfeb298be56494","has_entity_name":true,"labels":[],"modified_at":"1970-01-01T00:00:00+00:00","name":"Bonus Room Switch Temperature","options":{"conversation":{"should_expose":false},"sensor":{"display_precision":null}},"original_device_class":"temperature","original_icon":null,"original_name":"Temperature","platform":"unifi","supported_features":0,"translation_key":null,"unique_id":"device_temperature-b4:fb:e4:55:0c:42","previous_unique_id":null,"unit_of_measurement":"°F"},

derivative sensor

      {"aliases":[],"area_id":null,"categories":{},"capabilities":null,"config_entry_id":"f16a0f99e10c399583f08ce9a6940608","created_at":"1970-01-01T00:00:00+00:00","device_class":null,"device_id":null,"disabled_by":null,"entity_category":null,"entity_id":"sensor.master_bathroom_humidity_change","hidden_by":null,"icon":null,"id":"f9038f24987f802610c32443a8f2b5d3","has_entity_name":false,"labels":[],"modified_at":"1970-01-01T00:00:00+00:00","name":null,"options":{"conversation":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":"Master Bathroom Humidity Change","platform":"derivative","supported_features":0,"translation_key":"derivative","unique_id":"f16a0f99e10c399583f08ce9a6940608","previous_unique_id":null,"unit_of_measurement":null},

Both of these entity_registry items should contain a device_class and a state_class.

It should also be noted, at some point in my configuration history, these entities did have their friendly_name overridden by customize.yaml. I completely removed all customize.yaml settings when labels were introduced. State_class and device_class were not listed in customize.yaml. History for that file is here https://github.com/Petro31/home-assistant-config/commits/master/customize.yaml

What version of Home Assistant Core has the issue?

2024.10.0b0

What was the last working version of Home Assistant Core?

2024.9.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Unifi Network

Link to integration documentation on our website

No response

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

Petro31 avatar Sep 26 '24 01:09 Petro31