From 7338feb659d62a238a793d526a8c50f798b4d0cf Mon Sep 17 00:00:00 2001 From: Marius <33354141+Mariusthvdb@users.noreply.github.com> Date: Tue, 2 Jun 2020 20:27:41 +0200 Subject: [PATCH] Add device_class to Stookalert (#34638) Co-authored-by: Franck Nijhof Co-authored-by: Franck Nijhof --- homeassistant/components/stookalert/binary_sensor.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/homeassistant/components/stookalert/binary_sensor.py b/homeassistant/components/stookalert/binary_sensor.py index a07f208ac9d..df0c1db369c 100644 --- a/homeassistant/components/stookalert/binary_sensor.py +++ b/homeassistant/components/stookalert/binary_sensor.py @@ -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()