1 """Setup Mullvad VPN Binary Sensors."""
4 BinarySensorDeviceClass,
6 BinarySensorEntityDescription,
14 DataUpdateCoordinator,
17 from .const
import DOMAIN
21 key=
"mullvad_exit_ip",
22 translation_key=
"exit_ip",
23 device_class=BinarySensorDeviceClass.CONNECTIVITY,
30 config_entry: ConfigEntry,
31 async_add_entities: AddEntitiesCallback,
33 """Defer sensor setup to the shared sensor module."""
34 coordinator = hass.data[DOMAIN]
38 for entity_description
in BINARY_SENSORS
43 """Represents a Mullvad binary sensor."""
45 _attr_has_entity_name =
True
49 coordinator: DataUpdateCoordinator,
50 entity_description: BinarySensorEntityDescription,
51 config_entry: ConfigEntry,
53 """Initialize the Mullvad binary sensor."""
56 self.
_attr_unique_id_attr_unique_id = f
"{config_entry.entry_id}_{entity_description.key}"
58 identifiers={(DOMAIN, config_entry.entry_id)},
60 manufacturer=
"Mullvad",
65 """Return the state for this binary sensor."""
None __init__(self, DataUpdateCoordinator coordinator, BinarySensorEntityDescription entity_description, ConfigEntry config_entry)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)