Collection of changing entity properties to class attributes (#51248)

* Collection of changing entity properties to class attributes

* Apply suggestions from code review

Co-authored-by: Erik Montnemery <erik@montnemery.com>

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Franck Nijhof 2021-05-31 10:50:11 +02:00 committed by GitHub
parent 5acc3a1083
commit 258b388f41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 106 additions and 305 deletions

View file

@ -29,17 +29,14 @@ class LutronOccupancySensor(LutronDevice, BinarySensorEntity):
reported as a single occupancy group.
"""
_attr_device_class = DEVICE_CLASS_OCCUPANCY
@property
def is_on(self):
"""Return true if the binary sensor is on."""
# Error cases will end up treated as unoccupied.
return self._lutron_device.state == OccupancyGroup.State.OCCUPIED
@property
def device_class(self):
"""Return that this is an occupancy sensor."""
return DEVICE_CLASS_OCCUPANCY
@property
def name(self):
"""Return the name of the device."""