diff --git a/homeassistant/components/opentherm_gw/__init__.py b/homeassistant/components/opentherm_gw/__init__.py index 7e91f78f74c..b20d97dadce 100644 --- a/homeassistant/components/opentherm_gw/__init__.py +++ b/homeassistant/components/opentherm_gw/__init__.py @@ -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]] diff --git a/homeassistant/components/opentherm_gw/const.py b/homeassistant/components/opentherm_gw/const.py index 5b0411a2c72..77b0bf9b313 100644 --- a/homeassistant/components/opentherm_gw/const.py +++ b/homeassistant/components/opentherm_gw/const.py @@ -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" diff --git a/homeassistant/components/opentherm_gw/services.yaml b/homeassistant/components/opentherm_gw/services.yaml index d8fe2c7e406..4e9e727ef5a 100644 --- a/homeassistant/components/opentherm_gw/services.yaml +++ b/homeassistant/components/opentherm_gw/services.yaml @@ -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: