mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Set native value to be None instead of STATE_UNKNOWN for APCUPSD integration (#124609)
This commit is contained in:
parent
592f60643a
commit
bb6f9ec844
@ -13,7 +13,6 @@ from homeassistant.components.sensor import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
STATE_UNKNOWN,
|
|
||||||
UnitOfApparentPower,
|
UnitOfApparentPower,
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
UnitOfElectricPotential,
|
UnitOfElectricPotential,
|
||||||
@ -484,7 +483,7 @@ class APCUPSdSensor(CoordinatorEntity[APCUPSdCoordinator], SensorEntity):
|
|||||||
# performed) and may disappear again after certain event. So we mark the state as "unknown"
|
# performed) and may disappear again after certain event. So we mark the state as "unknown"
|
||||||
# when it becomes unknown after such events.
|
# when it becomes unknown after such events.
|
||||||
if key not in self.coordinator.data:
|
if key not in self.coordinator.data:
|
||||||
self._attr_native_value = STATE_UNKNOWN
|
self._attr_native_value = None
|
||||||
return
|
return
|
||||||
|
|
||||||
self._attr_native_value, inferred_unit = infer_unit(self.coordinator.data[key])
|
self._attr_native_value, inferred_unit = infer_unit(self.coordinator.data[key])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user