Small cleanup to isy994 extra_state_attributes (#100935)

pull/100942/head
J. Nick Koston 2023-09-26 09:57:25 -05:00 committed by GitHub
parent 822251a642
commit 4b39bf7e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -112,19 +112,19 @@ class ISYNodeEntity(ISYEntity):
other attributes which have been picked up from the event stream and
the combined result are returned as the device state attributes.
"""
attr = {}
attrs = self._attrs
node = self._node
# Insteon aux_properties are now their own sensors
if hasattr(self._node, "aux_properties") and node.protocol != PROTO_INSTEON:
# so we no longer need to add them to the attributes
if node.protocol != PROTO_INSTEON and hasattr(node, "aux_properties"):
for name, value in self._node.aux_properties.items():
attr_name = COMMAND_FRIENDLY_NAME.get(name, name)
attr[attr_name] = str(value.formatted).lower()
attrs[attr_name] = str(value.formatted).lower()
# If a Group/Scene, set a property if the entire scene is on/off
if hasattr(self._node, "group_all_on"):
attr["group_all_on"] = STATE_ON if self._node.group_all_on else STATE_OFF
if hasattr(node, "group_all_on"):
attrs["group_all_on"] = STATE_ON if node.group_all_on else STATE_OFF
self._attrs.update(attr)
return self._attrs
async def async_send_node_command(self, command: str) -> None: