Add device_class to Stookalert (#34638)

Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Marius 2020-06-02 20:27:41 +02:00 committed by GitHub
parent 770b622a6e
commit 7338feb659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ _LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(minutes=60)
CONF_PROVINCE = "province"
DEFAULT_DEVICE_CLASS = "safety"
DEFAULT_NAME = "Stookalert"
ATTRIBUTION = "Data provided by rivm.nl"
PROVINCES = [
@ -74,6 +75,11 @@ class StookalertBinarySensor(BinarySensorEntity):
"""Return True if the Alert is active."""
return self._api_handler.state == 1
@property
def device_class(self):
"""Return the device class of this binary sensor."""
return DEFAULT_DEVICE_CLASS
def update(self):
"""Update the data from the Stookalert handler."""
self._api_handler.get_alerts()