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:
1 parent
ca4f69f557
commit
6db069881b
6 files changed
+20
-61
No files matched your search
@@ -24,14 +24,6 @@ ATTR_TEMPERATURE = 'temperature'
|
||||
ATTR_TEMPERATURE_OFFSET = 'temperature_offset'
|
||||
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,
|
||||
discovery_info=None):
|
||||
@@ -83,44 +75,17 @@ class HomematicipAccesspointStatus(HomematicipGenericDevice):
|
||||
"""Device available."""
|
||||
return self._home.connected
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit this state is expressed in."""
|
||||
return '%'
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the access point."""
|
||||
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):
|
||||
"""MomematicIP heating thermostat representation."""
|
||||
|
||||
@@ -131,15 +96,19 @@ class HomematicipHeatingThermostat(HomematicipGenericDevice):
|
||||
@property
|
||||
def icon(self):
|
||||
"""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:radiator'
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the radiator valve."""
|
||||
if self._device.valveState.lower() != HMIP_VALVE_DONE:
|
||||
return self._device.valveState.lower()
|
||||
from homematicip.base.enums import ValveState
|
||||
|
||||
if self._device.valveState != ValveState.ADAPTION_DONE:
|
||||
return self._device.valveState
|
||||
return round(self._device.valvePosition*100)
|
||||
|
||||
@property
|
||||
@@ -160,11 +129,6 @@ class HomematicipHumiditySensor(HomematicipGenericDevice):
|
||||
"""Return the device class of the sensor."""
|
||||
return DEVICE_CLASS_HUMIDITY
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon."""
|
||||
return 'mdi:water-percent'
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state."""
|
||||
@@ -188,11 +152,6 @@ class HomematicipTemperatureSensor(HomematicipGenericDevice):
|
||||
"""Return the device class of the sensor."""
|
||||
return DEVICE_CLASS_TEMPERATURE
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon."""
|
||||
return 'mdi:thermometer'
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state."""
|
||||
|
||||
Reference in new issue
Block a user