32
32
ATTR_HVAC_MODE ,
33
33
ATTR_TARGET_TEMP_HIGH ,
34
34
ATTR_TARGET_TEMP_LOW ,
35
+ PRESET_AWAY ,
36
+ PRESET_NONE ,
37
+ PRESET_ECO ,
38
+ PRESET_BOOST ,
39
+ PRESET_COMFORT ,
40
+ PRESET_HOME ,
41
+ PRESET_SLEEP ,
42
+ PRESET_ACTIVITY ,
43
+ SUPPORT_PRESET_MODE ,
35
44
)
36
45
from homeassistant .components .climate .const import (
37
46
ATTR_MAX_TEMP ,
@@ -249,6 +258,7 @@ def __init__(
249
258
self ._device_class = device_class
250
259
self ._state_class = state_class
251
260
self ._hvac_list = [HVACMode .HEAT , HVACMode .OFF ]
261
+ self ._preset_mode = PRESET_NONE
252
262
self .map_on_hvac_mode = HVACMode .HEAT
253
263
self .next_valve_maintenance = datetime .now () + timedelta (
254
264
hours = randint (1 , 24 * 5 )
@@ -261,7 +271,7 @@ def __init__(
261
271
self .bt_max_temp = 30
262
272
self .bt_target_temp = 5.0
263
273
self .bt_target_cooltemp = None
264
- self ._support_flags = SUPPORT_FLAGS
274
+ self ._support_flags = SUPPORT_FLAGS | SUPPORT_PRESET_MODE
265
275
self .bt_hvac_mode = None
266
276
self .closed_window_triggered = False
267
277
self .call_for_heat = True
@@ -1258,6 +1268,12 @@ async def async_set_temperature(self, **kwargs) -> None:
1258
1268
self .async_write_ha_state ()
1259
1269
await self .control_queue_task .put (self )
1260
1270
1271
+ async def async_turn_off (self ) -> None :
1272
+ await self .async_set_hvac_mode (HVACMode .OFF )
1273
+
1274
+ async def async_turn_on (self ) -> None :
1275
+ await self .async_set_hvac_mode (HVACMode .HEATING )
1276
+
1261
1277
@property
1262
1278
def min_temp (self ):
1263
1279
"""Return the minimum temperature.
@@ -1316,14 +1332,29 @@ def supported_features(self):
1316
1332
return (
1317
1333
ClimateEntityFeature .TARGET_TEMPERATURE_RANGE
1318
1334
| ClimateEntityFeature .PRESET_MODE
1319
- | ClimateEntityFeature .PRESET_MODE
1320
1335
| ClimateEntityFeature .TURN_OFF
1321
1336
| ClimateEntityFeature .TURN_ON
1322
1337
)
1323
1338
return (
1324
1339
ClimateEntityFeature .TARGET_TEMPERATURE
1325
1340
| ClimateEntityFeature .PRESET_MODE
1326
- | ClimateEntityFeature .PRESET_MODE
1327
1341
| ClimateEntityFeature .TURN_OFF
1328
1342
| ClimateEntityFeature .TURN_ON
1329
1343
)
1344
+
1345
+ @property
1346
+ def preset_mode (self ):
1347
+ return self ._preset_mode
1348
+
1349
+ @property
1350
+ def preset_modes (self ):
1351
+ return [
1352
+ PRESET_NONE ,
1353
+ # PRESET_AWAY,
1354
+ # PRESET_ECO,
1355
+ # PRESET_COMFORT,
1356
+ # PRESET_BOOST,
1357
+ # PRESET_SLEEP,
1358
+ # PRESET_ACTIVITY,
1359
+ # PRESET_HOME,
1360
+ ]
0 commit comments