File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -471,12 +471,7 @@ def _appliance_measurements(
471471 case "elga_status_code" :
472472 data ["elga_status_code" ] = int (appl_p_loc .text )
473473 case "select_dhw_mode" :
474- if self ._dhw_allowed_modes and "select_dhw_mode" not in data :
475- data ["select_dhw_mode" ] = appl_p_loc .text
476- if old_measurement == "domestic_hot_water_comfort_mode" :
477- data ["select_dhw_mode" ] = (
478- "comfort" if appl_p_loc .text == "on" else "off"
479- )
474+ self ._select_dhw_mode (appl_p_loc .text , data , old_measurement )
480475
481476 common_match_cases (measurement , attrs , appl_p_loc , data )
482477
@@ -489,6 +484,15 @@ def _appliance_measurements(
489484
490485 self ._count = count_data_items (self ._count , data )
491486
487+ def _select_dhw_mode (self , text : str , data : GwEntityData , measurement : str ) -> None :
488+ """Set the selected dhw mode."""
489+ if self ._dhw_allowed_modes and "select_dhw_mode" not in data :
490+ data ["select_dhw_mode" ] = text
491+ if measurement == "domestic_hot_water_comfort_mode" :
492+ data ["select_dhw_mode" ] = (
493+ "comfort" if text == "on" else "off"
494+ )
495+
492496 def _get_toggle_state (
493497 self ,
494498 xml : etree .Element ,
You can’t perform that action at this time.
0 commit comments