Add NX584 alarm binary_sensor zone_number attribute (#36552)

This commit is contained in:
mreiling 2020-06-09 05:19:46 -07:00 committed by GitHub
parent 38bb8ef4d2
commit 5f8dcd45c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -101,6 +101,11 @@ class NX584ZoneSensor(BinarySensorEntity):
# True means "faulted" or "open" or "abnormal state"
return self._zone["state"]
@property
def device_state_attributes(self):
"""Return the state attributes."""
return {"zone_number": self._zone["number"]}
class NX584Watcher(threading.Thread):
"""Event listener thread to process NX584 events."""

View file

@ -135,6 +135,7 @@ class TestNX584ZoneSensor(unittest.TestCase):
assert "foo" == sensor.name
assert not sensor.should_poll
assert sensor.is_on
assert sensor.device_state_attributes["zone_number"] == 1
zone["state"] = False
assert not sensor.is_on