File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -648,16 +648,16 @@ def _control_state(self, loc_id: str) -> str | bool:
648648
649649 def _presets_legacy (self ) -> dict [str , list [float ]]:
650650 """Helper-function for presets() - collect Presets for a legacy Anna."""
651- preset_dictionary : dict [str , list [float ]] = {}
651+ presets : dict [str , list [float ]] = {}
652652 for directive in self ._domain_objects .findall ("rule/directives/when/then" ):
653653 if directive is not None and "icon" in directive .keys ():
654654 # Ensure list of heating_setpoint, cooling_setpoint
655- preset_dictionary [directive .attrib ["icon" ]] = [
655+ presets [directive .attrib ["icon" ]] = [
656656 float (directive .attrib ["temperature" ]),
657657 0 ,
658658 ]
659659
660- return preset_dictionary
660+ return presets
661661
662662 def _presets (self , loc_id : str ) -> dict [str , list [float ]]:
663663 """Collect Presets for a Thermostat based on location_id."""
Original file line number Diff line number Diff line change @@ -547,7 +547,9 @@ async def _set_preset_legacy(self, preset: str) -> None:
547547
548548 async def set_preset (self , loc_id : str , preset : str ) -> None :
549549 """Set the given Preset on the relevant Thermostat - from LOCATIONS."""
550- if preset not in self ._presets (loc_id ):
550+ if presets := self ._presets (loc_id ) is None :
551+ raise PlugwiseError ("Plugwise: no presets available." )
552+ if preset not in presets :
551553 raise PlugwiseError ("Plugwise: invalid preset." )
552554
553555 if self ._smile_legacy :
You can’t perform that action at this time.
0 commit comments