diff --git a/custom_components/fuel_prices/config_flow.py b/custom_components/fuel_prices/config_flow.py index 0fd2059..7eb940e 100644 --- a/custom_components/fuel_prices/config_flow.py +++ b/custom_components/fuel_prices/config_flow.py @@ -72,7 +72,7 @@ async def async_step_main_menu(self, _: None = None): step_id="main_menu", menu_options={ "area_menu": "Configure areas to create devices/sensors", - CONF_SOURCES: "Configure data collector sources", + "sources": "Configure data collector sources", "finished": "Complete setup", }, ) @@ -83,7 +83,7 @@ async def async_step_sources(self, user_input: dict[str, Any] | None = None): self.configured_sources = user_input[CONF_SOURCES] return await self.async_step_main_menu(None) return self.async_show_form( - step_id=CONF_SOURCES, + step_id="sources", data_schema=vol.Schema( { vol.Optional( @@ -103,12 +103,12 @@ async def async_step_area_menu(self, _: None = None) -> FlowResult: """Show the area menu.""" return self.async_show_menu( step_id="area_menu", - menu_options=[ - "area_create", - "area_update_select", - "area_delete", - "main_menu", - ], + menu_options={ + "area_create": "Define a new area", + "area_update_select": "Update an area", + "area_delete": "Delete an area", + "main_menu": "Return to main menu", + }, ) async def async_step_area_create(self, user_input: dict[str, Any] | None = None): @@ -239,10 +239,7 @@ async def async_step_finished(self, user_input: dict[str, Any] | None = None): ) user_input[CONF_AREAS] = self.configured_areas return self.async_create_entry(title=NAME, data=user_input) - return self.async_show_form( - step_id="finished", - errors=errors, - ) + return self.async_show_form(step_id="finished", errors=errors, last_step=True) class CannotConnect(HomeAssistantError): diff --git a/custom_components/fuel_prices/strings.json b/custom_components/fuel_prices/strings.json index 87db0e2..eb79f12 100644 --- a/custom_components/fuel_prices/strings.json +++ b/custom_components/fuel_prices/strings.json @@ -2,8 +2,9 @@ "title": "Fuel Prices", "config": { "step": { - "main_menu": { - "description": "Select a configuration option to get started. Once completed, select the last option to complete setup." + "finished": { + "title": "Fuel Prices", + "description": "Click submit to finish setup" }, "sources": { "title": "Configure data collection sources", @@ -55,6 +56,9 @@ } } }, + "error": { + "already_configured": "Only one instance of this integration is allowed." + }, "services": { "find_fuels": { "name": "Find fuel prices from location", diff --git a/custom_components/fuel_prices/translations/en.json b/custom_components/fuel_prices/translations/en.json new file mode 100644 index 0000000..eb79f12 --- /dev/null +++ b/custom_components/fuel_prices/translations/en.json @@ -0,0 +1,88 @@ +{ + "title": "Fuel Prices", + "config": { + "step": { + "finished": { + "title": "Fuel Prices", + "description": "Click submit to finish setup" + }, + "sources": { + "title": "Configure data collection sources", + "description": "Using this menu you can change what providers the integration will collect data from.", + "data": { + "sources": "Data source(s)" + } + }, + "area_menu": { + "title": "Configure areas to register devices and sensors", + "menu_options": { + "area_create": "Create an area", + "area_update_select": "Update an area", + "area_delete": "Delete an area", + "main_menu": "Return to main menu" + } + }, + "area_create": { + "title": "Create an area", + "description": "Using this menu you can create areas to register devices and sensors. This integration will create a device for each fuel station discovered, under this a sensor will be created for each fuel type.", + "data": { + "name": "Area name (must be unique)", + "radius": "Maximum search radius", + "latitude": "Latitude for the center of the search location", + "longitude": "Longitude for the center of the search location" + } + }, + "area_update_select": { + "title": "Select area to update", + "data": { + "name": "Area name" + } + }, + "area_update": { + "title": "Create an area", + "description": "Using this menu you can create areas to register devices and sensors. This integration will create a device for each fuel station discovered, under this a sensor will be created for each fuel type.", + "data": { + "name": "Area name (must be unique)", + "radius": "Maximum search radius", + "latitude": "Latitude for the center of the search location", + "longitude": "Longitude for the center of the search location" + } + }, + "area_delete": { + "title": "Select area to delete", + "data": { + "name": "Area name" + } + } + } + }, + "error": { + "already_configured": "Only one instance of this integration is allowed." + }, + "services": { + "find_fuels": { + "name": "Find fuel prices from location", + "description": "This will retrieve all fuel prices for a given location sorted by the cheapest first.", + "fields": { + "location": { + "name": "Location", + "description": "The location of the area to search" + }, + "type": { + "name": "Fuel Type", + "description": "The fuel type to search for (such as E5, E10, B7, SDV)" + } + } + }, + "find_fuel_station": { + "name": "Find fuel stations from location", + "description": "Find all of the available fuel stations, alongside available fuels and cost for a given location. The results are not sorted.", + "fields": { + "location": { + "name": "Location", + "description": "The location of the area to search" + } + } + } + } +} \ No newline at end of file