def setup(self, hass, config, add_devices): """Setup the connection.""" import dovado self._dovado = dovado.Dovado(config.get(CONF_USERNAME), config.get(CONF_PASSWORD), config.get(CONF_HOST), config.get(CONF_PORT)) if not self.update(): return False def send_sms(service): """Send SMS through the router.""" number = service.data.get("number"), message = service.data.get("message") _LOGGER.debug("message for %s: %s", number, message) self._dovado.send_sms(number, message) if self.state.get("sms") == "enabled": service_name = slugify("{} {}".format(self.name, "send_sms")) hass.services.register(DOMAIN, service_name, send_sms) for sensor in SENSORS: if sensor in config.get(CONF_SENSORS, [sensor]): add_devices([DovadoSensor(self, sensor)]) return True
def setup(hass, config): """Set up the Dovado component.""" import dovado hass.data[DOMAIN] = DovadoData( dovado.Dovado(config[CONF_USERNAME], config[CONF_PASSWORD], config.get(CONF_HOST), config.get(CONF_PORT))) return True
def setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Dovado component.""" hass.data[DOMAIN] = DovadoData( dovado.Dovado( config[DOMAIN][CONF_USERNAME], config[DOMAIN][CONF_PASSWORD], config[DOMAIN].get(CONF_HOST), config[DOMAIN].get(CONF_PORT), )) return True
def setup(opp, config): """Set up the Dovado component.""" opp.data[DOMAIN] = DovadoData( dovado.Dovado( config[DOMAIN][CONF_USERNAME], config[DOMAIN][CONF_PASSWORD], config[DOMAIN].get(CONF_HOST), config[DOMAIN].get(CONF_PORT), )) return True
def setup(hass, config): """Set up the Dovado component.""" hass.data[DOMAIN] = DovadoData( dovado.Dovado( config[DOMAIN].get(CONF_USERNAME), config[DOMAIN].get(CONF_PASSWORD), config[DOMAIN].get(CONF_HOST), config[DOMAIN].get(CONF_PORT), )) return True