diff --git a/homeassistant/components/climate/knx.py b/homeassistant/components/climate/knx.py index 9bf44c9b9ab..784d8a4ed28 100644 --- a/homeassistant/components/climate/knx.py +++ b/homeassistant/components/climate/knx.py @@ -14,6 +14,8 @@ from homeassistant.core import callback import homeassistant.helpers.config_validation as cv CONF_SETPOINT_ADDRESS = 'setpoint_address' +CONF_SETPOINT_SHIFT_ADDRESS = 'setpoint_shift_address' +CONF_SETPOINT_SHIFT_STATE_ADDRESS = 'setpoint_shift_state_address' CONF_TEMPERATURE_ADDRESS = 'temperature_address' CONF_TARGET_TEMPERATURE_ADDRESS = 'target_temperature_address' CONF_OPERATION_MODE_ADDRESS = 'operation_mode_address' @@ -33,6 +35,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_SETPOINT_ADDRESS): cv.string, vol.Required(CONF_TEMPERATURE_ADDRESS): cv.string, vol.Required(CONF_TARGET_TEMPERATURE_ADDRESS): cv.string, + vol.Optional(CONF_SETPOINT_SHIFT_ADDRESS): cv.string, + vol.Optional(CONF_SETPOINT_SHIFT_STATE_ADDRESS): cv.string, vol.Optional(CONF_OPERATION_MODE_ADDRESS): cv.string, vol.Optional(CONF_OPERATION_MODE_STATE_ADDRESS): cv.string, vol.Optional(CONF_CONTROLLER_STATUS_ADDRESS): cv.string, @@ -82,6 +86,10 @@ def async_add_devices_config(hass, config, async_add_devices): CONF_TARGET_TEMPERATURE_ADDRESS), group_address_setpoint=config.get( CONF_SETPOINT_ADDRESS), + group_address_setpoint_shift=config.get( + CONF_SETPOINT_SHIFT_ADDRESS), + group_address_setpoint_shift_state=config.get( + CONF_SETPOINT_SHIFT_STATE_ADDRESS), group_address_operation_mode=config.get( CONF_OPERATION_MODE_ADDRESS), group_address_operation_mode_state=config.get( @@ -140,13 +148,29 @@ class KNXClimate(ClimateDevice): @property def current_temperature(self): """Return the current temperature.""" - return self.device.temperature + return self.device.temperature.value @property def target_temperature(self): """Return the temperature we try to reach.""" - if self.device.supports_target_temperature: - return self.device.target_temperature + return self.device.target_temperature_comfort + + @property + def target_temperature_high(self): + """Return the highbound target temperature we try to reach.""" + if self.device.target_temperature_comfort: + return max( + self.device.target_temperature_comfort, + self.device.target_temperature.value) + return None + + @property + def target_temperature_low(self): + """Return the lowbound target temperature we try to reach.""" + if self.device.target_temperature_comfort: + return min( + self.device.target_temperature_comfort, + self.device.target_temperature.value) return None @asyncio.coroutine @@ -155,8 +179,8 @@ class KNXClimate(ClimateDevice): temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return - if self.device.supports_target_temperature: - yield from self.device.set_target_temperature(temperature) + yield from self.device.set_target_temperature_comfort(temperature) + yield from self.async_update_ha_state() @property def current_operation(self): diff --git a/homeassistant/components/knx.py b/homeassistant/components/knx.py index 4b976e6ca3f..b86574c1d2e 100644 --- a/homeassistant/components/knx.py +++ b/homeassistant/components/knx.py @@ -26,6 +26,7 @@ CONF_KNX_TUNNELING = "tunneling" CONF_KNX_LOCAL_IP = "local_ip" CONF_KNX_FIRE_EVENT = "fire_event" CONF_KNX_FIRE_EVENT_FILTER = "fire_event_filter" +CONF_KNX_STATE_UPDATER = "state_updater" SERVICE_KNX_SEND = "send" SERVICE_KNX_ATTR_ADDRESS = "address" @@ -35,7 +36,7 @@ ATTR_DISCOVER_DEVICES = 'devices' _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ['xknx==0.7.14'] +REQUIREMENTS = ['xknx==0.7.16'] TUNNELING_SCHEMA = vol.Schema({ vol.Required(CONF_HOST): cv.string, @@ -58,7 +59,8 @@ CONFIG_SCHEMA = vol.Schema({ vol.Inclusive(CONF_KNX_FIRE_EVENT_FILTER, 'fire_ev'): vol.All( cv.ensure_list, - [cv.string]) + [cv.string]), + vol.Optional(CONF_KNX_STATE_UPDATER, default=True): cv.boolean, }) }, extra=vol.ALLOW_EXTRA) @@ -134,7 +136,7 @@ class KNXModule(object): """Start KNX object. Connect to tunneling or Routing device.""" connection_config = self.connection_config() yield from self.xknx.start( - state_updater=True, + state_updater=self.config[DOMAIN][CONF_KNX_STATE_UPDATER], connection_config=connection_config) self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.stop) self.initialized = True diff --git a/requirements_all.txt b/requirements_all.txt index 83012a46ee5..dfee997dc19 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1059,7 +1059,7 @@ xbee-helper==0.0.7 xboxapi==0.1.1 # homeassistant.components.knx -xknx==0.7.14 +xknx==0.7.16 # homeassistant.components.media_player.bluesound # homeassistant.components.sensor.swiss_hydrological_data