From 112ed88d64e8176fcee41d11dfd100c8b45ed612 Mon Sep 17 00:00:00 2001 From: Markus Jankowski Date: Sat, 23 Mar 2019 13:21:55 +0100 Subject: [PATCH] Add homematicip cloud connection quality related attributes (#21990) --- .../components/homematicip_cloud/device.py | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/homematicip_cloud/device.py b/homeassistant/components/homematicip_cloud/device.py index 9940e6960db..0b815d0ec7e 100644 --- a/homeassistant/components/homematicip_cloud/device.py +++ b/homeassistant/components/homematicip_cloud/device.py @@ -6,21 +6,13 @@ from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) -ATTR_CONNECTED = 'connected' -ATTR_DEVICE_ID = 'device_id' -ATTR_DEVICE_LABEL = 'device_label' -ATTR_DEVICE_RSSI = 'device_rssi' -ATTR_DUTY_CYCLE = 'duty_cycle' -ATTR_FIRMWARE_STATE = 'firmware_state' -ATTR_GROUP_TYPE = 'group_type' -ATTR_HOME_ID = 'home_id' -ATTR_HOME_NAME = 'home_name' ATTR_LOW_BATTERY = 'low_battery' ATTR_MODEL_TYPE = 'model_type' -ATTR_OPERATION_LOCK = 'operation_lock' +# RSSI HAP -> Device +ATTR_RSSI_DEVICE = 'rssi_device' +# RSSI Device -> HAP +ATTR_RSSI_PEER = 'rssi_peer' ATTR_SABOTAGE = 'sabotage' -ATTR_STATUS_UPDATE = 'status_update' -ATTR_UNREACHABLE = 'unreachable' ATTR_GROUP_MEMBER_UNREACHABLE = 'group_member_unreachable' @@ -101,7 +93,13 @@ class HomematicipGenericDevice(Entity): """Return the state attributes of the generic device.""" attr = {ATTR_MODEL_TYPE: self._device.modelType} if hasattr(self._device, 'lowBat') and self._device.lowBat: - attr.update({ATTR_LOW_BATTERY: self._device.lowBat}) + attr[ATTR_LOW_BATTERY] = self._device.lowBat if hasattr(self._device, 'sabotage') and self._device.sabotage: - attr.update({ATTR_SABOTAGE: self._device.sabotage}) + attr[ATTR_SABOTAGE] = self._device.sabotage + if hasattr(self._device, 'rssiDeviceValue') and \ + self._device.rssiDeviceValue: + attr[ATTR_RSSI_DEVICE] = self._device.rssiDeviceValue + if hasattr(self._device, 'rssiPeerValue') and \ + self._device.rssiPeerValue: + attr[ATTR_RSSI_PEER] = self._device.rssiPeerValue return attr