102
102
CONF_FAN_ON_WITH_AC ,
103
103
CONF_FLOOR_SENSOR ,
104
104
CONF_HEAT_COOL_MODE ,
105
+ CONF_HEAT_PUMP_COOLING ,
105
106
CONF_HEATER ,
106
107
CONF_HOT_TOLERANCE ,
107
108
CONF_HUMIDITY_SENSOR ,
187
188
vol .Optional (CONF_MOIST_TOLERANCE ): vol .Coerce (float ),
188
189
}
189
190
191
+ HEAT_PUMP_SCHEMA = {
192
+ vol .Optional (CONF_HEAT_PUMP_COOLING ): cv .entity_id ,
193
+ }
194
+
190
195
PLATFORM_SCHEMA = PLATFORM_SCHEMA .extend (
191
196
{
192
197
vol .Required (CONF_HEATER ): cv .entity_id ,
238
243
239
244
PLATFORM_SCHEMA = PLATFORM_SCHEMA .extend (HYGROSTAT_SCHEMA )
240
245
246
+ PLATFORM_SCHEMA = PLATFORM_SCHEMA .extend (HEAT_PUMP_SCHEMA )
247
+
241
248
# Add the old presets schema to avoid breaking change
242
249
PLATFORM_SCHEMA = PLATFORM_SCHEMA .extend (
243
250
{vol .Optional (v ): vol .Coerce (float ) for (k , v ) in CONF_PRESETS_OLD .items ()}
@@ -260,6 +267,7 @@ async def async_setup_platform(
260
267
sensor_outside_entity_id = config .get (CONF_OUTSIDE_SENSOR )
261
268
sensor_humidity_entity_id = config .get (CONF_HUMIDITY_SENSOR )
262
269
sensor_stale_duration : timedelta | None = config .get (CONF_STALE_DURATION )
270
+ sensor_heat_pump_cooling_entity_id = config .get (CONF_HEAT_PUMP_COOLING )
263
271
keep_alive = config .get (CONF_KEEP_ALIVE )
264
272
265
273
precision = config .get (CONF_PRECISION )
@@ -290,6 +298,7 @@ async def async_setup_platform(
290
298
sensor_outside_entity_id ,
291
299
sensor_humidity_entity_id ,
292
300
sensor_stale_duration ,
301
+ sensor_heat_pump_cooling_entity_id ,
293
302
keep_alive ,
294
303
precision ,
295
304
unit ,
@@ -343,6 +352,7 @@ def __init__(
343
352
sensor_outside_entity_id ,
344
353
sensor_humidity_entity_id ,
345
354
sensor_stale_duration ,
355
+ sensor_heat_pump_cooling_entity_id ,
346
356
keep_alive ,
347
357
precision ,
348
358
unit ,
@@ -378,6 +388,7 @@ def __init__(
378
388
self .sensor_floor_entity_id = sensor_floor_entity_id
379
389
self .sensor_outside_entity_id = sensor_outside_entity_id
380
390
self .sensor_humidity_entity_id = sensor_humidity_entity_id
391
+ self .sensor_heat_pump_cooling_entity_id = sensor_heat_pump_cooling_entity_id
381
392
382
393
self ._keep_alive = keep_alive
383
394
@@ -473,6 +484,19 @@ async def async_added_to_hass(self) -> None:
473
484
)
474
485
)
475
486
487
+ if self .sensor_heat_pump_cooling_entity_id is not None :
488
+ _LOGGER .debug (
489
+ "Adding heat pump cooling sensor listener: %s" ,
490
+ self .sensor_heat_pump_cooling_entity_id ,
491
+ )
492
+ self .async_on_remove (
493
+ async_track_state_change_event (
494
+ self .hass ,
495
+ [self .sensor_heat_pump_cooling_entity_id ],
496
+ self ._async_entity_heat_pump_cooling_changed_event ,
497
+ )
498
+ )
499
+
476
500
if self ._keep_alive :
477
501
self .async_on_remove (
478
502
async_track_time_interval (
@@ -868,6 +892,8 @@ def _set_temperatures_dual_mode(self, temperatures: TargetTemperatures) -> None:
868
892
temp_low = temperatures .temp_low
869
893
temp_high = temperatures .temp_high
870
894
895
+ self .hvac_device .on_target_temperature_change (temperatures )
896
+
871
897
if self .features .is_target_mode :
872
898
if temperature is None :
873
899
return
@@ -1028,6 +1054,27 @@ async def _async_sensor_humidity_changed(
1028
1054
await self ._async_control_climate ()
1029
1055
self .async_write_ha_state ()
1030
1056
1057
+ async def _async_entity_heat_pump_cooling_changed_event (
1058
+ self , event : Event [EventStateChangedData ]
1059
+ ) -> None :
1060
+ data = event .data
1061
+
1062
+ self .hvac_device .on_entity_state_changed (data ["entity_id" ], data ["new_state" ])
1063
+
1064
+ await self ._asyn_entity_heat_pump_cooling_changed (data ["new_state" ])
1065
+ self ._attr_hvac_modes = self .hvac_device .hvac_modes
1066
+ self .async_write_ha_state ()
1067
+
1068
+ async def _asyn_entity_heat_pump_cooling_changed (
1069
+ self , new_state : State | None , trigger_control = True
1070
+ ) -> None :
1071
+ """Handle heat pump cooling changes."""
1072
+ _LOGGER .info ("Entity heat pump cooling change: %s" , new_state )
1073
+
1074
+ if trigger_control :
1075
+ await self ._async_control_climate ()
1076
+ self .async_write_ha_state ()
1077
+
1031
1078
async def _check_device_initial_state (self ) -> None :
1032
1079
"""Prevent the device from keep running if HVACMode.OFF."""
1033
1080
_LOGGER .debug ("Checking device initial state" )
0 commit comments