Skip to content

Commit abec1bf

Browse files
committed
Remove try-excepts for set-functions, errors will propagate up
1 parent e875c4a commit abec1bf

File tree

1 file changed

+10
-42
lines changed

1 file changed

+10
-42
lines changed

plugwise/__init__.py

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
PlugwiseData,
1919
ThermoLoc,
2020
)
21-
from plugwise.exceptions import (
22-
InvalidSetupError,
23-
PlugwiseError,
24-
ResponseError,
25-
UnsupportedDeviceError,
26-
)
21+
from plugwise.exceptions import InvalidSetupError, ResponseError, UnsupportedDeviceError
2722
from plugwise.helper import SmileComm
2823
from plugwise.legacy.smile import SmileLegacyAPI
2924
from plugwise.smile import SmileAPI
@@ -318,68 +313,41 @@ async def set_schedule_state(
318313
name: str | None = None,
319314
) -> None:
320315
"""Activate/deactivate the Schedule, with the given name, on the relevant Thermostat."""
321-
try:
322-
await self._smile_api.set_schedule_state(loc_id, new_state, name)
323-
except PlugwiseError as exc:
324-
raise exc
316+
await self._smile_api.set_schedule_state(loc_id, new_state, name)
325317

326318
async def set_preset(self, loc_id: str, preset: str) -> None:
327319
"""Set the given Preset on the relevant Thermostat."""
328-
try:
329-
await self._smile_api.set_preset(loc_id, preset)
330-
except PlugwiseError as exc:
331-
raise exc
320+
await self._smile_api.set_preset(loc_id, preset)
332321

333322
async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
334323
"""Set the given Temperature on the relevant Thermostat."""
335-
try:
336-
await self._smile_api.set_temperature(loc_id, items)
337-
except PlugwiseError as exc:
338-
raise exc
324+
await self._smile_api.set_temperature(loc_id, items)
339325

340326
async def set_number_setpoint(self, key: str, _: str, temperature: float) -> None:
341327
"""Set the max. Boiler or DHW setpoint on the Central Heating boiler."""
342-
try:
343-
await self._smile_api.set_number_setpoint(key, temperature)
344-
except PlugwiseError as exc:
345-
raise exc
328+
await self._smile_api.set_number_setpoint(key, temperature)
346329

347330
async def set_temperature_offset(self, _: str, dev_id: str, offset: float) -> None:
348331
"""Set the Temperature offset for thermostats that support this feature."""
349-
try:
350-
await self._smile_api.set_temperature_offset(dev_id, offset)
351-
except PlugwiseError as exc:
352-
raise exc
332+
await self._smile_api.set_temperature_offset(dev_id, offset)
353333

354334
async def set_switch_state(
355335
self, appl_id: str, members: list[str] | None, model: str, state: str
356336
) -> None:
357337
"""Set the given State of the relevant Switch."""
358-
try:
359-
await self._smile_api.set_switch_state(appl_id, members, model, state)
360-
except PlugwiseError as exc:
361-
raise exc
338+
await self._smile_api.set_switch_state(appl_id, members, model, state)
362339

363340
async def set_gateway_mode(self, mode: str) -> None:
364341
"""Set the gateway mode."""
365-
try:
366-
await self._smile_api.set_gateway_mode(mode)
367-
except PlugwiseError as exc:
368-
raise exc
342+
await self._smile_api.set_gateway_mode(mode)
369343

370344
async def set_regulation_mode(self, mode: str) -> None:
371345
"""Set the heating regulation mode."""
372-
try:
373-
await self._smile_api.set_regulation_mode(mode)
374-
except PlugwiseError as exc:
375-
raise exc
346+
await self._smile_api.set_regulation_mode(mode)
376347

377348
async def set_dhw_mode(self, mode: str) -> None:
378349
"""Set the domestic hot water heating regulation mode."""
379-
try:
380-
await self._smile_api.set_dhw_mode(mode)
381-
except PlugwiseError as exc:
382-
raise exc
350+
await self._smile_api.set_dhw_mode(mode)
383351

384352
async def delete_notification(self) -> None:
385353
"""Delete the active Plugwise Notification."""

0 commit comments

Comments
 (0)