Remove invalid unit of measurement in mfi (#85620)
parent
298d7504fd
commit
4eddd8b75a
|
@ -133,14 +133,14 @@ class MfiSensor(SensorEntity):
|
|||
try:
|
||||
tag = self._port.tag
|
||||
except ValueError:
|
||||
return "State"
|
||||
return None
|
||||
|
||||
if tag == "temperature":
|
||||
return UnitOfTemperature.CELSIUS
|
||||
if tag == "active_pwr":
|
||||
return "Watts"
|
||||
if self._port.model == "Input Digital":
|
||||
return "State"
|
||||
return None
|
||||
return tag
|
||||
|
||||
def update(self) -> None:
|
||||
|
|
|
@ -148,7 +148,7 @@ async def test_uom_power(port, sensor):
|
|||
async def test_uom_digital(port, sensor):
|
||||
"""Test the UOM digital input."""
|
||||
port.model = "Input Digital"
|
||||
assert sensor.unit_of_measurement == "State"
|
||||
assert sensor.unit_of_measurement is None
|
||||
assert sensor.device_class is None
|
||||
|
||||
|
||||
|
@ -162,7 +162,7 @@ async def test_uom_unknown(port, sensor):
|
|||
async def test_uom_uninitialized(port, sensor):
|
||||
"""Test that the UOM defaults if not initialized."""
|
||||
type(port).tag = mock.PropertyMock(side_effect=ValueError)
|
||||
assert sensor.unit_of_measurement == "State"
|
||||
assert sensor.unit_of_measurement is None
|
||||
assert sensor.device_class is None
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue