Skip to content

Commit a4367c5

Browse files
committed
CR: more comment nitpicks
1 parent b334995 commit a4367c5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

plugwise_usb/nodes/sense.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ async def _load_defaults(self) -> None:
148148

149149
async def _load_from_cache(self) -> bool:
150150
"""Load states from previous cached information. Returns True if successful."""
151-
super_load_success = True
152-
if not await super()._load_from_cache():
153-
super_load_success = False
151+
super_load_success = await super()._load_from_cache()
154152
dirty = False
155153
if (humidity_enabled := self._humidity_enabled_from_cache()) is None:
156154
dirty = True
@@ -437,7 +435,7 @@ async def set_hysteresis_humidity_lower_bound(self, lower_bound: float) -> bool:
437435
return True
438436

439437
async def set_hysteresis_humidity_direction(self, state: bool) -> bool:
440-
"""Configure humitidy hysteresis to switch on or off on increase or decreasing direction.
438+
"""Configure humitidy hysteresis to switch on or off on increasing or decreasing direction.
441439
442440
Configuration request will be queued and will be applied the next time when node is awake for maintenance.
443441
"""
@@ -543,7 +541,7 @@ async def set_hysteresis_temperature_lower_bound(self, lower_bound: float) -> bo
543541
return True
544542

545543
async def set_hysteresis_temperature_direction(self, state: bool) -> bool:
546-
"""Configure temperature hysteresis to switch on or off on increase or decreasing direction.
544+
"""Configure temperature hysteresis to switch on or off on increasing or decreasing direction.
547545
548546
Configuration request will be queued and will be applied the next time when node is awake for maintenance.
549547
"""
@@ -597,6 +595,10 @@ async def _hysteresis_state_update(
597595
self._sense_statistics.temperature_state = switch_state
598596
elif switch_group == 2:
599597
self._sense_statistics.humidity_state = switch_state
598+
else:
599+
_LOGGER.debug(
600+
"Ignoring unknown switch_group %s for %s", switch_group, self.name
601+
)
600602

601603
await self.publish_feature_update_to_subscribers(
602604
NodeFeature.SENSE, self._sense_statistics
@@ -661,7 +663,7 @@ async def _configure_sense_humidity_task(self) -> bool:
661663
if self.humidity_enabled:
662664
if self.humidity_lower_bound > self.humidity_upper_bound:
663665
raise ValueError(
664-
f"Invalid humidity lower bound {self.humidity_lower_bound}. It must be equal or below the upper bound {self.humidity_upper_bound}."
666+
f"Invalid humidity lower bound {self.humidity_lower_bound}. It must be the upper bound {self.humidity_upper_bound}."
665667
)
666668
humidity_lower_bound = int(
667669
(self.humidity_lower_bound + SENSE_HUMIDITY_OFFSET)
@@ -715,7 +717,7 @@ async def _configure_sense_temperature_task(self) -> bool:
715717
if self.temperature_enabled:
716718
if self.temperature_lower_bound > self.temperature_upper_bound:
717719
raise ValueError(
718-
f"Invalid temperature lower bound {self.temperature_lower_bound}. It must be equal or below the upper bound {self.temperature_upper_bound}."
720+
f"Invalid temperature lower bound {self.temperature_lower_bound}. It must be the upper bound {self.temperature_upper_bound}."
719721
)
720722
temperature_lower_bound = int(
721723
(self.temperature_lower_bound + SENSE_TEMPERATURE_OFFSET)

0 commit comments

Comments
 (0)