mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Better warning if unit of sensor is unsupported for its device class (#60665)
* Better warning if unit of sensor is unsupported for its device class * Prettify the code
This commit is contained in:
parent
a6ec646f98
commit
b41e020f85
@ -266,7 +266,12 @@ def _normalize_states(
|
|||||||
hass.data[WARN_UNSUPPORTED_UNIT] = set()
|
hass.data[WARN_UNSUPPORTED_UNIT] = set()
|
||||||
if entity_id not in hass.data[WARN_UNSUPPORTED_UNIT]:
|
if entity_id not in hass.data[WARN_UNSUPPORTED_UNIT]:
|
||||||
hass.data[WARN_UNSUPPORTED_UNIT].add(entity_id)
|
hass.data[WARN_UNSUPPORTED_UNIT].add(entity_id)
|
||||||
_LOGGER.warning("%s has unknown unit %s", entity_id, unit)
|
_LOGGER.warning(
|
||||||
|
"%s has unit %s which is unsupported for device_class %s",
|
||||||
|
entity_id,
|
||||||
|
unit,
|
||||||
|
device_class,
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fstates.append((UNIT_CONVERSIONS[device_class][unit](fstate), state))
|
fstates.append((UNIT_CONVERSIONS[device_class][unit](fstate), state))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user