mirror of
https://github.com/home-assistant/core.git
synced 2025-07-07 13:27:09 +00:00
Splitt device_state_attributes between device and group for Homematic IP Cloud (#26137)
* splitt device_state_attributes between device and group * readd device_state_attributes for access point
This commit is contained in:
parent
bc5cec97f4
commit
82b1b10c28
@ -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_ID
|
||||
from .device import ATTR_GROUP_MEMBER_UNREACHABLE, ATTR_MODEL_TYPE
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -309,11 +309,7 @@ class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorD
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the security zone group."""
|
||||
attr = super().device_state_attributes
|
||||
|
||||
# Remove ATTR_ID from dict, because security groups don't have
|
||||
# device id/sgtin, just an ugly uuid that is referenced no where else.
|
||||
del attr[ATTR_ID]
|
||||
attr = {ATTR_MODEL_TYPE: self._device.modelType}
|
||||
|
||||
if self._device.motionDetected:
|
||||
attr[ATTR_MOTIONDETECTED] = True
|
||||
|
@ -117,9 +117,10 @@ class HomematicipGenericDevice(Entity):
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the generic device."""
|
||||
state_attr = {}
|
||||
for attr, attr_key in DEVICE_ATTRIBUTES.items():
|
||||
attr_value = getattr(self._device, attr, None)
|
||||
if attr_value:
|
||||
state_attr[attr_key] = attr_value
|
||||
if isinstance(self._device, AsyncDevice):
|
||||
for attr, attr_key in DEVICE_ATTRIBUTES.items():
|
||||
attr_value = getattr(self._device, attr, None)
|
||||
if attr_value:
|
||||
state_attr[attr_key] = attr_value
|
||||
|
||||
return state_attr
|
||||
|
@ -34,6 +34,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
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -142,6 +143,11 @@ class HomematicipAccesspointStatus(HomematicipGenericDevice):
|
||||
"""Return the unit this state is expressed in."""
|
||||
return "%"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the security zone group."""
|
||||
return {ATTR_MODEL_TYPE: self._device.modelType}
|
||||
|
||||
|
||||
class HomematicipHeatingThermostat(HomematicipGenericDevice):
|
||||
"""Representation of a HomematicIP heating thermostat device."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user