From b922e9331ffda1845d83e5465b702cbd06f7ddc3 Mon Sep 17 00:00:00 2001 From: Masahiro Konishi Date: Fri, 9 Dec 2022 10:26:22 +0900 Subject: [PATCH] Add power field to switchbot plug (#83495) Co-authored-by: J. Nick Koston --- homeassistant/components/switchbot/sensor.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/homeassistant/components/switchbot/sensor.py b/homeassistant/components/switchbot/sensor.py index 9b1baf805bb..91f99047ca1 100644 --- a/homeassistant/components/switchbot/sensor.py +++ b/homeassistant/components/switchbot/sensor.py @@ -13,6 +13,7 @@ from homeassistant.const import ( PERCENTAGE, SIGNAL_STRENGTH_DECIBELS_MILLIWATT, TEMP_CELSIUS, + UnitOfPower, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import EntityCategory @@ -72,6 +73,13 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = { state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, ), + "power": SensorEntityDescription( + key="power", + name="Power", + native_unit_of_measurement=UnitOfPower.WATT, + state_class=SensorStateClass.MEASUREMENT, + device_class=SensorDeviceClass.POWER, + ), }