From 4eddd8b75af549c7da266687b73104ed14b1787b Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 10 Jan 2023 16:45:59 +0100 Subject: [PATCH] Remove invalid unit of measurement in mfi (#85620) --- homeassistant/components/mfi/sensor.py | 4 ++-- tests/components/mfi/test_sensor.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mfi/sensor.py b/homeassistant/components/mfi/sensor.py index 38f6d973b9d..84f4abdaead 100644 --- a/homeassistant/components/mfi/sensor.py +++ b/homeassistant/components/mfi/sensor.py @@ -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: diff --git a/tests/components/mfi/test_sensor.py b/tests/components/mfi/test_sensor.py index ea67ab6f427..f8a043eb8fb 100644 --- a/tests/components/mfi/test_sensor.py +++ b/tests/components/mfi/test_sensor.py @@ -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