1 """Support for Vanderbilt (formerly Siemens) SPC alarm systems."""
3 from __future__
import annotations
5 from pyspcwebgw
import SpcWebGateway
6 from pyspcwebgw.const
import ZoneInput, ZoneType
7 from pyspcwebgw.zone
import Zone
10 BinarySensorDeviceClass,
18 from .
import DATA_API, SIGNAL_UPDATE_SENSOR
23 ZoneType.ALARM: BinarySensorDeviceClass.MOTION,
24 ZoneType.ENTRY_EXIT: BinarySensorDeviceClass.OPENING,
25 ZoneType.FIRE: BinarySensorDeviceClass.SMOKE,
26 ZoneType.TECHNICAL: BinarySensorDeviceClass.POWER,
33 async_add_entities: AddEntitiesCallback,
34 discovery_info: DiscoveryInfoType |
None =
None,
36 """Set up the SPC binary sensor."""
37 if discovery_info
is None:
39 api: SpcWebGateway = hass.data[DATA_API]
43 for zone
in api.zones.values()
50 """Representation of a sensor based on a SPC zone."""
52 _attr_should_poll =
False
55 """Initialize the sensor device."""
61 """Call for adding new entities."""
65 SIGNAL_UPDATE_SENSOR.format(self.
_zone_zone.id),
72 """Call update method."""
77 """Whether the device is switched on."""
78 return self.
_zone_zone.input == ZoneInput.OPEN
None _update_callback(self)
None async_added_to_hass(self)
None __init__(self, Zone zone)
None async_schedule_update_ha_state(self, bool force_refresh=False)
None async_on_remove(self, CALLBACK_TYPE func)
web.Response get(self, web.Request request, str config_key)
BinarySensorDeviceClass|None _get_device_class(ZoneType zone_type)
None async_setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback async_add_entities, DiscoveryInfoType|None discovery_info=None)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)