@@ -246,17 +246,19 @@ async def set_switch_state(
246246 appl_type = appliance .find ("type" ).text
247247 data = (
248248 f'<appliances><appliance id="{ appl_id } "><name><![CDATA[{ appl_name } ]></name>'
249- f"<description><![CDATA[]]></description><type><![CDATA[{ appl_type } ]]></type><actuator_functionalities>"
250- "<relay_functionality><lock>true</lock></relay_functionality></actuator_functionalities></appliance></appliances>"
249+ f"<description><![CDATA[]]></description><type><![CDATA[{ appl_type } ]]></type>"
250+ f"<{ switch .actuator } ><{ switch .func_type } ><lock>{ state } </lock></{ switch .func_type } ></{ switch .actuator } >"
251+ "</appliance></appliances>"
251252 )
252253 await self .call_request (APPLIANCES , method = "post" , data = data )
253254 return
254255
255- if members is not None :
256- return await self ._set_groupswitch_member_state (members , state , switch )
257-
258256 data = f"<{ switch .func_type } ><state>{ state } </state></{ switch .func_type } >"
259257 uri = f"{ APPLIANCES } ;id={ appl_id } /relay"
258+ if members is not None :
259+ return await self ._set_groupswitch_member_state (
260+ data , members , state , switch
261+ )
260262
261263 if model == "relay" :
262264 locator = (
@@ -269,16 +271,14 @@ async def set_switch_state(
269271 await self .call_request (uri , method = "put" , data = data )
270272
271273 async def _set_groupswitch_member_state (
272- self , members : list [str ], state : str , switch : Munch
274+ self , data : str , members : list [str ], state : str , switch : Munch
273275 ) -> None :
274276 """Helper-function for set_switch_state().
275277
276278 Set the given State of the relevant Switch (relay) within a group of members.
277279 """
278280 for member in members :
279- data = f"<{ switch .func_type } ><state>{ state } </state></{ switch .func_type } >"
280281 uri = f"{ APPLIANCES } ;id={ member } /relay"
281-
282282 await self .call_request (uri , method = "put" , data = data )
283283
284284 async def set_temperature (self , _ : str , items : dict [str , float ]) -> None :
0 commit comments