1 """Support for hive water heaters."""
3 from datetime
import timedelta
6 import voluptuous
as vol
11 WaterHeaterEntityFeature,
19 from .
import refresh_system
24 SERVICE_BOOST_HOT_WATER,
27 from .entity
import HiveEntity
29 HOTWATER_NAME =
"Hot Water"
32 HIVE_TO_HASS_STATE = {
33 "SCHEDULE": STATE_ECO,
38 HASS_TO_HIVE_STATE = {
39 STATE_ECO:
"SCHEDULE",
44 SUPPORT_WATER_HEATER = [STATE_ECO, STATE_ON, STATE_OFF]
48 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
50 """Set up Hive thermostat based on a config entry."""
52 hive = hass.data[DOMAIN][entry.entry_id]
53 devices = hive.session.deviceList.get(
"water_heater")
57 platform = entity_platform.async_get_current_platform()
59 platform.async_register_entity_service(
60 SERVICE_BOOST_HOT_WATER,
62 vol.Optional(ATTR_TIME_PERIOD, default=
"00:30:00"): vol.All(
64 cv.positive_timedelta,
65 lambda td: td.total_seconds() // 60,
67 vol.Required(ATTR_ONOFF): vol.In(WATER_HEATER_MODES),
69 "async_hot_water_boost",
74 """Hive Water Heater Device."""
76 _attr_supported_features = WaterHeaterEntityFeature.OPERATION_MODE
77 _attr_temperature_unit = UnitOfTemperature.CELSIUS
78 _attr_operation_list = SUPPORT_WATER_HEATER
82 """Turn on hotwater."""
87 """Turn on hotwater."""
92 """Set operation mode."""
93 new_mode = HASS_TO_HIVE_STATE[operation_mode]
98 """Handle the service call."""
100 await self.
hivehive.hotwater.setBoostOn(self.
devicedevicedevice, time_period)
101 elif on_off ==
"off":
105 """Update all Node data from Hive."""
None async_turn_off(self, **Any kwargs)
None async_set_operation_mode(self, str operation_mode)
None async_hot_water_boost(self, int time_period, str on_off)
None async_turn_on(self, **Any kwargs)
web.Response get(self, web.Request request, str config_key)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)