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 id (sgtin) to state attributes #26086

Merged
merged 1 commit into from Aug 20, 2019
Merged
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: 3 additions & 1 deletion homeassistant/components/homematicip_cloud/device.py
Expand Up @@ -11,6 +11,7 @@
_LOGGER = logging.getLogger(__name__)

ATTR_MODEL_TYPE = "model_type"
ATTR_ID = "id"
# RSSI HAP -> Device
ATTR_RSSI_DEVICE = "rssi_device"
# RSSI Device -> HAP
Expand Down Expand Up @@ -93,7 +94,8 @@ def icon(self) -> Optional[str]:
@property
def device_state_attributes(self):
"""Return the state attributes of the generic device."""
attr = {ATTR_MODEL_TYPE: self._device.modelType}
attr = {ATTR_MODEL_TYPE: self._device.modelType, ATTR_ID: self._device.id}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a real unique ID, why would unique ID include the class name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balloob "my" ID refers to a physical device with a unique sgtin/id. I think the unique id you refer to is a unique hass device type belonging to that physical device. But there can be more of those all pointing to that one physical device.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balloob The description in my PR should have better described that I guess


if hasattr(self._device, "sabotage") and self._device.sabotage:
attr[ATTR_SABOTAGE] = self._device.sabotage
if hasattr(self._device, "rssiDeviceValue") and self._device.rssiDeviceValue:
Expand Down