From 36b81586f06640b8198d8317066a26a3d3ed45e9 Mon Sep 17 00:00:00 2001 From: Robert Bradley Date: Sun, 20 Oct 2024 09:35:44 +0000 Subject: [PATCH] feat: Moving from Attributes to Sensors --- .gitignore | 1 + README.md | 18 ++ .../uk_bin_collection/__init__.py | 19 +- .../uk_bin_collection/config_flow.py | 57 ++++-- custom_components/uk_bin_collection/sensor.py | 182 +++++++++++++----- .../uk_bin_collection/strings.json | 2 + .../uk_bin_collection/translations/cy.json | 53 +++++ .../uk_bin_collection/translations/en.json | 2 + .../uk_bin_collection/translations/ga.json | 53 +++++ .../uk_bin_collection/translations/gd.json | 53 +++++ .../uk_bin_collection/translations/pt.json | 2 + 11 files changed, 371 insertions(+), 71 deletions(-) create mode 100644 custom_components/uk_bin_collection/translations/cy.json create mode 100644 custom_components/uk_bin_collection/translations/ga.json create mode 100644 custom_components/uk_bin_collection/translations/gd.json diff --git a/.gitignore b/.gitignore index 1188989e2f..8320f59ccb 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ !wiki !wiki/**/* !custom_components +!custom_components/**/*/ __pycache__ !TO_BE_CONVERTED !.devcontainer diff --git a/README.md b/README.md index 4a82bcf748..28b0a14dee 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,24 @@ This integration can be installed directly via HACS. To install: 1. Restart your Home Assistant. 1. In the Home Assistant UI go to `Settings` > `Devices & Services` click `+ Add Integration` and search for `UK Bin Collection Data`. +### Overriding the Bin Icon and Bin Colour +We realise it is difficult to set a colour from the councils text for the Bin Type and to keep the integration generic we dont capture colour from a council(not all councils supply this as a field), only bin type and next collection date. + +When you configure the componenent on the first screen you can set a JSON string to map the bin type to the colour and icon + +Here is an example to set the colour and icon for the type `Empty Standard General Waste`. This type is the type returned from the council for the bin. You can do this for multiple bins. + +If you miss this on the first setup you can reconfigure it. + +``` +{ + "Empty Standard General Waste": + { + "icon": "mdi:trash-can", + "color": "blue" + } +} + --- ## Standalone Usage diff --git a/custom_components/uk_bin_collection/__init__.py b/custom_components/uk_bin_collection/__init__.py index 3276853f97..b3b46d0bd2 100644 --- a/custom_components/uk_bin_collection/__init__.py +++ b/custom_components/uk_bin_collection/__init__.py @@ -10,10 +10,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up UK Bin Collection Data from a config entry.""" _LOGGER.info(LOG_PREFIX + "Data Supplied: %s", entry.data) - council_name = entry.data.get("council", "unknown council") - _LOGGER.info( - LOG_PREFIX + "Setting up UK Bin Collection Data for council: %s", council_name - ) + + council_name = entry.data.get("council", "Unknown Council") + _LOGGER.info(LOG_PREFIX + "Setting up UK Bin Collection Data for council: %s", council_name) hass.data.setdefault(DOMAIN, {}) @@ -23,18 +22,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: _LOGGER.info(LOG_PREFIX + "Config entry data: %s", entry.data) - async def _async_finish_startup(_): - await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) - - hass.async_create_task(_async_finish_startup(None)) + # Forward the entry setup to the sensor platform + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) - _LOGGER.info( - LOG_PREFIX + "Successfully set up UK Bin Collection Data for council: %s", - council_name, - ) + _LOGGER.info(LOG_PREFIX + "Successfully set up UK Bin Collection Data for council: %s", council_name) return True + async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/custom_components/uk_bin_collection/config_flow.py b/custom_components/uk_bin_collection/config_flow.py index a0ac4b91e9..98f0e2a79f 100644 --- a/custom_components/uk_bin_collection/config_flow.py +++ b/custom_components/uk_bin_collection/config_flow.py @@ -1,5 +1,6 @@ import json import logging +import json import aiohttp import homeassistant.helpers.config_validation as cv @@ -88,11 +89,20 @@ async def async_step_user(self, user_input=None): ] if user_input is not None: + # Perform validation and setup here based on user_input if user_input["name"] is None or user_input["name"] == "": errors["base"] = "name" if user_input["council"] is None or user_input["council"] == "": errors["base"] = "council" + # Validate the JSON mapping only if provided + if user_input.get("icon_color_mapping"): + try: + json.loads(user_input["icon_color_mapping"]) + except json.JSONDecodeError: + errors["icon_color_mapping"] = "invalid_json" + + # Check for errors if not errors: user_input["council"] = self.council_names[ self.council_options.index(user_input["council"]) @@ -101,15 +111,14 @@ async def async_step_user(self, user_input=None): _LOGGER.info(LOG_PREFIX + "User input: %s", user_input) return await self.async_step_council() - _LOGGER.info( - LOG_PREFIX + "Showing user form with options: %s", self.council_options - ) + # Show the form return self.async_show_form( step_id="user", data_schema=vol.Schema( { vol.Required("name", default=""): cv.string, vol.Required("council", default=""): vol.In(self.council_options), + vol.Optional("icon_color_mapping", default=""): cv.string, # Optional field } ), errors=errors, @@ -178,16 +187,29 @@ async def async_step_reconfigure_confirm( user_input["council"] = self.council_names[ self.council_options.index(user_input["council"]) ] - # Update the config entry with the new data - data = {**existing_data, **user_input} - self.hass.config_entries.async_update_entry( - self.config_entry, - title=user_input.get("name", self.config_entry.title), - data=data, - ) - # Optionally, reload the integration to apply changes - await self.hass.config_entries.async_reload(self.config_entry.entry_id) - return self.async_abort(reason="Reconfigure Successful") + + # Validate the icon and color mapping JSON if provided + if user_input.get("icon_color_mapping"): + try: + json.loads(user_input["icon_color_mapping"]) + except json.JSONDecodeError: + errors["icon_color_mapping"] = "invalid_json" + + if not errors: + # Merge the user input with existing data + data = {**existing_data, **user_input} + + # Ensure icon_color_mapping is properly updated + data["icon_color_mapping"] = user_input.get("icon_color_mapping", "") + + self.hass.config_entries.async_update_entry( + self.config_entry, + title=user_input.get("name", self.config_entry.title), + data=data, + ) + # Optionally, reload the integration to apply changes + await self.hass.config_entries.async_reload(self.config_entry.entry_id) + return self.async_abort(reason="Reconfigure Successful") # Get the council schema based on the current council setting council_schema = await self.get_council_schema(council_key) @@ -253,6 +275,15 @@ async def async_step_reconfigure_confirm( ) added_fields.add("timeout") + # Add the icon_color_mapping field with a default value if it exists + schema = schema.extend( + { + vol.Optional( + "icon_color_mapping", default=existing_data.get("icon_color_mapping", "") + ): str + } + ) + # Add any other fields defined in council_schema that haven't been added yet for key, field in council_schema.schema.items(): if key not in added_fields: diff --git a/custom_components/uk_bin_collection/sensor.py b/custom_components/uk_bin_collection/sensor.py index 1ac3bf8e16..3d0141db27 100644 --- a/custom_components/uk_bin_collection/sensor.py +++ b/custom_components/uk_bin_collection/sensor.py @@ -37,23 +37,22 @@ _LOGGER = logging.getLogger(__name__) -async def async_setup_entry( - hass, config, async_add_entities -) -> None: +async def async_setup_entry(hass, config, async_add_entities): """Set up the sensor platform.""" _LOGGER.info(LOG_PREFIX + "Setting up UK Bin Collection Data platform.") _LOGGER.info(LOG_PREFIX + "Data Supplied: %s", config.data) name = config.data.get("name", "") timeout = config.data.get("timeout", 60) + icon_color_mapping = config.data.get("icon_color_mapping", "{}") # Use an empty JSON object as default + args = [ config.data.get("council", ""), config.data.get("url", ""), *( f"--{key}={value}" for key, value in config.data.items() - if key - not in { + if key not in { "name", "council", "url", @@ -61,6 +60,7 @@ async def async_setup_entry( "headless", "local_browser", "timeout", + "icon_color_mapping", # Exclude this key, even if empty } ), ] @@ -68,7 +68,7 @@ async def async_setup_entry( args.append("--skip_get_url") headless = config.data.get("headless", True) - if headless is False: + if not headless: args.append("--not-headless") local_browser = config.data.get("local_browser", False) @@ -83,19 +83,64 @@ async def async_setup_entry( coordinator = HouseholdBinCoordinator(hass, ukbcd, name, timeout=timeout) await coordinator.async_config_entry_first_refresh() - async_add_entities( - entity - for bin_type in coordinator.data.keys() - for entity in [ - UKBinCollectionDataSensor(coordinator, bin_type, f"{name}_{bin_type}"), # Only 3 arguments here - UKBinCollectionAttributeSensor(coordinator, bin_type, f"{name}_{bin_type}_colour", "Colour", f"{name}_{bin_type}"), - UKBinCollectionAttributeSensor(coordinator, bin_type, f"{name}_{bin_type}_next_collection", "Next Collection Human Readble", f"{name}_{bin_type}"), - UKBinCollectionAttributeSensor(coordinator, bin_type, f"{name}_{bin_type}_days", "Days Until Collection", f"{name}_{bin_type}"), - UKBinCollectionAttributeSensor(coordinator, bin_type, f"{name}_{bin_type}_type", "Bin Type", f"{name}_{bin_type}"), - UKBinCollectionAttributeSensor(coordinator, bin_type, f"{name}_{bin_type}_raw_next_collection", "Next Collection Date", f"{name}_{bin_type}"), - ] - ) + entities = [] + for bin_type in coordinator.data.keys(): + device_id = f"{name}_{bin_type}" + entities.append( + UKBinCollectionDataSensor(coordinator, bin_type, device_id, icon_color_mapping) + ) + entities.append( + UKBinCollectionAttributeSensor( + coordinator, + bin_type, + f"{device_id}_colour", + "Colour", + device_id, + icon_color_mapping, + ) + ) + entities.append( + UKBinCollectionAttributeSensor( + coordinator, + bin_type, + f"{device_id}_next_collection", + "Next Collection Human Readable", + device_id, + icon_color_mapping, + ) + ) + entities.append( + UKBinCollectionAttributeSensor( + coordinator, + bin_type, + f"{device_id}_days", + "Days Until Collection", + device_id, + icon_color_mapping, + ) + ) + entities.append( + UKBinCollectionAttributeSensor( + coordinator, + bin_type, + f"{device_id}_type", + "Bin Type", + device_id, + icon_color_mapping, + ) + ) + entities.append( + UKBinCollectionAttributeSensor( + coordinator, + bin_type, + f"{device_id}_raw_next_collection", + "Next Collection Date", + device_id, + icon_color_mapping, + ) + ) + async_add_entities(entities) class HouseholdBinCoordinator(DataUpdateCoordinator): """Household Bin Coordinator""" @@ -142,14 +187,15 @@ def get_latest_collection_info(data) -> dict: class UKBinCollectionDataSensor(CoordinatorEntity, SensorEntity): """Implementation of the UK Bin Collection Data sensor.""" - + device_class = DEVICE_CLASS - def __init__(self, coordinator, bin_type, device_id) -> None: + def __init__(self, coordinator, bin_type, device_id, icon_color_mapping=None) -> None: """Initialize the main bin sensor.""" super().__init__(coordinator) self._bin_type = bin_type self._device_id = device_id + self._icon_color_mapping = json.loads(icon_color_mapping) if icon_color_mapping else {} self.apply_values() @property @@ -177,13 +223,21 @@ def apply_values(self): now = dt_util.now() self._days = (self._next_collection - now.date()).days - # Set the icon based on the bin type - if "recycling" in self._bin_type.lower(): - self._icon = "mdi:recycle" - elif "waste" in self._bin_type.lower(): - self._icon = "mdi:trash-can" - else: - self._icon = "mdi:delete" + # Use user-supplied icon and color if available + self._icon = self._icon_color_mapping.get(self._bin_type, {}).get("icon") + self._color = self._icon_color_mapping.get(self._bin_type, {}).get("color") + + # Fall back to default logic if icon or color is not provided + if not self._icon: + if "recycling" in self._bin_type.lower(): + self._icon = "mdi:recycle" + elif "waste" in self._bin_type.lower(): + self._icon = "mdi:trash-can" + else: + self._icon = "mdi:delete" + + if not self._color: + self._color = "black" # Default color # Set the state based on the collection day if self._next_collection == now.date(): @@ -203,28 +257,57 @@ def state(self): """Return the state of the bin.""" return self._state + @property + def icon(self): + """Return the entity icon.""" + return self._icon + + @property + def extra_state_attributes(self): + """Return extra attributes of the sensor.""" + return { + STATE_ATTR_COLOUR: self._color, + STATE_ATTR_NEXT_COLLECTION: self._next_collection.strftime("%d/%m/%Y"), + STATE_ATTR_DAYS: self._days, + } + @property + def color(self): + """Return the entity icon.""" + return self._color + + @property + def unique_id(self): + """Return a unique ID for the sensor.""" + return self._device_id + class UKBinCollectionAttributeSensor(CoordinatorEntity, SensorEntity): """Implementation of the attribute sensors (Colour, Next Collection, Days, Bin Type, Raw Next Collection).""" - def __init__(self, coordinator, bin_type, unique_id, attribute_type, device_id) -> None: + def __init__(self, coordinator, bin_type, unique_id, attribute_type, device_id, icon_color_mapping=None) -> None: """Initialize the attribute sensor.""" super().__init__(coordinator) self._bin_type = bin_type self._unique_id = unique_id self._attribute_type = attribute_type - self._device_id = device_id # Ensure the device_id is the same for all sensors of a bin - - # Set default icon and colour based on bin type - if "recycling" in self._bin_type.lower(): - self._icon = "mdi:recycle" - self._color = "green" - elif "waste" in self._bin_type.lower(): - self._icon = "mdi:trash-can" - self._color = "black" - else: - self._icon = "mdi:delete" - self._color = "red" + self._device_id = device_id + self._icon_color_mapping = json.loads(icon_color_mapping) if icon_color_mapping else {} + + # Use user-supplied icon and color if available + self._icon = self._icon_color_mapping.get(self._bin_type, {}).get("icon") + self._color = self._icon_color_mapping.get(self._bin_type, {}).get("color") + + # Fall back to default logic if icon or color is not provided + if not self._icon: + if "recycling" in self._bin_type.lower(): + self._icon = "mdi:recycle" + elif "waste" in self._bin_type.lower(): + self._icon = "mdi:trash-can" + else: + self._icon = "mdi:delete" + + if not self._color: + self._color = "black" # Default color @property def name(self): @@ -236,7 +319,7 @@ def state(self): """Return the state based on the attribute type.""" if self._attribute_type == "Colour": return self._color # Return the colour of the bin - elif self._attribute_type == "Next Collection Human Readble": + elif self._attribute_type == "Next Collection Human Readable": return self.coordinator.data[self._bin_type] # Already formatted next collection elif self._attribute_type == "Days Until Collection": next_collection = parser.parse(self.coordinator.data[self._bin_type], dayfirst=True).date() @@ -252,15 +335,23 @@ def icon(self): return self._icon @property - def colour(self): - """Return the bin colour.""" + def color(self): + """Return the entity icon.""" return self._color + @property + def extra_state_attributes(self): + """Return extra attributes of the sensor.""" + return { + STATE_ATTR_COLOUR: self._color, + STATE_ATTR_NEXT_COLLECTION: self.coordinator.data[self._bin_type], # Return the collection date + } + @property def device_info(self): """Return device information for grouping sensors.""" return { - "identifiers": {(DOMAIN, self._device_id)}, # Use the same device_id for all sensors of the same bin + "identifiers": {(DOMAIN, self._device_id)}, # Use the same device_id for all sensors of the same bin type "name": f"{self.coordinator.name} {self._bin_type}", "manufacturer": "UK Bin Collection", "model": "Bin Sensor", @@ -270,5 +361,4 @@ def device_info(self): @property def unique_id(self): """Return a unique ID for the sensor.""" - return self._unique_id - + return self._unique_id \ No newline at end of file diff --git a/custom_components/uk_bin_collection/strings.json b/custom_components/uk_bin_collection/strings.json index d6e6875b56..c8b6195473 100644 --- a/custom_components/uk_bin_collection/strings.json +++ b/custom_components/uk_bin_collection/strings.json @@ -22,6 +22,7 @@ "web_driver": "To run on a remote Selenium Server add the Selenium Server URL", "headless": "Run Selenium in headless mode (recommended)", "local_browser": "Don't run remote Selenium server, use local install of Chrome instead", + "icon_color_mapping":"JSON to map Bin Type for Colour and Icon see: https://github.com/robbrad/UKBinCollectionData", "submit": "Submit" }, "description": "Please refer to your councils [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) entry for details on what to enter" @@ -38,6 +39,7 @@ "web_driver": "To run on a remote Selenium Server add the Selenium Server URL", "headless": "Run Selenium in headless mode (recommended)", "local_browser": "Don't run remote Selenium server, use local install of Chrome instead", + "icon_color_mapping":"JSON to map Bin Type for Colour and Icon see: https://github.com/robbrad/UKBinCollectionData", "submit": "Submit" }, "description": "Please refer to your councils [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) entry for details on what to enter" diff --git a/custom_components/uk_bin_collection/translations/cy.json b/custom_components/uk_bin_collection/translations/cy.json new file mode 100644 index 0000000000..6a521162bb --- /dev/null +++ b/custom_components/uk_bin_collection/translations/cy.json @@ -0,0 +1,53 @@ +{ + "title": "Data Casgliad Bin y DU", + "config": { + "step": { + "user": { + "title": "Dewiswch y cyngor", + "data": { + "name": "Enw lleoliad", + "council": "Cyngor" + }, + "description": "Gweler [yma](https://github.com/robbrad/UKBinCollectionData#requesting-your-council) os nad yw eich cyngor wedi'i restru" + }, + "council": { + "title": "Darparu manylion y cyngor", + "data": { + "url": "URL i gael data casgliad bin", + "timeout": "Yr amser mewn eiliadau y dylai'r synhwyrydd aros am ddata", + "uprn": "UPRN (Rhif Cyfeirnod Eiddo Unigryw)", + "postcode": "Cod post y cyfeiriad", + "number": "Rhif y tŷ o'r cyfeiriad", + "usrn": "USRN (Rhif Cyfeirnod Stryd Unigryw)", + "web_driver": "I redeg ar weinydd Selenium o bell ychwanegwch URL y Gweinydd Selenium", + "headless": "Rhedeg Selenium mewn modd headless (argymhellir)", + "local_browser": "Peidiwch â rhedeg gweinydd Selenium o bell, defnyddiwch Chrome wedi'i osod yn lleol yn lle", + "icon_color_mapping": "JSON i fapio Math y Bin ar gyfer Lliw ac Eicon gweler: https://github.com/robbrad/UKBinCollectionData", + "submit": "Cyflwyno" + }, + "description": "Cyfeiriwch at [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) eich cyngor am fanylion ar beth i'w fewnbynnu" + }, + "reconfigure_confirm": { + "title": "Diweddaru manylion cyngor", + "data": { + "url": "URL i gael data casgliad bin", + "timeout": "Yr amser mewn eiliadau y dylai'r synhwyrydd aros am ddata", + "uprn": "UPRN (Rhif Cyfeirnod Eiddo Unigryw)", + "postcode": "Cod post y cyfeiriad", + "number": "Rhif y tŷ o'r cyfeiriad", + "usrn": "USRN (Rhif Cyfeirnod Stryd Unigryw)", + "web_driver": "I redeg ar weinydd Selenium o bell ychwanegwch URL y Gweinydd Selenium", + "headless": "Rhedeg Selenium mewn modd headless (argymhellir)", + "local_browser": "Peidiwch â rhedeg gweinydd Selenium o bell, defnyddiwch Chrome wedi'i osod yn lleol yn lle", + "icon_color_mapping": "JSON i fapio Math y Bin ar gyfer Lliw ac Eicon gweler: https://github.com/robbrad/UKBinCollectionData", + "submit": "Cyflwyno" + }, + "description": "Cyfeiriwch at [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) eich cyngor am fanylion ar beth i'w fewnbynnu" + } + }, + "error": { + "name": "Rhowch enw lleoliad", + "council": "Dewiswch gyngor" + } + } +} diff --git a/custom_components/uk_bin_collection/translations/en.json b/custom_components/uk_bin_collection/translations/en.json index 8129253e4f..7ea664cb19 100644 --- a/custom_components/uk_bin_collection/translations/en.json +++ b/custom_components/uk_bin_collection/translations/en.json @@ -22,6 +22,7 @@ "web_driver": "To run on a remote Selenium Server add the Selenium Server URL", "headless": "Run Selenium in headless mode (recommended)", "local_browser": "Don't run remote Selenium server, use local install of Chrome instead", + "icon_color_mapping":"JSON to map Bin Type for Colour and Icon see: https://github.com/robbrad/UKBinCollectionData", "submit": "Submit" }, "description": "Please refer to your councils [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) entry for details on what to enter" @@ -38,6 +39,7 @@ "web_driver": "To run on a remote Selenium Server add the Selenium Server URL", "headless": "Run Selenium in headless mode (recommended)", "local_browser": "Don't run remote Selenium server, use local install of Chrome instead", + "icon_color_mapping":"JSON to map Bin Type for Colour and Icon see: https://github.com/robbrad/UKBinCollectionData", "submit": "Submit" }, "description": "Please refer to your councils [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) entry for details on what to enter" diff --git a/custom_components/uk_bin_collection/translations/ga.json b/custom_components/uk_bin_collection/translations/ga.json new file mode 100644 index 0000000000..bf357f4d69 --- /dev/null +++ b/custom_components/uk_bin_collection/translations/ga.json @@ -0,0 +1,53 @@ +{ + "title": "Sonraí Bailiúcháin Binn na RA", + "config": { + "step": { + "user": { + "title": "Roghnaigh an comhairle", + "data": { + "name": "Ainm an tSuímh", + "council": "Comhairle" + }, + "description": "Féach [anseo](https://github.com/robbrad/UKBinCollectionData#requesting-your-council) más rud é nach bhfuil do chomhairle liostaithe" + }, + "council": { + "title": "Sonraí na comhairle a sholáthar", + "data": { + "url": "URL chun sonraí bailiúcháin bín a fháil", + "timeout": "An t-am i soicindí ar chóir don bhraiteoir fanacht le sonraí", + "uprn": "UPRN (Uimhir Thagartha Aonair Maoine)", + "postcode": "Cód poist an tseolta", + "number": "Uimhir an tí ag an seoladh", + "usrn": "USRN (Uimhir Tagartha Uathúil Sráide)", + "web_driver": "Chun a rith ar Fhreastalaí Selenium iargúlta cuir URL Freastalaí Selenium isteach", + "headless": "Selenium a rith i mód gan cheann (molta)", + "local_browser": "Ná rith freastalaí iargúlta Selenium, bain úsáid as suiteáil áitiúil de Chrome", + "icon_color_mapping": "JSON chun Cineál Binn a léarscáiliú le haghaidh Dath agus Deilbhín féach: https://github.com/robbrad/UKBinCollectionData", + "submit": "Cuir isteach" + }, + "description": "Féach ar iontráil [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) do chomhairle le haghaidh sonraí ar cad ba cheart a iontráil" + }, + "reconfigure_confirm": { + "title": "Sonraí na comhairle a nuashonrú", + "data": { + "url": "URL chun sonraí bailiúcháin bín a fháil", + "timeout": "An t-am i soicindí ar chóir don bhraiteoir fanacht le sonraí", + "uprn": "UPRN (Uimhir Thagartha Aonair Maoine)", + "postcode": "Cód poist an tseolta", + "number": "Uimhir an tí ag an seoladh", + "usrn": "USRN (Uimhir Tagartha Uathúil Sráide)", + "web_driver": "Chun a rith ar Fhreastalaí Selenium iargúlta cuir URL Freastalaí Selenium isteach", + "headless": "Selenium a rith i mód gan cheann (molta)", + "local_browser": "Ná rith freastalaí iargúlta Selenium, bain úsáid as suiteáil áitiúil de Chrome", + "icon_color_mapping": "JSON chun Cineál Binn a léarscáiliú le haghaidh Dath agus Deilbhín féach: https://github.com/robbrad/UKBinCollectionData", + "submit": "Cuir isteach" + }, + "description": "Féach ar iontráil [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) do chomhairle le haghaidh sonraí ar cad ba cheart a iontráil" + } + }, + "error": { + "name": "Cuir isteach ainm an tsuímh", + "council": "Roghnaigh comhairle" + } + } +} diff --git a/custom_components/uk_bin_collection/translations/gd.json b/custom_components/uk_bin_collection/translations/gd.json new file mode 100644 index 0000000000..0fbaac20c1 --- /dev/null +++ b/custom_components/uk_bin_collection/translations/gd.json @@ -0,0 +1,53 @@ +{ + "title": "Dàta Cruinneachadh Biona RA", + "config": { + "step": { + "user": { + "title": "Tagh a’ chomhairle", + "data": { + "name": "Ainm an àite", + "council": "Comhairle" + }, + "description": "Faic [an seo](https://github.com/robbrad/UKBinCollectionData#requesting-your-council) mura h-eil do chomhairle air a liostadh" + }, + "council": { + "title": "Thoir seachad fiosrachadh mun chomhairle", + "data": { + "url": "URL airson dàta cruinneachaidh biona fhaighinn", + "timeout": "An ùine ann an diogan a bu chòir don sensor feitheamh airson dàta", + "uprn": "UPRN (Àireamh Fiosrachaidh Seilbh Gun Samhail)", + "postcode": "Còd-puist an t-seòlaidh", + "number": "Àireamh an taighe den t-seòladh", + "usrn": "USRN (Àireamh Fiosrachaidh Sràid Gun Samhail)", + "web_driver": "Gus ruith air Freiceadan Selenium iomallach cuir URL Freiceadan Selenium ris", + "headless": "Ruith Selenium ann am modh gun cheann (molta)", + "local_browser": "Na ruith Freiceadan Selenium iomallach, cleachd stàladh ionadail de Chrome", + "icon_color_mapping": "JSON gus Seòrsa Biona a mhapadh airson Dath agus Ìomhaigh faic: https://github.com/robbrad/UKBinCollectionData", + "submit": "Cuir a-steach" + }, + "description": "Thoir sùil air [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) na comhairle agad airson fiosrachadh air dè bu chòir a chur a-steach" + }, + "reconfigure_confirm": { + "title": "Ùraich fiosrachadh na comhairle", + "data": { + "url": "URL airson dàta cruinneachaidh biona fhaighinn", + "timeout": "An ùine ann an diogan a bu chòir don sensor feitheamh airson dàta", + "uprn": "UPRN (Àireamh Fiosrachaidh Seilbh Gun Samhail)", + "postcode": "Còd-puist an t-seòlaidh", + "number": "Àireamh an taighe den t-seòladh", + "usrn": "USRN (Àireamh Fiosrachaidh Sràid Gun Samhail)", + "web_driver": "Gus ruith air Freiceadan Selenium iomallach cuir URL Freiceadan Selenium ris", + "headless": "Ruith Selenium ann am modh gun cheann (molta)", + "local_browser": "Na ruith Freiceadan Selenium iomallach, cleachd stàladh ionadail de Chrome", + "icon_color_mapping": "JSON gus Seòrsa Biona a mhapadh airson Dath agus Ìomhaigh faic: https://github.com/robbrad/UKBinCollectionData", + "submit": "Cuir a-steach" + }, + "description": "Thoir sùil air [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) na comhairle agad airson fiosrachadh air dè bu chòir a chur a-steach" + } + }, + "error": { + "name": "Cuir a-steach ainm àite", + "council": "Tagh comhairle" + } + } +} diff --git a/custom_components/uk_bin_collection/translations/pt.json b/custom_components/uk_bin_collection/translations/pt.json index 36c97091f3..cbdf610fa1 100644 --- a/custom_components/uk_bin_collection/translations/pt.json +++ b/custom_components/uk_bin_collection/translations/pt.json @@ -22,6 +22,7 @@ "web_driver": "Para executar num servidor remoto Selenium, adicione o URL do servidor Selenium", "headless": "Executar o Selenium em modo headless (recomendado)", "local_browser": "Não executar o servidor remoto Selenium, utilizar a instalação local do Chrome", + "icon_color_mapping": "JSON para mapear o Tipo de Lixeira para Cor e Ícone veja: https://github.com/robbrad/UKBinCollectionData", "submit": "Submeter" }, "description": "Por favor, consulte a [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) do seu conselho para obter detalhes sobre o que inserir" @@ -38,6 +39,7 @@ "web_driver": "Para executar num servidor remoto Selenium, adicione o URL do servidor Selenium", "headless": "Executar o Selenium em modo headless (recomendado)", "local_browser": "Não executar o servidor remoto Selenium, utilizar a instalação local do Chrome.", + "icon_color_mapping": "JSON para mapear o Tipo de Lixeira para Cor e Ícone veja: https://github.com/robbrad/UKBinCollectionData", "submit": "Submeter" }, "description": "Por favor, consulte a [wiki](https://github.com/robbrad/UKBinCollectionData/wiki/Councils) do seu conselho para obter detalhes sobre o que inserir"