def to_code(config): rhs = App.init_ota() ota = Pvariable(OTAComponent, config[CONF_ID], rhs) if CONF_PASSWORD in config: hash_ = hashlib.md5(config[CONF_PASSWORD].encode()).hexdigest() add(ota.set_auth_password_hash(hash_)) if config[CONF_SAFE_MODE]: add(ota.start_safe_mode())
def to_code(config): rhs = App.init_ota() ota = Pvariable(config[CONF_ID], rhs) if CONF_PASSWORD in config: add(ota.set_auth_password(config[CONF_PASSWORD])) if CONF_PORT in config: add(ota.set_port(config[CONF_PORT])) if config[CONF_SAFE_MODE]: add(ota.start_safe_mode())