Oct-03-2024, 09:29 PM
I am trying to understand the following code in home assisant integration. Is setup_platform method is ending on where it is returning None or everything until add_entties method. Any pointers would help me too. Thanks.
def setup_platform( hass: HomeAssistant, config: ConfigType, add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Connect to Sony projector using network.""" host = config[CONF_HOST] name = config[CONF_NAME] sdcp_connection = pysdcp.Projector(host) # Sanity check the connection try: sdcp_connection.get_power() except ConnectionError: _LOGGER.error("Failed to connect to projector '%s'", host) return _LOGGER.debug("Validated projector '%s' OK", host) add_entities([SonyProjector(sdcp_connection, name)], True)