mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 18:57:57 +00:00
Update homematicip_cloud with enum states (#15460)
* Update to next version with enum states * Change to generic dimmer class * Update of requirement files * Update to hmip lib to v0.9.7 * Missing update of requirements files * Cleanup of icon properties
This commit is contained in:
parent
ca4f69f557
commit
6db069881b
@ -21,8 +21,6 @@ ATTR_EVENT_DELAY = 'event_delay'
|
|||||||
ATTR_MOTION_DETECTED = 'motion_detected'
|
ATTR_MOTION_DETECTED = 'motion_detected'
|
||||||
ATTR_ILLUMINATION = 'illumination'
|
ATTR_ILLUMINATION = 'illumination'
|
||||||
|
|
||||||
HMIP_OPEN = 'open'
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_devices,
|
async def async_setup_platform(hass, config, async_add_devices,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
@ -61,11 +59,13 @@ class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice):
|
|||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return true if the shutter contact is on/open."""
|
"""Return true if the shutter contact is on/open."""
|
||||||
|
from homematicip.base.enums import WindowState
|
||||||
|
|
||||||
if self._device.sabotage:
|
if self._device.sabotage:
|
||||||
return True
|
return True
|
||||||
if self._device.windowState is None:
|
if self._device.windowState is None:
|
||||||
return None
|
return None
|
||||||
return self._device.windowState.lower() == HMIP_OPEN
|
return self._device.windowState == WindowState.OPEN
|
||||||
|
|
||||||
|
|
||||||
class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorDevice):
|
class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorDevice):
|
||||||
|
@ -19,7 +19,7 @@ from .config_flow import configured_haps
|
|||||||
from .hap import HomematicipHAP, HomematicipAuth # noqa: F401
|
from .hap import HomematicipHAP, HomematicipAuth # noqa: F401
|
||||||
from .device import HomematicipGenericDevice # noqa: F401
|
from .device import HomematicipGenericDevice # noqa: F401
|
||||||
|
|
||||||
REQUIREMENTS = ['homematicip==0.9.6']
|
REQUIREMENTS = ['homematicip==0.9.8']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ async def async_setup_platform(hass, config, async_add_devices,
|
|||||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
async def async_setup_entry(hass, config_entry, async_add_devices):
|
||||||
"""Set up the HomematicIP lights from a config entry."""
|
"""Set up the HomematicIP lights from a config entry."""
|
||||||
from homematicip.aio.device import (
|
from homematicip.aio.device import (
|
||||||
AsyncBrandSwitchMeasuring, AsyncPluggableDimmer)
|
AsyncBrandSwitchMeasuring, AsyncDimmer)
|
||||||
|
|
||||||
home = hass.data[HMIPC_DOMAIN][config_entry.data[HMIPC_HAPID]].home
|
home = hass.data[HMIPC_DOMAIN][config_entry.data[HMIPC_HAPID]].home
|
||||||
devices = []
|
devices = []
|
||||||
for device in home.devices:
|
for device in home.devices:
|
||||||
if isinstance(device, AsyncBrandSwitchMeasuring):
|
if isinstance(device, AsyncBrandSwitchMeasuring):
|
||||||
devices.append(HomematicipLightMeasuring(home, device))
|
devices.append(HomematicipLightMeasuring(home, device))
|
||||||
elif isinstance(device, AsyncPluggableDimmer):
|
elif isinstance(device, AsyncDimmer):
|
||||||
devices.append(HomematicipDimmer(home, device))
|
devices.append(HomematicipDimmer(home, device))
|
||||||
|
|
||||||
if devices:
|
if devices:
|
||||||
|
@ -24,14 +24,6 @@ ATTR_TEMPERATURE = 'temperature'
|
|||||||
ATTR_TEMPERATURE_OFFSET = 'temperature_offset'
|
ATTR_TEMPERATURE_OFFSET = 'temperature_offset'
|
||||||
ATTR_HUMIDITY = 'humidity'
|
ATTR_HUMIDITY = 'humidity'
|
||||||
|
|
||||||
HMIP_UPTODATE = 'up_to_date'
|
|
||||||
HMIP_VALVE_DONE = 'adaption_done'
|
|
||||||
HMIP_SABOTAGE = 'sabotage'
|
|
||||||
|
|
||||||
STATE_OK = 'ok'
|
|
||||||
STATE_LOW_BATTERY = 'low_battery'
|
|
||||||
STATE_SABOTAGE = 'sabotage'
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_devices,
|
async def async_setup_platform(hass, config, async_add_devices,
|
||||||
discovery_info=None):
|
discovery_info=None):
|
||||||
@ -83,44 +75,17 @@ class HomematicipAccesspointStatus(HomematicipGenericDevice):
|
|||||||
"""Device available."""
|
"""Device available."""
|
||||||
return self._home.connected
|
return self._home.connected
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unit_of_measurement(self):
|
||||||
|
"""Return the unit this state is expressed in."""
|
||||||
|
return '%'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return the state attributes of the access point."""
|
"""Return the state attributes of the access point."""
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
class HomematicipDeviceStatus(HomematicipGenericDevice):
|
|
||||||
"""Representation of an HomematicIP device status."""
|
|
||||||
|
|
||||||
def __init__(self, home, device):
|
|
||||||
"""Initialize generic status device."""
|
|
||||||
super().__init__(home, device, 'Status')
|
|
||||||
|
|
||||||
@property
|
|
||||||
def icon(self):
|
|
||||||
"""Return the icon of the status device."""
|
|
||||||
if (hasattr(self._device, 'sabotage') and
|
|
||||||
self._device.sabotage == HMIP_SABOTAGE):
|
|
||||||
return 'mdi:alert'
|
|
||||||
elif self._device.lowBat:
|
|
||||||
return 'mdi:battery-outline'
|
|
||||||
elif self._device.updateState.lower() != HMIP_UPTODATE:
|
|
||||||
return 'mdi:refresh'
|
|
||||||
return 'mdi:check'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def state(self):
|
|
||||||
"""Return the state of the generic device."""
|
|
||||||
if (hasattr(self._device, 'sabotage') and
|
|
||||||
self._device.sabotage == HMIP_SABOTAGE):
|
|
||||||
return STATE_SABOTAGE
|
|
||||||
elif self._device.lowBat:
|
|
||||||
return STATE_LOW_BATTERY
|
|
||||||
elif self._device.updateState.lower() != HMIP_UPTODATE:
|
|
||||||
return self._device.updateState.lower()
|
|
||||||
return STATE_OK
|
|
||||||
|
|
||||||
|
|
||||||
class HomematicipHeatingThermostat(HomematicipGenericDevice):
|
class HomematicipHeatingThermostat(HomematicipGenericDevice):
|
||||||
"""MomematicIP heating thermostat representation."""
|
"""MomematicIP heating thermostat representation."""
|
||||||
|
|
||||||
@ -131,15 +96,19 @@ class HomematicipHeatingThermostat(HomematicipGenericDevice):
|
|||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
"""Return the icon."""
|
"""Return the icon."""
|
||||||
if self._device.valveState.lower() != HMIP_VALVE_DONE:
|
from homematicip.base.enums import ValveState
|
||||||
|
|
||||||
|
if self._device.valveState != ValveState.ADAPTION_DONE:
|
||||||
return 'mdi:alert'
|
return 'mdi:alert'
|
||||||
return 'mdi:radiator'
|
return 'mdi:radiator'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the radiator valve."""
|
"""Return the state of the radiator valve."""
|
||||||
if self._device.valveState.lower() != HMIP_VALVE_DONE:
|
from homematicip.base.enums import ValveState
|
||||||
return self._device.valveState.lower()
|
|
||||||
|
if self._device.valveState != ValveState.ADAPTION_DONE:
|
||||||
|
return self._device.valveState
|
||||||
return round(self._device.valvePosition*100)
|
return round(self._device.valvePosition*100)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -160,11 +129,6 @@ class HomematicipHumiditySensor(HomematicipGenericDevice):
|
|||||||
"""Return the device class of the sensor."""
|
"""Return the device class of the sensor."""
|
||||||
return DEVICE_CLASS_HUMIDITY
|
return DEVICE_CLASS_HUMIDITY
|
||||||
|
|
||||||
@property
|
|
||||||
def icon(self):
|
|
||||||
"""Return the icon."""
|
|
||||||
return 'mdi:water-percent'
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state."""
|
"""Return the state."""
|
||||||
@ -188,11 +152,6 @@ class HomematicipTemperatureSensor(HomematicipGenericDevice):
|
|||||||
"""Return the device class of the sensor."""
|
"""Return the device class of the sensor."""
|
||||||
return DEVICE_CLASS_TEMPERATURE
|
return DEVICE_CLASS_TEMPERATURE
|
||||||
|
|
||||||
@property
|
|
||||||
def icon(self):
|
|
||||||
"""Return the icon."""
|
|
||||||
return 'mdi:thermometer'
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state."""
|
"""Return the state."""
|
||||||
|
@ -421,7 +421,7 @@ home-assistant-frontend==20180713.0
|
|||||||
# homekit==0.6
|
# homekit==0.6
|
||||||
|
|
||||||
# homeassistant.components.homematicip_cloud
|
# homeassistant.components.homematicip_cloud
|
||||||
homematicip==0.9.6
|
homematicip==0.9.8
|
||||||
|
|
||||||
# homeassistant.components.google
|
# homeassistant.components.google
|
||||||
# homeassistant.components.remember_the_milk
|
# homeassistant.components.remember_the_milk
|
||||||
|
@ -84,7 +84,7 @@ holidays==0.9.5
|
|||||||
home-assistant-frontend==20180713.0
|
home-assistant-frontend==20180713.0
|
||||||
|
|
||||||
# homeassistant.components.homematicip_cloud
|
# homeassistant.components.homematicip_cloud
|
||||||
homematicip==0.9.6
|
homematicip==0.9.8
|
||||||
|
|
||||||
# homeassistant.components.influxdb
|
# homeassistant.components.influxdb
|
||||||
# homeassistant.components.sensor.influxdb
|
# homeassistant.components.sensor.influxdb
|
||||||
|
Loading…
x
Reference in New Issue
Block a user