File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 5757from packaging import version
5858
5959
60+ def extend_plug_device_class (appl : Munch , appliance : etree .Element ) -> None :
61+ """Extend device_class name of Plugs (Plugwise and Aqara) - Pw-Beta Issue #739."""
62+
63+ if (
64+ (search := appliance .find ("description" )) is not None
65+ and (description := search .text ) is not None
66+ and ("ZigBee protocol" in description or "smart plug" in description )
67+ ):
68+ appl .pwclass = f"{ appl .pwclass } _plug"
69+
70+
6071def search_actuator_functionalities (
6172 appliance : etree .Element , actuator : str
6273) -> etree .Element | None :
@@ -138,12 +149,7 @@ def _get_appliances(self) -> None:
138149 if appl .pwclass in THERMOSTAT_CLASSES and appl .location is None :
139150 continue
140151
141- # Extend device_class name of Plugs (Plugwise and Aqara) - Pw-Beta Issue #739
142- description = appliance .find ("description" ).text
143- if description is not None and (
144- "ZigBee protocol" in description or "smart plug" in description
145- ):
146- appl .pwclass = f"{ appl .pwclass } _plug"
152+ extend_plug_device_class (appl , appliance )
147153
148154 # Collect appliance info, skip orphaned/removed devices
149155 if not (appl := self ._appliance_info_finder (appl , appliance )):
You can’t perform that action at this time.
0 commit comments