Skip to content

Commit 84f79c5

Browse files
committed
Implement CoderabbitAI suggestion
1 parent 465363d commit 84f79c5

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

plugwise/legacy/smile.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,25 @@ async def set_switch_state(
250250
appliance = self._appliances.find(f'appliance[@id="{appl_id}"]')
251251
appl_name = appliance.find("name").text
252252
appl_type = appliance.find("type").text
253-
data = (
254-
f'<appliances><appliance id="{appl_id}"><name><![CDATA[{appl_name}]]></name>'
255-
f"<description><![CDATA[]]></description><type><![CDATA[{appl_type}]]></type>"
256-
f"<{switch.actuator}><{switch.func_type}><lock>{state}</lock></{switch.func_type}></{switch.actuator}>"
257-
"</appliance></appliances>"
258-
)
253+
- data = (
254+
- f'<appliances><appliance id="{appl_id}"><name><![CDATA[{appl_name}]]></name>'
255+
- f"<description><![CDATA[]]></description><type><![CDATA[{appl_type}]]></type>"
256+
- f"<{switch.actuator}><{switch.func_type}><lock>{state}</lock></{switch.func_type}></{switch.actuator}>"
257+
- "</appliance></appliances>"
258+
- )
259+
+ data = f'''
260+
+ <appliances>
261+
+ <appliance id="{appl_id}">
262+
+ <name><![CDATA[{appl_name}]]></name>
263+
+ <description><![CDATA[]]></description>
264+
+ <type><![CDATA[{appl_type}]]></type>
265+
+ <{switch.actuator}>
266+
+ <{switch.func_type}>
267+
+ <lock>{state}</lock>
268+
+ </{switch.func_type}>
269+
+ </{switch.actuator}>
270+
+ </appliance>
271+
+ </appliances>'''.strip()
259272
await self.call_request(APPLIANCES, method="post", data=data)
260273
return
261274

0 commit comments

Comments
 (0)