diff --git a/homeassistant/components/climate/fritzbox.py b/homeassistant/components/climate/fritzbox.py index 3eedb89a3b782b2e178716bcb7c99cb572e2b1ae..f2d13ee92f6d02127d5d0f93155798dff2cb9e6c 100644 --- a/homeassistant/components/climate/fritzbox.py +++ b/homeassistant/components/climate/fritzbox.py @@ -10,13 +10,15 @@ import requests from homeassistant.components.fritzbox import DOMAIN as FRITZBOX_DOMAIN from homeassistant.components.fritzbox import ( - ATTR_STATE_DEVICE_LOCKED, ATTR_STATE_BATTERY_LOW, ATTR_STATE_LOCKED) + ATTR_STATE_DEVICE_LOCKED, ATTR_STATE_BATTERY_LOW, ATTR_STATE_HOLIDAY_MODE, + ATTR_STATE_LOCKED, ATTR_STATE_SUMMER_MODE, + ATTR_STATE_WINDOW_OPEN) from homeassistant.components.climate import ( ATTR_OPERATION_MODE, ClimateDevice, STATE_ECO, STATE_HEAT, STATE_MANUAL, STATE_OFF, STATE_ON, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE) from homeassistant.const import ( - ATTR_TEMPERATURE, PRECISION_HALVES, TEMP_CELSIUS) + ATTR_BATTERY_LEVEL, ATTR_TEMPERATURE, PRECISION_HALVES, TEMP_CELSIUS) DEPENDENCIES = ['fritzbox'] _LOGGER = logging.getLogger(__name__) @@ -151,10 +153,21 @@ class FritzboxThermostat(ClimateDevice): def device_state_attributes(self): """Return the device specific state attributes.""" attrs = { + ATTR_STATE_BATTERY_LOW: self._device.battery_low, ATTR_STATE_DEVICE_LOCKED: self._device.device_lock, ATTR_STATE_LOCKED: self._device.lock, - ATTR_STATE_BATTERY_LOW: self._device.battery_low, } + + # the following attributes are available since fritzos 7 + if self._device.battery_level is not None: + attrs[ATTR_BATTERY_LEVEL] = self._device.battery_level + if self._device.holiday_active is not None: + attrs[ATTR_STATE_HOLIDAY_MODE] = self._device.holiday_active + if self._device.summer_active is not None: + attrs[ATTR_STATE_SUMMER_MODE] = self._device.summer_active + if ATTR_STATE_WINDOW_OPEN is not None: + attrs[ATTR_STATE_WINDOW_OPEN] = self._device.window_open + return attrs def update(self): diff --git a/homeassistant/components/fritzbox.py b/homeassistant/components/fritzbox.py index a3c35aaa59719c9aa261a4a9b973f782424033ad..49bc4c8f6e6af454db214faac326641353ed1f7a 100644 --- a/homeassistant/components/fritzbox.py +++ b/homeassistant/components/fritzbox.py @@ -16,15 +16,18 @@ from homeassistant.helpers import discovery _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ['pyfritzhome==0.3.7'] +REQUIREMENTS = ['pyfritzhome==0.4.0'] SUPPORTED_DOMAINS = ['climate', 'switch'] DOMAIN = 'fritzbox' +ATTR_STATE_BATTERY_LOW = 'battery_low' ATTR_STATE_DEVICE_LOCKED = 'device_locked' +ATTR_STATE_HOLIDAY_MODE = 'holiday_mode' ATTR_STATE_LOCKED = 'locked' -ATTR_STATE_BATTERY_LOW = 'battery_low' +ATTR_STATE_SUMMER_MODE = 'summer_mode' +ATTR_STATE_WINDOW_OPEN = 'window_open' CONFIG_SCHEMA = vol.Schema({ diff --git a/requirements_all.txt b/requirements_all.txt index 853e404c8b1609ea83c645d5d078c2f99881a4cb..87c8ffdbb0a4c0bda879972a1962cd6d6e054b8b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -884,7 +884,7 @@ pyflic-homeassistant==0.4.dev0 pyfnip==0.2 # homeassistant.components.fritzbox -pyfritzhome==0.3.7 +pyfritzhome==0.4.0 # homeassistant.components.ifttt pyfttt==0.3