Oct-03-2024, 09:29 PM
(This post was last modified: Oct-04-2024, 02:07 AM by deanhystad.)
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)
deanhystad write Oct-04-2024, 02:07 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.