Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
sourcery refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
vlebourl committed Apr 18, 2023
1 parent 2c2c353 commit f6d69cc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/vesync/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,21 @@ def set_humidity(self, humidity: int) -> None:
raise ValueError(
"{humidity} is not between {self.min_humidity} and {self.max_humidity} (inclusive)"
)
success = self.smarthumidifier.set_humidity(humidity)
if not success:
if self.smarthumidifier.set_humidity(humidity):
self.schedule_update_ha_state()
else:
raise ValueError("An error occurred while setting humidity.")
self.schedule_update_ha_state()

def set_mode(self, mode: str) -> None:
"""Set the mode of the device."""
if mode not in self.available_modes:
raise ValueError(
"{mode} is not one of the valid available modes: {self.available_modes}"
)
success = self.smarthumidifier.set_humidity_mode(_get_vs_mode(mode))
if not success:
if self.smarthumidifier.set_humidity_mode(_get_vs_mode(mode)):
self.schedule_update_ha_state()
else:
raise ValueError("An error occurred while setting mode.")
self.schedule_update_ha_state()

def turn_on(
self,
Expand Down

0 comments on commit f6d69cc

Please sign in to comment.