def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the sensor platform.""" username = config[CONF_USERNAME] password = config[CONF_PASSWORD] counter_id = config[CONF_COUNTER_ID] try: client = SuezClient(username, password, counter_id) if not client.check_credentials(): _LOGGER.warning("Wrong username and/or password") return except PySuezError: _LOGGER.warning("Unable to create Suez Client") return add_entities([SuezSensor(client)], True)
def setup_platform( hass: HomeAssistant, config: ConfigType, add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the sensor platform.""" username = config[CONF_USERNAME] password = config[CONF_PASSWORD] counter_id = config[CONF_COUNTER_ID] try: client = SuezClient(username, password, counter_id) if not client.check_credentials(): _LOGGER.warning("Wrong username and/or password") return except PySuezError: _LOGGER.warning("Unable to create Suez Client") return add_entities([SuezSensor(client)], True)