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:
parent
5fda78cf91
commit
3972d1d4c6
2 changed files with 197 additions and 0 deletions
|
@ -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."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue