Example #1
0
    async def async_step_user(self, user_input=None):
        """Handle a flow initialized by the user."""
        hacs = get_hacs()
        if user_input is not None:
            return self.async_create_entry(title="", data=user_input)

        if hacs.configuration.config_type == "yaml":
            schema = {vol.Optional("not_in_use", default=""): str}
        else:
            schema = hacs_config_option_schema(self.config_entry.options)
            del schema["frontend_repo"]
            del schema["frontend_repo_url"]

        return self.async_show_form(step_id="user",
                                    data_schema=vol.Schema(schema))
Example #2
0
    async def async_step_user(self, user_input=None):
        """Handle a flow initialized by the user."""
        if user_input is not None:
            limit = int(user_input.get(RELEASE_LIMIT, 5))
            if limit <= 0 or limit > 100:
                return self.async_abort(reason="release_limit_value")
            return self.async_create_entry(title="", data=user_input)

        if self.hacs.configuration is None:
            return self.async_abort(reason="not_setup")

        if self.hacs.configuration.config_type == ConfigurationType.YAML:
            schema = {vol.Optional("not_in_use", default=""): str}
        else:
            schema = hacs_config_option_schema(self.config_entry.options)
            del schema["frontend_repo"]
            del schema["frontend_repo_url"]

        return self.async_show_form(step_id="user", data_schema=vol.Schema(schema))