@@ -124,7 +124,7 @@ def schedules_temps(
124124 """
125125 Helper-function for schedules().
126126
127- Obtain the schedule temperature of the schedule.
127+ Obtain the temperature-setpoints of the schedule.
128128 """
129129 if name == NONE :
130130 return [] # pragma: no cover
@@ -965,6 +965,26 @@ def _cleanup_data(self, data: dict[str, Any]) -> None:
965965 if not self ._elga and "cooling_enabled" in data :
966966 data .pop ("cooling_enabled" ) # pragma: no cover
967967
968+ def _process_c_heating_state (self , data : dict [str , Any ]) -> None :
969+ """
970+ Helper-function for _get_appliance_data().
971+
972+ Process the central_heating_state value.
973+ """
974+ if self ._on_off_device :
975+ # Anna + OnOff heater: use central_heating_state to show heating_state
976+ # Solution for Core issue #81839
977+ if self .smile_name == "Smile Anna" :
978+ data ["heating_state" ] = data ["c_heating_state" ]
979+
980+ if self .smile_name == "Adam" :
981+ data ["heating_state" ] = False
982+ # Adam + OnOff cooling: use central_heating_state to show heating/cooling_state
983+ if self ._cooling_enabled :
984+ data ["cooling_state" ] = data ["c_heating_state" ]
985+ else :
986+ data ["heating_state" ] = data ["c_heating_state" ]
987+
968988 def _get_appliance_data (self , d_id : str ) -> DeviceData :
969989 """
970990 Helper-function for smile.py: _get_device_data().
@@ -1000,52 +1020,38 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
10001020 if d_id == self .gateway_id and self .smile_name == "Adam" :
10011021 self ._get_regulation_mode (appliance , data )
10021022
1003- # Anna + Elga and Adam/Anna + OnOff heater/cooler don't use intended_central_heating_state
1004- # to show the generic heating state
10051023 if "c_heating_state" in data :
1006- if self ._elga or (
1007- self .smile_name in ("Adam" , "Smile Anna" ) and self ._on_off_device
1008- ):
1009- data ["heating_state" ] = data ["c_heating_state" ]
1010- # Heating is not active when intended_boiler_temperature is 0
1011- if (
1012- "intended_boiler_temperature" in data
1013- and data ["intended_boiler_temperature" ] == 0
1014- ):
1015- data ["heating_state" ] = False
1016- # For Adam + OnOff cooling, central_heating_state = True means cooling is active
1017- # For Smile Anna, _cooling_active will be corrected in the next if-construc
1018- if self ._cooling_present :
1019- self ._cooling_active = True
1020-
1021- # Finally, remove c_heating_state from the output
1024+ self ._process_c_heating_state (data )
1025+ # Remove c_heating_state after processing
10221026 data .pop ("c_heating_state" )
10231027
1024- if (
1025- d_id == self ._heater_id
1026- and self .smile_name == "Smile Anna"
1027- and self ._cooling_present
1028- ):
1029- # Use elga_status_code or cooling_enabled to set _cooling_enabled to True
1030- # Elga
1028+ if d_id == self ._heater_id and self .smile_name == "Smile Anna" :
10311029 if "elga_status_code" in data :
1032- if "cooling_enabled" in data and not data ["cooling_enabled" ]:
1033- self ._cooling_present = False
1034- self ._cooling_enabled = data ["elga_status_code" ] in [8 , 9 ]
1035- self ._cooling_active = data ["elga_status_code" ] == 8
1030+ # Base heating_/cooling_state on the elga-status-code
1031+ data ["heating_state" ] = False
1032+ data ["cooling_state" ] = False
1033+ if data ["elga_status_code" ] in [4 , 10 ] or (
1034+ data ["elga_status_code" ] in [3 , 5 , 6 , 11 ] and not data ["dhw_state" ]
1035+ ):
1036+ data ["heating_state" ] = True
1037+ if data ["elga_status_code" ] == 8 :
1038+ data ["cooling_state" ] = self ._cooling_active = True
1039+
10361040 data .pop ("elga_status_code" , None )
1041+
1042+ # Determine _cooling_present and _cooling_enabled
1043+ if "cooling_enabled" in data and data ["cooling_enabled" ]:
1044+ self ._cooling_present = self ._cooling_enabled = True
1045+ data ["model" ] = "Generic heater/cooler"
1046+
10371047 # Elga has no cooling-switch
10381048 if "cooling_ena_switch" in data :
10391049 data .pop ("cooling_ena_switch" )
10401050 else :
1041- # Loria/Thermastate: look at cooling_state, not at cooling_enabled, not available on R32!
1042- # Anna + Elga >= 4.3.7: the Elga cooling-enabled state is shown but there is no cooling-switch
1043- for item in ("cooling_enabled" , "cooling_ena_switch" ):
1044- if item in data :
1045- self ._cooling_enabled = data [item ]
1046- self ._cooling_active = data ["cooling_state" ]
1047- # Execute one time is enough
1048- break
1051+ # Loria/Thermastage: cooling-related is based on cooling_state and modulation_level
1052+ if "cooling_state" in data :
1053+ self ._cooling_enabled = data ["cooling_state" ]
1054+ self ._cooling_active = data ["modulation_level" ] == 100
10491055
10501056 self ._cleanup_data (data )
10511057
0 commit comments