From 7a4c0806da37471dc44191abb47990b735dbf4ee Mon Sep 17 00:00:00 2001 From: Oliver Cullimore Date: Thu, 28 Sep 2023 20:08:34 +0100 Subject: [PATCH] fix: Fix for Wakefield City Council custom component support --- custom_components/uk_bin_collection/config_flow.py | 10 +++++----- uk_bin_collection/tests/input.json | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/custom_components/uk_bin_collection/config_flow.py b/custom_components/uk_bin_collection/config_flow.py index 75c7de2ba1..404c55bfd4 100644 --- a/custom_components/uk_bin_collection/config_flow.py +++ b/custom_components/uk_bin_collection/config_flow.py @@ -1,12 +1,11 @@ import json +import logging import aiohttp import homeassistant.helpers.config_validation as cv import voluptuous as vol -from homeassistant.core import callback from homeassistant import config_entries - -import logging +from homeassistant.core import callback _LOGGER = logging.getLogger(__name__) @@ -31,7 +30,8 @@ async def get_council_schema(self, council=str) -> vol.Schema: if self.councils_data is None: self.councils_data = await self.get_councils_json() council_schema = vol.Schema({}) - if "SKIP_GET_URL" not in self.councils_data[council]: + if ("SKIP_GET_URL" not in self.councils_data[council] or + "custom_component_show_url_field" in self.councils_data[council]): council_schema = council_schema.extend( {vol.Required("url", default=""): cv.string} ) @@ -134,7 +134,7 @@ async def async_step_init(self, user_input=None): @staticmethod @callback def async_get_options_flow( - config_entry, + config_entry, ) -> config_entries.OptionsFlow: _LOGGER.info(LOG_PREFIX + "Options flow config_entry: %s", config_entry) """Get the options flow for this handler.""" diff --git a/uk_bin_collection/tests/input.json b/uk_bin_collection/tests/input.json index a5c32c57a1..6c5eb676ac 100644 --- a/uk_bin_collection/tests/input.json +++ b/uk_bin_collection/tests/input.json @@ -493,10 +493,12 @@ "wiki_name": "Vale of Glamorgan Council" }, "WakefieldCityCouncil": { + "SKIP_GET_URL": "SKIP_GET_URL", "url": "https://www.wakefield.gov.uk/where-i-live/?uprn=63035490&a=115%20Elizabeth%20Drive%20Castleford%20WF10%203RR&usrn=41801243&e=445418&n=426091&p=WF10%203RR", "wiki_name": "Wakefield City Council", "wiki_command_url_override": "https://www.wakefield.gov.uk/where-i-live/?uprn=XXXXXXXXXXX&a=XXXXXXXXXXX&usrn=XXXXXXXXXXX&e=XXXXXXXXXXX&n=XXXXXXXXXXX&p=XXXXXXXXXXX", - "wiki_note": "Follow the instructions [here](https://www.wakefield.gov.uk/where-i-live/) until you get the page that includes a \"Bin Collections\" section then copy the URL and replace the URL in the command." + "wiki_note": "Follow the instructions [here](https://www.wakefield.gov.uk/where-i-live/) until you get the page that includes a \"Bin Collections\" section then copy the URL and replace the URL in the command.", + "custom_component_show_url_field": true }, "WarwickDistrictCouncil": { "url": "https://estates7.warwickdc.gov.uk/PropertyPortal/Property/Recycling/100070263793",