Mark REST binary_sensor unavailable if request fails (#11506)
* Mark REST binary_sensor unavailable if request fails * Add test suite for RESTful binary sensor
This commit is contained in:
1 parent
5fda78cf91
commit
3972d1d4c6
2 files changed
+197
No files matched your search
@@ -98,6 +98,11 @@ class RestBinarySensor(BinarySensorDevice):
|
||||
"""Return the class of this sensor."""
|
||||
return self._device_class
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Return the availability of this sensor."""
|
||||
return self.rest.data is not None
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return true if the binary sensor is on."""
|
||||
|
||||
Reference in new issue
Block a user