Skip to content

Commit df0cfd6

Browse files
authored
Add Climate Panel support to Switchbot Cloud (#152427)
1 parent b2c53f2 commit df0cfd6

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

homeassistant/components/switchbot_cloud/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,12 @@ async def make_device_data(
270270
)
271271
devices_data.humidifiers.append((device, coordinator))
272272
devices_data.sensors.append((device, coordinator))
273+
if isinstance(device, Device) and device.device_type == "Climate Panel":
274+
coordinator = await coordinator_for_device(
275+
hass, entry, api, device, coordinators_by_id
276+
)
277+
devices_data.binary_sensors.append((device, coordinator))
278+
devices_data.sensors.append((device, coordinator))
273279

274280

275281
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

homeassistant/components/switchbot_cloud/binary_sensor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ class SwitchBotCloudBinarySensorEntityDescription(BinarySensorEntityDescription)
104104
),
105105
"Hub 3": (MOVE_DETECTED_DESCRIPTION,),
106106
"Water Detector": (LEAK_DESCRIPTION,),
107+
"Climate Panel": (
108+
IS_LIGHT_DESCRIPTION,
109+
MOVE_DETECTED_DESCRIPTION,
110+
),
107111
}
108112

109113

homeassistant/components/switchbot_cloud/sensor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ class SwitchbotCloudSensorEntityDescription(SensorEntityDescription):
119119
state_class=SensorStateClass.MEASUREMENT,
120120
)
121121

122-
123122
SENSOR_DESCRIPTIONS_BY_DEVICE_TYPES = {
124123
"Bot": (BATTERY_DESCRIPTION,),
125124
"Battery Circulator Fan": (BATTERY_DESCRIPTION,),
@@ -189,6 +188,11 @@ class SwitchbotCloudSensorEntityDescription(SensorEntityDescription):
189188
"Contact Sensor": (BATTERY_DESCRIPTION,),
190189
"Water Detector": (BATTERY_DESCRIPTION,),
191190
"Humidifier": (TEMPERATURE_DESCRIPTION,),
191+
"Climate Panel": (
192+
TEMPERATURE_DESCRIPTION,
193+
HUMIDITY_DESCRIPTION,
194+
BATTERY_DESCRIPTION,
195+
),
192196
}
193197

194198

@@ -226,7 +230,6 @@ def _set_attributes(self) -> None:
226230
"""Set attributes from coordinator data."""
227231
if not self.coordinator.data:
228232
return
229-
230233
if isinstance(
231234
self.entity_description,
232235
SwitchbotCloudSensorEntityDescription,

0 commit comments

Comments
 (0)