@@ -248,7 +248,9 @@ async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
248248
249249 if self .smile (ANNA ) and self ._cooling_present :
250250 if "setpoint_high" not in items :
251- raise PlugwiseError
251+ raise PlugwiseError (
252+ "Plugwise: failed setting temperature: no valid input provided"
253+ )
252254 tmp_setpoint_high = items ["setpoint_high" ]
253255 tmp_setpoint_low = items ["setpoint_low" ]
254256 if self ._cooling_enabled : # in cooling mode
@@ -265,7 +267,9 @@ async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
265267 )
266268
267269 if setpoint is None :
268- raise PlugwiseError # pragma: no cover"
270+ raise PlugwiseError (
271+ "Plugwise: failed setting temperature: no valid input provided"
272+ ) # pragma: no cover"
269273
270274 temperature = str (setpoint )
271275 uri = self ._thermostat_uri (loc_id )
@@ -287,7 +291,7 @@ async def set_number_setpoint(self, key: str, temperature: float) -> None:
287291 thermostat_id = th_func .attrib ["id" ]
288292
289293 if thermostat_id is None :
290- raise PlugwiseError
294+ raise PlugwiseError ( f"Plugwise: cannot change setpoint, { key } not found." )
291295
292296 uri = f"{ APPLIANCES } ;id={ self ._heater_id } /thermostat;id={ thermostat_id } "
293297 data = f"<thermostat_functionality><setpoint>{ temp } </setpoint></thermostat_functionality>"
@@ -296,7 +300,9 @@ async def set_number_setpoint(self, key: str, temperature: float) -> None:
296300 async def set_temperature_offset (self , dev_id : str , offset : float ) -> None :
297301 """Set the Temperature offset for thermostats that support this feature."""
298302 if dev_id not in self .therms_with_offset_func :
299- raise PlugwiseError
303+ raise PlugwiseError (
304+ "Plugwise: this device does not have temperature-offset capability."
305+ )
300306
301307 value = str (offset )
302308 uri = f"{ APPLIANCES } ;id={ dev_id } /offset;type=temperature_offset"
@@ -349,7 +355,7 @@ async def set_switch_state(
349355 )
350356 # Don't bother switching a relay when the corresponding lock-state is true
351357 if self ._domain_objects .find (locator ).text == "true" :
352- raise PlugwiseError
358+ raise PlugwiseError ( "Plugwise: the locked Relay was not switched." )
353359
354360 await self ._request (uri , method = "put" , data = data )
355361
@@ -371,7 +377,7 @@ async def _set_groupswitch_member_state(
371377 async def set_gateway_mode (self , mode : str ) -> None :
372378 """Set the gateway mode."""
373379 if mode not in self ._gw_allowed_modes :
374- raise PlugwiseError
380+ raise PlugwiseError ( "Plugwise: invalid gateway mode." )
375381
376382 end_time = "2037-04-21T08:00:53.000Z"
377383 valid = ""
@@ -394,7 +400,7 @@ async def set_gateway_mode(self, mode: str) -> None:
394400 async def set_regulation_mode (self , mode : str ) -> None :
395401 """Set the heating regulation mode."""
396402 if mode not in self ._reg_allowed_modes :
397- raise PlugwiseError
403+ raise PlugwiseError ( "Plugwise: invalid regulation mode." )
398404
399405 uri = f"{ APPLIANCES } ;type=gateway/regulation_mode_control"
400406 duration = ""
0 commit comments