Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add group attribute to Homematic IP Cloud #26618

Merged
merged 2 commits into from Sep 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/homematicip_cloud/binary_sensor.py
Expand Up @@ -38,7 +38,7 @@
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__)

Expand Down Expand Up @@ -312,7 +312,7 @@ def available(self) -> bool:
@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)
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/homematicip_cloud/device.py
Expand Up @@ -12,6 +12,7 @@

ATTR_MODEL_TYPE = "model_type"
ATTR_ID = "id"
ATTR_IS_GROUP = "is_group"
# RSSI HAP -> Device
ATTR_RSSI_DEVICE = "rssi_device"
# RSSI Device -> HAP
Expand Down Expand Up @@ -131,4 +132,6 @@ def device_state_attributes(self):
if attr_value:
state_attr[attr_key] = attr_value

state_attr[ATTR_IS_GROUP] = False

return state_attr
6 changes: 3 additions & 3 deletions homeassistant/components/homematicip_cloud/sensor.py
Expand Up @@ -35,7 +35,7 @@
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__)

Expand Down Expand Up @@ -150,8 +150,8 @@ def unit_of_measurement(self) -> str:

@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}
SukramJ marked this conversation as resolved.
Show resolved Hide resolved


class HomematicipHeatingThermostat(HomematicipGenericDevice):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/homematicip_cloud/switch.py
Expand Up @@ -19,7 +19,7 @@
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__)

Expand Down Expand Up @@ -113,7 +113,7 @@ def available(self) -> bool:
@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
Expand Down