1 """Support for Satel Integra modifiable outputs represented as switches."""
3 from __future__
import annotations
16 CONF_SWITCHABLE_OUTPUTS,
19 SIGNAL_OUTPUTS_UPDATED,
22 _LOGGER = logging.getLogger(__name__)
24 DEPENDENCIES = [
"satel_integra"]
30 async_add_entities: AddEntitiesCallback,
31 discovery_info: DiscoveryInfoType |
None =
None,
33 """Set up the Satel Integra switch devices."""
34 if not discovery_info:
37 configured_zones = discovery_info[CONF_SWITCHABLE_OUTPUTS]
38 controller = hass.data[DATA_SATEL]
42 for zone_num, device_config_data
in configured_zones.items():
43 zone_name = device_config_data[CONF_ZONE_NAME]
46 controller, zone_num, zone_name, discovery_info[CONF_DEVICE_CODE]
48 devices.append(device)
54 """Representation of an Satel switch."""
56 _attr_should_poll =
False
58 def __init__(self, controller, device_number, device_name, code):
59 """Initialize the binary_sensor."""
67 """Register callbacks."""
74 """Update switch state, if needed."""
75 _LOGGER.debug(
"Update switch name: %s zones: %s", self.
_name_name, zones)
78 _LOGGER.debug(
"New state: %s", new_state)
79 if new_state != self.
_state_state:
80 self.
_state_state = new_state
84 """Turn the device on."""
85 _LOGGER.debug(
"Switch: %s status: %s, turning on", self.
_name_name, self.
_state_state)
90 """Turn the device off."""
92 "Switch name: %s status: %s, turning off", self.
_name_name, self.
_state_state
99 """Return true if device is on."""
104 """Read state of the device."""
109 """Return the name of the switch."""
110 return self.
_name_name
def _devices_updated(self, zones)
None async_added_to_hass(self)
None async_turn_off(self, **Any kwargs)
None async_turn_on(self, **Any kwargs)
def __init__(self, controller, device_number, device_name, code)
None async_write_ha_state(self)
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)