mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +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 homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
|
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__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -309,11 +309,7 @@ class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorD
|
|||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return the state attributes of the security zone group."""
|
"""Return the state attributes of the security zone group."""
|
||||||
attr = super().device_state_attributes
|
attr = {ATTR_MODEL_TYPE: self._device.modelType}
|
||||||
|
|
||||||
# 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]
|
|
||||||
|
|
||||||
if self._device.motionDetected:
|
if self._device.motionDetected:
|
||||||
attr[ATTR_MOTIONDETECTED] = True
|
attr[ATTR_MOTIONDETECTED] = True
|
||||||
|
@ -117,9 +117,10 @@ class HomematicipGenericDevice(Entity):
|
|||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return the state attributes of the generic device."""
|
"""Return the state attributes of the generic device."""
|
||||||
state_attr = {}
|
state_attr = {}
|
||||||
for attr, attr_key in DEVICE_ATTRIBUTES.items():
|
if isinstance(self._device, AsyncDevice):
|
||||||
attr_value = getattr(self._device, attr, None)
|
for attr, attr_key in DEVICE_ATTRIBUTES.items():
|
||||||
if attr_value:
|
attr_value = getattr(self._device, attr, None)
|
||||||
state_attr[attr_key] = attr_value
|
if attr_value:
|
||||||
|
state_attr[attr_key] = attr_value
|
||||||
|
|
||||||
return state_attr
|
return state_attr
|
||||||
|
@ -34,6 +34,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
|
from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
|
||||||
|
from .device import ATTR_MODEL_TYPE
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -142,6 +143,11 @@ class HomematicipAccesspointStatus(HomematicipGenericDevice):
|
|||||||
"""Return the unit this state is expressed in."""
|
"""Return the unit this state is expressed in."""
|
||||||
return "%"
|
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):
|
class HomematicipHeatingThermostat(HomematicipGenericDevice):
|
||||||
"""Representation of a HomematicIP heating thermostat device."""
|
"""Representation of a HomematicIP heating thermostat device."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user