Add group attribute to Homematic IP Cloud (#26618)
* Add group attribute to Homematic IP Cloud * Fix docstringpull/26642/head
parent
a71cd6e90e
commit
1d3f2d20d2
|
@ -38,7 +38,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
|
||||
from .device import ATTR_GROUP_MEMBER_UNREACHABLE, ATTR_MODEL_TYPE
|
||||
from .device import ATTR_GROUP_MEMBER_UNREACHABLE, ATTR_IS_GROUP, ATTR_MODEL_TYPE
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -312,7 +312,7 @@ class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorD
|
|||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the security zone group."""
|
||||
state_attr = {ATTR_MODEL_TYPE: self._device.modelType}
|
||||
state_attr = {ATTR_MODEL_TYPE: self._device.modelType, ATTR_IS_GROUP: True}
|
||||
|
||||
for attr, attr_key in GROUP_ATTRIBUTES.items():
|
||||
attr_value = getattr(self._device, attr, None)
|
||||
|
|
|
@ -12,6 +12,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
ATTR_MODEL_TYPE = "model_type"
|
||||
ATTR_ID = "id"
|
||||
ATTR_IS_GROUP = "is_group"
|
||||
# RSSI HAP -> Device
|
||||
ATTR_RSSI_DEVICE = "rssi_device"
|
||||
# RSSI Device -> HAP
|
||||
|
@ -131,4 +132,6 @@ class HomematicipGenericDevice(Entity):
|
|||
if attr_value:
|
||||
state_attr[attr_key] = attr_value
|
||||
|
||||
state_attr[ATTR_IS_GROUP] = False
|
||||
|
||||
return state_attr
|
||||
|
|
|
@ -35,7 +35,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
|
||||
from .device import ATTR_MODEL_TYPE
|
||||
from .device import ATTR_IS_GROUP, ATTR_MODEL_TYPE
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -150,8 +150,8 @@ class HomematicipAccesspointStatus(HomematicipGenericDevice):
|
|||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the security zone group."""
|
||||
return {ATTR_MODEL_TYPE: self._device.modelType}
|
||||
"""Return the state attributes of the access point."""
|
||||
return {ATTR_MODEL_TYPE: self._device.modelType, ATTR_IS_GROUP: False}
|
||||
|
||||
|
||||
class HomematicipHeatingThermostat(HomematicipGenericDevice):
|
||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
|
||||
from .device import ATTR_GROUP_MEMBER_UNREACHABLE
|
||||
from .device import ATTR_GROUP_MEMBER_UNREACHABLE, ATTR_IS_GROUP
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -113,7 +113,7 @@ class HomematicipGroupSwitch(HomematicipGenericDevice, SwitchDevice):
|
|||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the switch-group."""
|
||||
state_attr = {}
|
||||
state_attr = {ATTR_IS_GROUP: True}
|
||||
if self._device.unreach:
|
||||
state_attr[ATTR_GROUP_MEMBER_UNREACHABLE] = True
|
||||
return state_attr
|
||||
|
|
Loading…
Reference in New Issue