Add OTGW domestic hot water enable option as service (#25849)

This commit is contained in:
Twan Coenraad 2019-08-14 15:35:05 +02:00 committed by Martin Hjelmare
parent 45bbd080f1
commit 76b781829e
3 changed files with 46 additions and 0 deletions

View File

@ -30,6 +30,7 @@ from .const import (
ATTR_GW_ID,
ATTR_MODE,
ATTR_LEVEL,
ATTR_DHW_OVRD,
CONF_CLIMATE,
CONF_FLOOR_TEMP,
CONF_PRECISION,
@ -38,6 +39,7 @@ from .const import (
SERVICE_RESET_GATEWAY,
SERVICE_SET_CLOCK,
SERVICE_SET_CONTROL_SETPOINT,
SERVICE_SET_HOT_WATER_OVRD,
SERVICE_SET_GPIO_MODE,
SERVICE_SET_LED_MODE,
SERVICE_SET_MAX_MOD,
@ -123,6 +125,16 @@ def register_services(hass):
),
}
)
service_set_hot_water_ovrd_schema = vol.Schema(
{
vol.Required(ATTR_GW_ID): vol.All(
cv.string, vol.In(hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS])
),
vol.Required(ATTR_DHW_OVRD): vol.Any(
vol.Equal("A"), vol.All(vol.Coerce(int), vol.Range(min=0, max=1))
),
}
)
service_set_gpio_mode_schema = vol.Schema(
vol.Any(
vol.Schema(
@ -216,6 +228,21 @@ def register_services(hass):
service_set_control_setpoint_schema,
)
async def set_dhw_ovrd(call):
"""Set the domestic hot water override on the OpenTherm Gateway."""
gw_dev = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][call.data[ATTR_GW_ID]]
gw_var = gw_vars.OTGW_DHW_OVRD
value = await gw_dev.gateway.set_hot_water_ovrd(call.data[ATTR_DHW_OVRD])
gw_dev.status.update({gw_var: value})
async_dispatcher_send(hass, gw_dev.update_signal, gw_dev.status)
hass.services.async_register(
DOMAIN,
SERVICE_SET_HOT_WATER_OVRD,
set_dhw_ovrd,
service_set_hot_water_ovrd_schema,
)
async def set_device_clock(call):
"""Set the clock on the OpenTherm Gateway."""
gw_dev = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][call.data[ATTR_GW_ID]]

View File

@ -6,6 +6,7 @@ from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS
ATTR_GW_ID = "gateway_id"
ATTR_MODE = "mode"
ATTR_LEVEL = "level"
ATTR_DHW_OVRD = "dhw_override"
CONF_CLIMATE = "climate"
CONF_FLOOR_TEMP = "floor_temperature"
@ -21,6 +22,7 @@ DEVICE_CLASS_PROBLEM = "problem"
SERVICE_RESET_GATEWAY = "reset_gateway"
SERVICE_SET_CLOCK = "set_clock"
SERVICE_SET_CONTROL_SETPOINT = "set_control_setpoint"
SERVICE_SET_HOT_WATER_OVRD = "set_hot_water_ovrd"
SERVICE_SET_GPIO_MODE = "set_gpio_mode"
SERVICE_SET_LED_MODE = "set_led_mode"
SERVICE_SET_MAX_MOD = "set_max_modulation"

View File

@ -35,6 +35,23 @@ set_control_setpoint:
A value of 0 disables the central heating setpoint override.
example: '37.5'
set_hot_water_ovrd:
description: >
Set the domestic hot water enable option on the gateway.
fields:
gateway_id:
description: The gateway_id of the OpenTherm Gateway.
example: 'opentherm_gateway'
dhw_override:
description: >
Control the domestic hot water enable option. If the boiler has
been configured to let the room unit control when to keep a
small amount of water preheated, this command can influence
that.
Value should be 0 or 1 to enable the override in off or on
state, or "A" to disable the override.
example: '1'
set_gpio_mode:
description: Change the function of the GPIO pins of the gateway.
fields: