custom_components/nea_sg_weather/config_flow.py
async def async_step_sensor(self, user_input=None):
        """Second step in config flow for additional sensor settings."""
        self._errors = {}
        if user_input is not None:
            self._data[CONF_SENSORS][CONF_PREFIX] = user_input[CONF_PREFIX]
            self._data[CONF_SENSORS][CONF_REGION] = user_input[CONF_REGION]
            self._data[CONF_SENSORS][CONF_RAIN] = user_input[CONF_RAIN]
            self._data[CONF_SENSORS][CONF_AREAS] = user_input[CONF_AREAS]
            return self.async_create_entry(title=self._data[CONF_NAME], data=self._data)

        return self.async_show_form(
            step_id="sensor",
            data_schema=vol.Schema(
                {
                    vol.Optional(CONF_PREFIX, default=DEFAULT_NAME): str,
                    vol.Optional(CONF_AREAS, default=["All"]): cv.multi_select(
                        dict(zip(["All"] + AREAS, ["All"] + AREAS))
                    ),
                    vol.Optional(CONF_REGION, default=False): cv.boolean,
                    vol.Optional(CONF_RAIN, default=False): cv.boolean,
                }
            ),
            errors=self._errors,
        )
Second step in config flow for additional sensor settings.
Second step in config flow for additional sensor settings.
Second step in config flow for additional sensor settings .
async def async_step_sensor(self, user_input=None):
        self._errors = {}
        if user_input is not None:
            self._data[CONF_SENSORS][CONF_PREFIX] = user_input[CONF_PREFIX]
            self._data[CONF_SENSORS][CONF_REGION] = user_input[CONF_REGION]
            self._data[CONF_SENSORS][CONF_RAIN] = user_input[CONF_RAIN]
            self._data[CONF_SENSORS][CONF_AREAS] = user_input[CONF_AREAS]
            return self.async_create_entry(title=self._data[CONF_NAME], data=self._data)
        return self.async_show_form(
            step_id="sensor",
            data_schema=vol.Schema(
                {
                    vol.Optional(CONF_PREFIX, default=DEFAULT_NAME): str,
                    vol.Optional(CONF_AREAS, default=["All"]): cv.multi_select(
                        dict(zip(["All"] + AREAS, ["All"] + AREAS))
                    ),
                    vol.Optional(CONF_REGION, default=False): cv.boolean,
                    vol.Optional(CONF_RAIN, default=False): cv.boolean,
                }
            ),
            errors=self._errors,
        )
async def async_step_sensor ( self , user_input = None ) : self . _errors = { } if user_input is not None : self . _data [ CONF_SENSORS ] [ CONF_PREFIX ] = user_input [ CONF_PREFIX ] self . _data [ CONF_SENSORS ] [ CONF_REGION ] = user_input [ CONF_REGION ] self . _data [ CONF_SENSORS ] [ CONF_RAIN ] = user_input [ CONF_RAIN ] self . _data [ CONF_SENSORS ] [ CONF_AREAS ] = user_input [ CONF_AREAS ] return self . async_create_entry ( title = self . _data [ CONF_NAME ] , data = self . _data ) return self . async_show_form ( step_id = "sensor" , data_schema = vol . Schema ( { vol . Optional ( CONF_PREFIX , default = DEFAULT_NAME ) : str , vol . Optional ( CONF_AREAS , default = [ "All" ] ) : cv . multi_select ( dict ( zip ( [ "All" ] + AREAS , [ "All" ] + AREAS ) ) ) , vol . Optional ( CONF_REGION , default = False ) : cv . boolean , vol . Optional ( CONF_RAIN , default = False ) : cv . boolean , } ) , errors = self . _errors , )
Second step in config flow for additional sensor settings.
Second step in config flow for additional sensor settings .
"""Second step in config flow for additional sensor settings."""
self
user_input