1 """Support for Stookalert Binary Sensor."""
3 from __future__
import annotations
5 from datetime
import timedelta
10 BinarySensorDeviceClass,
18 from .const
import CONF_PROVINCE, DOMAIN
26 async_add_entities: AddEntitiesCallback,
28 """Set up Stookalert binary sensor from a config entry."""
29 client = hass.data[DOMAIN][entry.entry_id]
34 """Defines a Stookalert binary sensor."""
36 _attr_attribution =
"Data provided by rivm.nl"
37 _attr_device_class = BinarySensorDeviceClass.SAFETY
38 _attr_has_entity_name =
True
41 def __init__(self, client: stookalert.stookalert, entry: ConfigEntry) ->
None:
42 """Initialize a Stookalert device."""
46 identifiers={(DOMAIN, f
"{entry.entry_id}")},
47 name=f
"Stookalert {entry.data[CONF_PROVINCE]}",
50 entry_type=DeviceEntryType.SERVICE,
51 configuration_url=
"https://www.rivm.nl/stookalert",
55 """Update the data from the Stookalert handler."""
56 self.
_client_client.get_alerts()
None __init__(self, stookalert.stookalert client, ConfigEntry entry)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)