Skip to content

Commit 7a3630e

Browse files
Add sensor description for switchbot cloud's device(plug) small changes (home-assistant#148551)
Co-authored-by: Joost Lekkerkerker <[email protected]>
1 parent 2812d7c commit 7a3630e

File tree

1 file changed

+10
-0
lines changed
  • homeassistant/components/switchbot_cloud

1 file changed

+10
-0
lines changed

homeassistant/components/switchbot_cloud/sensor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
SENSOR_TYPE_POWER = "power"
3939
SENSOR_TYPE_VOLTAGE = "voltage"
4040
SENSOR_TYPE_CURRENT = "electricCurrent"
41+
SENSOR_TYPE_POWER_CONSUMPTION = "weight"
4142
SENSOR_TYPE_USED_ELECTRICITY = "usedElectricity"
4243
SENSOR_TYPE_LIGHTLEVEL = "lightLevel"
4344

@@ -120,6 +121,13 @@ class SwitchbotCloudSensorEntityDescription(SensorEntityDescription):
120121
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
121122
)
122123

124+
POWER_CONSUMPTION_DESCRIPTION = SensorEntityDescription(
125+
key=SENSOR_TYPE_POWER_CONSUMPTION,
126+
device_class=SensorDeviceClass.POWER,
127+
state_class=SensorStateClass.MEASUREMENT,
128+
native_unit_of_measurement=UnitOfPower.WATT,
129+
)
130+
123131
RELAY_SWITCH_2PM_POWER_DESCRIPTION = SensorEntityDescription(
124132
key=RELAY_SWITCH_2PM_SENSOR_TYPE_POWER,
125133
device_class=SensorDeviceClass.POWER,
@@ -180,10 +188,12 @@ class SwitchbotCloudSensorEntityDescription(SensorEntityDescription):
180188
"Plug Mini (US)": (
181189
VOLTAGE_DESCRIPTION,
182190
CURRENT_DESCRIPTION_IN_MA,
191+
POWER_CONSUMPTION_DESCRIPTION,
183192
),
184193
"Plug Mini (JP)": (
185194
VOLTAGE_DESCRIPTION,
186195
CURRENT_DESCRIPTION_IN_MA,
196+
POWER_CONSUMPTION_DESCRIPTION,
187197
),
188198
"Plug Mini (EU)": (
189199
POWER_DESCRIPTION,

0 commit comments

Comments
 (0)