Skip to content

Commit f17c586

Browse files
committed
improve naming of dirty bit
1 parent 9a59910 commit f17c586

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

plugwise_usb/nodes/sense.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
CACHE_SENSE_HYSTERESIS_TEMPERATURE_UPPER_BOUND = "temperature_upper_bound"
6161
CACHE_SENSE_HYSTERESIS_TEMPERATURE_LOWER_BOUND = "temperature_lower_bound"
6262
CACHE_SENSE_HYSTERESIS_TEMPERATURE_DIRECTION = "temperature_direction"
63-
CACHE_SENSE_HYSTERESIS_DIRTY = "sense_hysteresis_dirty"
63+
CACHE_SENSE_HYSTERESIS_CONFIG_DIRTY = "sense_hysteresis_config_dirty"
6464

6565
DEFAULT_SENSE_HYSTERESIS_HUMIDITY_ENABLED: Final = False
6666
DEFAULT_SENSE_HYSTERESIS_HUMIDITY_UPPER_BOUND: Final = 24.0
@@ -181,7 +181,7 @@ async def _load_from_cache(self) -> bool:
181181
if (temperature_direction := self._temperature_direction_from_cache()) is None:
182182
dirty = True
183183
temperature_direction = DEFAULT_SENSE_HYSTERESIS_TEMPERATURE_DIRECTION
184-
dirty |= self._sense_hysteresis_dirty_from_cache()
184+
dirty |= self._sense_hysteresis_config_dirty_from_cache()
185185

186186
self._hysteresis_config = SenseHysteresisConfig(
187187
humidity_enabled=humidity_enabled,
@@ -254,9 +254,11 @@ def _temperature_direction_from_cache(self) -> bool | None:
254254
"""Load Temperature hysteresis switch direction from cache."""
255255
return self._get_cache_as_bool(CACHE_SENSE_HYSTERESIS_TEMPERATURE_DIRECTION)
256256

257-
def _sense_hysteresis_dirty_from_cache(self) -> bool:
257+
def _sense_hysteresis_config_dirty_from_cache(self) -> bool:
258258
"""Load sense hysteresis dirty from cache."""
259-
if (dirty := self._get_cache_as_bool(CACHE_SENSE_HYSTERESIS_DIRTY)) is not None:
259+
if (
260+
dirty := self._get_cache_as_bool(CACHE_SENSE_HYSTERESIS_CONFIG_DIRTY)
261+
) is not None:
260262
return dirty
261263
return True
262264

@@ -282,7 +284,7 @@ def hysteresis_config(self) -> SenseHysteresisConfig:
282284
temperature_upper_bound=self.temperature_upper_bound,
283285
temperature_lower_bound=self.temperature_lower_bound,
284286
temperature_direction=self.temperature_direction,
285-
dirty=self.dirty,
287+
dirty=self.hysteresis_config_dirty,
286288
)
287289

288290
@property
@@ -342,7 +344,7 @@ def temperature_direction(self) -> bool:
342344
return DEFAULT_SENSE_HYSTERESIS_TEMPERATURE_DIRECTION
343345

344346
@property
345-
def dirty(self) -> bool:
347+
def hysteresis_config_dirty(self) -> bool:
346348
"""Sense hysteresis configuration dirty flag."""
347349
return self._hysteresis_config.dirty
348350

@@ -783,7 +785,9 @@ async def _sense_configure_update(self) -> None:
783785
self._set_cache(
784786
CACHE_SENSE_HYSTERESIS_TEMPERATURE_DIRECTION, self.temperature_direction
785787
)
786-
self._set_cache(CACHE_SENSE_HYSTERESIS_DIRTY, self.dirty)
788+
self._set_cache(
789+
CACHE_SENSE_HYSTERESIS_CONFIG_DIRTY, self.hysteresis_config_dirty
790+
)
787791
await gather(
788792
self.publish_feature_update_to_subscribers(
789793
NodeFeature.SENSE_HYSTERESIS,

0 commit comments

Comments
 (0)