Add new device attributes to fritzbox climate (#17027)
* Add new device attributes to fritzbox climate With Fitz!OS 7 new parameters are introduced. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> * update requirements Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
This commit is contained in:
parent
3137099348
commit
68bda1c732
3 changed files with 23 additions and 7 deletions
|
@ -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):
|
||||
|
|
|
@ -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_DEVICE_LOCKED = 'device_locked'
|
||||
ATTR_STATE_LOCKED = 'locked'
|
||||
ATTR_STATE_BATTERY_LOW = 'battery_low'
|
||||
ATTR_STATE_DEVICE_LOCKED = 'device_locked'
|
||||
ATTR_STATE_HOLIDAY_MODE = 'holiday_mode'
|
||||
ATTR_STATE_LOCKED = 'locked'
|
||||
ATTR_STATE_SUMMER_MODE = 'summer_mode'
|
||||
ATTR_STATE_WINDOW_OPEN = 'window_open'
|
||||
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue