mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add hive boost off functionality (#48701)
* Add boost off functionality * Added backwards compatibility * Update homeassistant/components/hive/services.yaml Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/hive/climate.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
3ca69f5568
commit
c2d98f1905
@ -1,5 +1,6 @@
|
|||||||
"""Support for the Hive climate devices."""
|
"""Support for the Hive climate devices."""
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -20,7 +21,12 @@ from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
|||||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
|
|
||||||
from . import HiveEntity, refresh_system
|
from . import HiveEntity, refresh_system
|
||||||
from .const import ATTR_TIME_PERIOD, DOMAIN, SERVICE_BOOST_HEATING
|
from .const import (
|
||||||
|
ATTR_TIME_PERIOD,
|
||||||
|
DOMAIN,
|
||||||
|
SERVICE_BOOST_HEATING_OFF,
|
||||||
|
SERVICE_BOOST_HEATING_ON,
|
||||||
|
)
|
||||||
|
|
||||||
HIVE_TO_HASS_STATE = {
|
HIVE_TO_HASS_STATE = {
|
||||||
"SCHEDULE": HVAC_MODE_AUTO,
|
"SCHEDULE": HVAC_MODE_AUTO,
|
||||||
@ -47,6 +53,7 @@ SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]
|
|||||||
SUPPORT_PRESET = [PRESET_NONE, PRESET_BOOST]
|
SUPPORT_PRESET = [PRESET_NONE, PRESET_BOOST]
|
||||||
PARALLEL_UPDATES = 0
|
PARALLEL_UPDATES = 0
|
||||||
SCAN_INTERVAL = timedelta(seconds=15)
|
SCAN_INTERVAL = timedelta(seconds=15)
|
||||||
|
_LOGGER = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry, async_add_entities):
|
async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
@ -63,7 +70,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||||||
platform = entity_platform.current_platform.get()
|
platform = entity_platform.current_platform.get()
|
||||||
|
|
||||||
platform.async_register_entity_service(
|
platform.async_register_entity_service(
|
||||||
SERVICE_BOOST_HEATING,
|
"boost_heating",
|
||||||
{
|
{
|
||||||
vol.Required(ATTR_TIME_PERIOD): vol.All(
|
vol.Required(ATTR_TIME_PERIOD): vol.All(
|
||||||
cv.time_period,
|
cv.time_period,
|
||||||
@ -75,6 +82,25 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||||||
"async_heating_boost",
|
"async_heating_boost",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
platform.async_register_entity_service(
|
||||||
|
SERVICE_BOOST_HEATING_ON,
|
||||||
|
{
|
||||||
|
vol.Required(ATTR_TIME_PERIOD): vol.All(
|
||||||
|
cv.time_period,
|
||||||
|
cv.positive_timedelta,
|
||||||
|
lambda td: td.total_seconds() // 60,
|
||||||
|
),
|
||||||
|
vol.Optional(ATTR_TEMPERATURE, default="25.0"): vol.Coerce(float),
|
||||||
|
},
|
||||||
|
"async_heating_boost_on",
|
||||||
|
)
|
||||||
|
|
||||||
|
platform.async_register_entity_service(
|
||||||
|
SERVICE_BOOST_HEATING_OFF,
|
||||||
|
{},
|
||||||
|
"async_heating_boost_off",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class HiveClimateEntity(HiveEntity, ClimateEntity):
|
class HiveClimateEntity(HiveEntity, ClimateEntity):
|
||||||
"""Hive Climate Device."""
|
"""Hive Climate Device."""
|
||||||
@ -198,11 +224,23 @@ class HiveClimateEntity(HiveEntity, ClimateEntity):
|
|||||||
temperature = curtemp + 0.5
|
temperature = curtemp + 0.5
|
||||||
await self.hive.heating.setBoostOn(self.device, 30, temperature)
|
await self.hive.heating.setBoostOn(self.device, 30, temperature)
|
||||||
|
|
||||||
@refresh_system
|
|
||||||
async def async_heating_boost(self, time_period, temperature):
|
async def async_heating_boost(self, time_period, temperature):
|
||||||
|
"""Handle boost heating service call."""
|
||||||
|
_LOGGER.warning(
|
||||||
|
"Hive Service heating_boost will be removed in 2021.7.0, please update to heating_boost_on"
|
||||||
|
)
|
||||||
|
await self.async_heating_boost_on(time_period, temperature)
|
||||||
|
|
||||||
|
@refresh_system
|
||||||
|
async def async_heating_boost_on(self, time_period, temperature):
|
||||||
"""Handle boost heating service call."""
|
"""Handle boost heating service call."""
|
||||||
await self.hive.heating.setBoostOn(self.device, time_period, temperature)
|
await self.hive.heating.setBoostOn(self.device, time_period, temperature)
|
||||||
|
|
||||||
|
@refresh_system
|
||||||
|
async def async_heating_boost_off(self):
|
||||||
|
"""Handle boost heating service call."""
|
||||||
|
await self.hive.heating.setBoostOff(self.device)
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update all Node data from Hive."""
|
"""Update all Node data from Hive."""
|
||||||
await self.hive.session.updateData(self.device)
|
await self.hive.session.updateData(self.device)
|
||||||
|
@ -16,5 +16,6 @@ PLATFORM_LOOKUP = {
|
|||||||
"water_heater": "water_heater",
|
"water_heater": "water_heater",
|
||||||
}
|
}
|
||||||
SERVICE_BOOST_HOT_WATER = "boost_hot_water"
|
SERVICE_BOOST_HOT_WATER = "boost_hot_water"
|
||||||
SERVICE_BOOST_HEATING = "boost_heating"
|
SERVICE_BOOST_HEATING_ON = "boost_heating_on"
|
||||||
|
SERVICE_BOOST_HEATING_OFF = "boost_heating_off"
|
||||||
WATER_HEATER_MODES = ["on", "off"]
|
WATER_HEATER_MODES = ["on", "off"]
|
||||||
|
@ -1,5 +1,24 @@
|
|||||||
boost_heating:
|
boost_heating:
|
||||||
name: Boost Heating
|
name: Boost Heating (To be deprecated)
|
||||||
|
description: To be deprecated please use boost_heating_on.
|
||||||
|
fields:
|
||||||
|
entity_id:
|
||||||
|
name: Entity ID
|
||||||
|
description: Select entity_id to boost.
|
||||||
|
required: true
|
||||||
|
example: climate.heating
|
||||||
|
time_period:
|
||||||
|
name: Time Period
|
||||||
|
description: Set the time period for the boost.
|
||||||
|
required: true
|
||||||
|
example: 01:30:00
|
||||||
|
temperature:
|
||||||
|
name: Temperature
|
||||||
|
description: Set the target temperature for the boost period.
|
||||||
|
required: true
|
||||||
|
example: 20.5
|
||||||
|
boost_heating_on:
|
||||||
|
name: Boost Heating On
|
||||||
description: Set the boost mode ON defining the period of time and the desired target temperature for the boost.
|
description: Set the boost mode ON defining the period of time and the desired target temperature for the boost.
|
||||||
fields:
|
fields:
|
||||||
entity_id:
|
entity_id:
|
||||||
@ -30,6 +49,19 @@ boost_heating:
|
|||||||
step: 0.5
|
step: 0.5
|
||||||
unit_of_measurement: degrees
|
unit_of_measurement: degrees
|
||||||
mode: slider
|
mode: slider
|
||||||
|
boost_heating_off:
|
||||||
|
name: Boost Heating Off
|
||||||
|
description: Set the boost mode OFF.
|
||||||
|
fields:
|
||||||
|
entity_id:
|
||||||
|
name: Entity ID
|
||||||
|
description: Select entity_id to turn boost off.
|
||||||
|
required: true
|
||||||
|
example: climate.heating
|
||||||
|
selector:
|
||||||
|
entity:
|
||||||
|
integration: hive
|
||||||
|
domain: climate
|
||||||
boost_hot_water:
|
boost_hot_water:
|
||||||
name: Boost Hotwater
|
name: Boost Hotwater
|
||||||
description: Set the boost mode ON or OFF defining the period of time for the boost.
|
description: Set the boost mode ON or OFF defining the period of time for the boost.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user