{"id":21169575,"url":"https://github.com/robbrad/ukbincollectiondata","last_synced_at":"2026-03-14T10:15:51.877Z","repository":{"id":45266541,"uuid":"236071875","full_name":"robbrad/UKBinCollectionData","owner":"robbrad","description":"UK Council Bin Collection Data Parser Outputting Bin Data as a JSON","archived":false,"fork":false,"pushed_at":"2025-04-13T15:55:12.000Z","size":4877,"stargazers_count":229,"open_issues_count":54,"forks_count":124,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T15:59:09.251Z","etag":null,"topics":["home-assistant","ukbincollection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robbrad.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-01-24T19:45:26.000Z","updated_at":"2025-04-13T15:55:15.000Z","dependencies_parsed_at":"2022-08-12T11:51:08.047Z","dependency_job_id":"2dbe3d74-67bf-4dbd-8127-c76f4a28a2ad","html_url":"https://github.com/robbrad/UKBinCollectionData","commit_stats":{"total_commits":1595,"total_committers":93,"mean_commits":"17.150537634408604","dds":0.663949843260188,"last_synced_commit":"86ecf37789d4aea42bb4c5e2d66ee13a5cc9f48e"},"previous_names":[],"tags_count":295,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbrad%2FUKBinCollectionData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbrad%2FUKBinCollectionData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbrad%2FUKBinCollectionData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robbrad%2FUKBinCollectionData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robbrad","download_url":"https://codeload.github.com/robbrad/UKBinCollectionData/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741198,"owners_count":21154252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["home-assistant","ukbincollection"],"created_at":"2024-11-20T15:52:31.930Z","updated_at":"2026-02-02T11:17:17.409Z","avatar_url":"https://github.com/robbrad.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Made with Python](https://img.shields.io/badge/Made%20With%20Python-red?style=for-the-badge\u0026logo=python\u0026logoColor=white\u0026labelColor=red)](https://www.python.org)\n\n[![HACS Badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg?style=for-the-badge)](https://github.com/robbrad/UKBinCollectionData)\n[![Current Release](https://img.shields.io/github/v/release/robbrad/UKBinCollectionData?style=for-the-badge\u0026filter=*)](https://github.com/robbrad/UKBinCollectionData/releases)\n[![PyPi](https://img.shields.io/pypi/v/uk_bin_collection?label=PyPI\u0026logo=pypi\u0026style=for-the-badge\u0026color=blue)](https://pypi.org/project/uk-bin-collection/)\n\n[![GitHub license](https://img.shields.io/github/license/robbrad/UKBinCollectionData?style=for-the-badge)](https://github.com/robbrad/UKBinCollectionData/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues-raw/robbrad/UKBinCollectionData?style=for-the-badge)](https://github.com/robbrad/UKBinCollectionData/issues?q=is%3Aopen+is%3Aissue)\n[![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/robbrad/UKBinCollectionData?style=for-the-badge)](https://github.com/robbrad/UKBinCollectionData/issues?q=is%3Aissue+is%3Aclosed)\n[![GitHub contributors](https://img.shields.io/github/contributors/robbrad/UKBinCollectionData?style=for-the-badge)](https://github.com/robbrad/UKBinCollectionData/graphs/contributors)\n\n[![Test Councils](https://img.shields.io/github/actions/workflow/status/robbrad/UKBinCollectionData/behave.yml?style=for-the-badge\u0026label=Test+Councils)](https://github.com/robbrad/UKBinCollectionData/actions/workflows/behave.yml)\n![Codecov](https://img.shields.io/codecov/c/gh/robbrad/UKBinCollectionData?style=for-the-badge)\n[![CodeQL Analysis](https://img.shields.io/github/actions/workflow/status/robbrad/UKBinCollectionData/codeql-analysis.yml?style=for-the-badge\u0026label=CodeQL+Analysis)](https://github.com/robbrad/UKBinCollectionData/actions/workflows/codeql-analysis.yml)\n[![Publish Release](https://img.shields.io/github/actions/workflow/status/robbrad/UKBinCollectionData/release.yml?style=for-the-badge\u0026label=Publish+Release)](https://github.com/robbrad/UKBinCollectionData/actions/workflows/release.yml)\n[![Test Report Deployment](https://img.shields.io/github/actions/workflow/status/robbrad/UKBinCollectionData/pages%2Fpages-build-deployment?style=for-the-badge\u0026label=Test+Report+Deployment)](https://github.com/robbrad/UKBinCollectionData/actions/workflows/pages/pages-build-deployment)\n\n# UK Bin Collection Data (UKBCD)\nThis project aims to provide a neat and standard way of providing bin collection data in JSON format from UK councils that have no API to do so.\n\nWhy would you want to do this?\nYou might want to use this in Home Automation—for example, say you had an LED bar that lit up on the day of bin collection to the colour of the bin you want to take out; then this repo provides the data for that. \n\n**PLEASE respect a councils' infrastructure / usage policy and only collect data for your own personal use on a suitable frequency to your collection schedule.**\n\nMost scripts make use of [Beautiful Soup 4](https://pypi.org/project/beautifulsoup4/) to scrape data, although others use different approaches, such as emulating web browser behaviour, or reading data from CSV files.\n\n[![](https://img.shields.io/badge/-41BDF5?style=for-the-badge\u0026logo=homeassistant\u0026logoColor=white\u0026label=HomeAssistant+Thread)](https://community.home-assistant.io/t/bin-waste-collection/55451)\n[![](https://img.shields.io/badge/Request%20a%20council-gray?style=for-the-badge\u0026logo=github\u0026logoColor=white)](https://github.com/robbrad/UKBinCollectionData/issues/new/choose)\n\n---\n\n## Requesting your council\n\u003e :warning: Please check that a request for your council has not already been made. You can do this by searching on the [Issues](https://github.com/robbrad/UKBinCollectionData/issues) page.\n\nIf an issue already exists, please comment on that issue to express your interest. Please do not open a new issue, as it will be closed as a duplicate.\n\nIf an issue does not already exist, please fill in a new [Council Request](https://github.com/robbrad/UKBinCollectionData/issues/new/choose) form, including as much information as possible, including:\n- Name of the council.\n- URL to bin collections.\n- An example postcode and/or [UPRN](https://uprn.uk/) (whichever is relevant).\n- Any further information.\n\nPlease be aware that this project is run by volunteer contributors and completion depends on numerous factors - even with a request, we cannot guarantee if/when your council is added to this integration.\n\n---\n\n## Home Assistant Usage\n\n### Install with HACS (recommended)\n\n#### Automated\n[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)\n\nThis integration can be installed directly via HACS. To install:\n\n* [Add the repository](https://my.home-assistant.io/redirect/hacs_repository/?owner=robbrad\u0026repository=UKBinCollectionData\u0026category=integration) to your HACS installation\n* Click `Download`\n\nFor details on how to setup the custom component integration, see the [documentation](https://github.com/robbrad/UKBinCollectionData/tree/master/custom_components/uk_bin_collection).\n\n#### Manual\n1. Ensure you have [HACS](https://hacs.xyz/) installed\n1. In the Home Assistant UI go to `HACS` \u003e `Integrations` \u003e `⋮` \u003e `Custom repositories`.\n1. Enter `https://github.com/robbrad/UKBinCollectionData` in the `Repository` field.\n1. Select `Integration` as the category then click `ADD`.\n1. Click `+ Add Integration` and search for and select `UK Bin Collection Data` then click `Download`.\n1. Restart your Home Assistant.\n1. In the Home Assistant UI go to `Settings` \u003e `Devices \u0026 Services` click `+ Add Integration` and search for `UK Bin Collection Data`.\n1. If you see a \"URL of the remote Selenium web driver to use\" field when setting up your council, you'll need to provide the URL to a web driver you've set up separately such as [standalone-chrome](https://hub.docker.com/r/selenium/standalone-chrome).\n\n### Install manually\n\n1. Open the folder for your Home Assistant configuration (where you find `configuration.yaml`).\n1. If you do not have a `custom_components` folder there, you need to create it.\n1. [Download](https://github.com/robbrad/UKBinCollectionData/archive/refs/heads/master.zip) this repository then copy the folder `custom_components/uk_bin_collection` into the `custom_components` folder you found/created in the previous step.\n1. Restart your Home Assistant.\n1. In the Home Assistant UI go to `Settings` \u003e `Devices \u0026 Services` click `+ Add Integration` and search for `UK Bin Collection Data`.\n\n### Overriding the Bin Icon and Bin Colour\nWe realise it is difficult to set a colour from the councils text for the Bin Type and to keep the integration generic, we don't capture colour from a council (not all councils supply this as a field), only bin type and next collection date.\n\nWhen you configure the component on the first screen, you can set a JSON string to map the bin type to the colour and icon\n\nHere 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.\n\nIf you miss this on the first setup, you can reconfigure it.\n\n```json\n{     \n  \"Empty Standard General Waste\": \n  {         \n    \"icon\": \"mdi:trash-can\",         \n    \"color\": \"blue\"     \n  }\n}\n```\n---\n\n## Standalone Usage\n```commandline\nPS G:\\Projects\\Python\\UKBinCollectionData\\uk_bin_collection\\collect_data.py\nusage: collect_data.py [-h] [-p POSTCODE] [-n NUMBER] [-u UPRN] module URL\n\npositional arguments:\n  module                Name of council module to use                           (required)\n  URL                   URL to parse                                            (required)\n\noptions:\n  -h, --help                            show this help message                  (optional)\n  -p POSTCODE, --postcode POSTCODE      Postcode to parse - should include      (optional)\n                                        a space and be wrapped in double\n                                        quotes                                  \n  -n NUMBER, --number NUMBER            House number to parse                   (optional)\n  -u UPRN, --uprn UPRN                  UPRN to parse                           (optional)\n```\n\n### Quickstart\nThe basic command to execute a script is:\n```commandline\npython collect_data.py \u003ccouncil_name\u003e \"\u003ccollection_url\u003e\"\n```\nwhere ```council_name``` is the name of the council's .py script (without the .py) and ```collection_url``` is the URL to scrape.\nThe help documentation refers to these as \"module\" and \"URL\", respectively. Supported council scripts can be found in the `uk_bin_collection/uk_bin_collection/councils` folder.\n\nSome scripts require additional parameters, for example, when a UPRN is not passed in a URL, or when the script is not scraping a web page.\nFor example, the Leeds City Council script needs two additional parameters—a postcode, and a house number. This is done like so:\n\n```commandline\npython collect_data.py LeedsCityCouncil https://www.leeds.gov.uk/residents/bins-and-recycling/check-your-bin-day -p \"LS1 2JG\" -n 41\n```\n- A **postcode** can be passed with `-p \"postcode\"` or `--postcode \"postcode\"`. The postcode must always include a space in the middle and\nbe wrapped in double quotes (due to how command line arguments are handled).\n- A **house number** can be passed with `-n number` or `--number number`.\n- A **UPRN reference** can be passed with `-u uprn` or `--uprn uprn`.\n\nTo check the parameters needed for your council's script, please check the [project wiki](https://github.com/robbrad/UKBinCollectionData/wiki) for more information.\n\n\n### Project dependencies\nSome scripts rely on external packages to function. A list of required scripts for both development and execution can be found in the project's [PROJECT_TOML](https://github.com/robbrad/UKBinCollectionData/blob/feature/%2353_integration_tests/pyproject.toml).\nInstall can be done via  `poetry install` from within the root of the repo.\n\n---\n\n## UPRN Finder\nSome councils make use of the UPRN (Unique property reference number) to identify your property. You can find yours [here](https://www.findmyaddress.co.uk/search) or [here](https://uprn.uk/).\n\n---\n## Selenium\nSome councils need Selenium to run the scrape on behalf of Home Assistant. The easiest way to do this is run Selenium as in a Docker container. However that you do this, the Home Assistant server must be able to reach the Selenium server.\n\n### Instructions for Windows, Linux, and Mac\n\n#### Step 1: Install Docker\n\n##### Windows\n\n1.  **Download Docker Desktop for Windows:**\n    \n    *   Go to the Docker website: Docker Desktop for Windows.\n    *   Download and install Docker Desktop.\n2.  **Run Docker Desktop:**\n    \n    *   After installation, run Docker Desktop.\n    *   Follow the on-screen instructions to complete the setup.\n    *   Ensure Docker is running by checking the Docker icon in the system tray.\n\n##### Linux\n\n1.  **Install Docker:**\n    \n    *   Open a terminal and run the following commands:\n                       \n        ```bash\n        sudo apt-get update\n        sudo apt-get install \\\n            apt-transport-https \\\n            ca-certificates \\\n            curl \\\n            gnupg \\\n            lsb-release\n        curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg\n        echo \\\n          \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \\\n          $(lsb_release -cs) stable\" | sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null\n        sudo apt-get update\n        sudo apt-get install docker-ce docker-ce-cli containerd.io \n        ```\n        \n2.  **Start Docker:**\n    \n    *   Run the following command to start Docker:\n                        \n        ```bash\n        sudo systemctl start docker\n        ```\n        \n3.  **Enable Docker to start on boot:**\n    \n    bash\n    \n    Copy code\n    \n    ```bash\n    sudo systemctl enable docker\n    ```\n    \n\n##### Mac\n\n1.  **Download Docker Desktop for Mac:**\n    \n    *   Go to the Docker website: Docker Desktop for Mac.\n    *   Download and install Docker Desktop.\n2.  **Run Docker Desktop:**\n    \n    *   After installation, run Docker Desktop.\n    *   Follow the on-screen instructions to complete the setup.\n    *   Ensure Docker is running by checking the Docker icon in the menu bar.\n\n#### Step 2: Pull and Run Selenium Standalone Chrome Docker Image\n\n1.  **Open a terminal or command prompt:**\n    \n2.  **Pull the Selenium Standalone Chrome image:**\n       \n    ```bash\n    docker pull selenium/standalone-chrome\n    ```\n    \n3.  **Run the Selenium Standalone Chrome container:**\n        \n    ```bash\n    docker run -d -p 4444:4444 --name selenium-chrome selenium/standalone-chrome\n    ```\n\n#### Step 3: Test the Selenium Server\n\n1.  **Navigate to the Selenium server URL in your web browser:**\n    *   Open a web browser and go to `http://localhost:4444`.\n    *   You should see the Selenium Grid console.\n\n#### Step 4: Supply the Selenium Server URL to UKBinCollectionData\n\n1.  **Find the `UKBinCollectionData` project:**\n    \n    *   Go to the GitHub repository: [UKBinCollectionData](https://github.com/robbrad/UKBinCollectionData).\n2.  **Supply the Selenium Server URL:**\n    \n    *   Typically, the URL will be `http://localhost:4444/wd/hub`.\n    *   You might need to update a configuration file or environment variable in the project to use this URL. Check the project's documentation for specific instructions.\n\n### Summary of Commands\n\n**Windows/Linux/Mac:**\n\n```bash\ndocker pull selenium/standalone-chrome docker run -d -p 4444:4444 --name selenium-chrome selenium/standalone-chrome\n```\n\n**Selenium Server URL:**\n\n*   `http://localhost:4444/wd/hub`\n\n---\n\n### Instructions for Home Assistant OS\n\nIf you're running Home Assistant Supervised, it's possible to host the Selenium instance on the same system.\n\nThis guide is based on a Raspberry Pi 4. Instructions for other systems may vary.\n\n#### Prerequisites\n1. Install **Portainer** from Alex Belgium's add-on repository:\n   [alexbelgium/hassio-addons](https://github.com/alexbelgium/hassio-addons)\n\n---\n\n#### Step 1: Pull and Run Docker Image\n\nSince the Raspberry Pi 4 uses an ARM64-based architecture, use the `seleniarm/standalone-chromium:latest` Docker image.\n\n1. Open **Portainer** and navigate to the **Images** tab.\n2. In the **Image** text box, enter:\n\n   ```\n   seleniarm/standalone-chromium:latest\n   ```\n\n3. Click **Pull the image**.\n\n4. Once the image is pulled, navigate to the **Containers** tab and click **Add container**.\n\n5. Configure the container:\n   - **Name:** Give it a clear and descriptive name (e.g., `selenium-chromium`).\n   - **Image:** Enter:\n\n     ```\n     seleniarm/standalone-chromium\n     ```\n\n     Make sure to uncheck **Always pull the image**.\n\n   - **Network ports configuration:**\n     - Click **Map additional port**.\n     - Set both the **Host** and **Container** ports to `4444`.\n\n6. Click **Deploy the container**.\n\n---\n\n#### Step 2: Configure UKBinCollectionData Integration\n\n1. **Add the integration** in Home Assistant.\n\n2. On the second stage of the integration setup wizard:\n   - Ensure that `http://localhost:4444` shows as accessible.\n     - If not, verify that the Selenium container is running in Portainer.\n\n3. Enter the required information for the integration.\n\n4. In the **Remote Selenium Server** text box, enter:\n\n   ```\n   http://\u003cHA IP address\u003e:4444\n   ```\n\n   Replace `\u003cHA IP address\u003e` with the IP address of your Home Assistant system.\n\n---\n\n## Reports\n\nAll integration tests results are in [CodeCov](https://app.codecov.io/gh/robbrad/UKBinCollectionData/)\n\n### Nightly Full Integration Test Reports:\n- [Nightly Council Test](https://app.codecov.io/gh/robbrad/UKBinCollectionData/tests/master)\n\n\n🗺️ View Test Coverage Map (in VS Code)\n---------------------------------------\n\nYou can generate integration test results and view the interactive UK council coverage map with traffic-light-style statuses for each council.\n\n### 🧪 Step 1: Run Integration Tests\n\nRun: `make integration-tests`\n\nThis runs the full BDD test suite and outputs a `junit.xml` report to:\n\n`build/test/integration-test-results/junit.xml`\n\n### 📊 Step 2: Generate Map Test Results JSON\n\nConvert the JUnit XML output to a flat test result JSON: `make generate-test-map-test-results`\n\nThis creates: `build/integration-test-results/test_results.json`\n\nThis file is used by the map to color each council:\n\n*   ✅ Green: Test passed\n*   🟠 Amber: Test failed\n*   ❌ Red: Not integrated\n\n### 🗺️ Step 3: Open the Map\n\nOpen the map viewer in VS Code:\n\n1.  Right-click the `map.html` file in VSCode and choose **Show Preview**\n    \n2.  The map will open in your browser, showing real-time integration coverage and test results.\n\n![Test Results Map](test_results_map.png)\n\n---\n## ICS Calendar Generation\n\nYou can convert bin collection data to an ICS calendar file that can be imported into calendar applications like Google Calendar, Apple Calendar, Microsoft Outlook, etc.\n\n### Overview\n\nThe `bin_to_ics.py` script allows you to:\n- Convert JSON output from bin collection data into ICS calendar events\n- Group multiple bin collections on the same day into a single event\n- Create all-day events (default) or timed events\n- Add optional reminders/alarms to events\n- Customize the calendar name\n\n### Requirements\n\n- Python 3.6 or higher\n- The `icalendar` package, which can be installed with:\n  ```bash\n  pip install icalendar\n  ```\n\n### Basic Usage\n\n```bash\n# Basic usage with stdin input and default output file (bin.ics)\npython bin_to_ics.py \u003c bin_data.json\n\n# Specify input and output files\npython bin_to_ics.py -i bin_data.json -o my_calendar.ics\n\n# Custom calendar name\npython bin_to_ics.py -i bin_data.json -o my_calendar.ics -n \"My Bin Collections\"\n```\n\n### Options\n\n```\n--input, -i        Input JSON file (if not provided, read from stdin)\n--output, -o       Output ICS file (default: bin.ics)\n--name, -n         Calendar name (default: Bin Collections)\n--alarms, -a       Comma-separated list of alarm times before event (e.g., \"1d,2h,30m\")\n--no-all-day       Create timed events instead of all-day events\n```\n\n### Examples\n\n#### Adding Reminders (Alarms)\n\nAdd reminders 1 day and 2 hours before each collection:\n\n```bash\npython bin_to_ics.py -i bin_data.json -a \"1d,2h\"\n```\n\nThe time format supports:\n- Days: `1d`, `2day`, `3days`\n- Hours: `1h`, `2hour`, `3hours`\n- Minutes: `30m`, `45min`, `60mins`, `90minutes`\n\n#### Creating Timed Events\n\nBy default, events are created as all-day events. To create timed events instead (default time: 7:00 AM):\n\n```bash\npython bin_to_ics.py -i bin_data.json --no-all-day\n```\n\n### Integration with Bin Collection Data Retriever\n\nYou can pipe the output from the bin collection data retriever directly to the ICS generator. The required parameters (postcode, house number, UPRN, etc.) depend on the specific council implementation - refer to the [Quickstart](#quickstart) section above or check the [project wiki](https://github.com/robbrad/UKBinCollectionData/wiki) for details about your council.\n\n```bash\npython uk_bin_collection/uk_bin_collection/collect_data.py CouncilName \"URL\" [OPTIONS] | \n  python bin_to_ics.py [OPTIONS]\n```\n\n#### Complete Example for a Council\n\n```bash\npython uk_bin_collection/uk_bin_collection/collect_data.py CouncilName \\\n  \"council_url\" \\\n  -p \"YOUR_POSTCODE\" \\\n  -n \"YOUR_HOUSE_NUMBER\" \\\n  -w \"http://localhost:4444/wd/hub\" |\n  python bin_to_ics.py \\\n    --name \"My Bin Collections\" \\\n    --output my_bins.ics \\\n    --alarms \"1d,12h\"\n```\n\nThis will:\n1. Fetch bin collection data for your address from your council's website\n2. Convert it to an ICS file named \"my_bins.ics\"\n3. Set the calendar name to \"My Bin Collections\"\n4. Add reminders 1 day and 12 hours before each collection\n\nFor postcode lookup and UPRN information, please check the [UPRN Finder](#uprn-finder) section above.\n\n### Using the Calendar\n\nYou have two options for using the generated ICS file:\n\n#### 1. Importing the Calendar\n\nYou can directly import the ICS file into your calendar application:\n\n- **Google Calendar**: Go to Settings \u003e Import \u0026 export \u003e Import\n- **Apple Calendar**: File \u003e Import\n- **Microsoft Outlook**: File \u003e Open \u0026 Export \u003e Import/Export \u003e Import an iCalendar (.ics)\n\nNote: Importing creates a static copy of the calendar events. If bin collection dates change, you'll need to re-import the calendar.\n\n#### 2. Subscribing to the Calendar\n\nIf you host the ICS file on a publicly accessible web server, you can subscribe to it as an internet calendar:\n\n- **Google Calendar**: Go to \"Other calendars\" \u003e \"+\" \u003e \"From URL\" \u003e Enter the URL of your hosted ICS file\n- **Apple Calendar**: File \u003e New Calendar Subscription \u003e Enter the URL\n- **Microsoft Outlook**: File \u003e Account Settings \u003e Internet Calendars \u003e New \u003e Enter the URL\n\nBenefits of subscribing:\n- Calendar automatically updates when the source file changes\n- No need to manually re-import when bin collection dates change\n- Easily share the calendar with household members\n\nYou can set up a cron job or scheduled task to regularly:\n1. Retrieve the latest bin collection data\n2. Generate a fresh ICS file\n3. Publish it to a web-accessible location\n\n### Additional Examples and Use Cases\n\n#### Automation with Cron Jobs\n\nCreate a weekly update script on a Linux/Mac system:\n\n```bash\n#!/bin/bash\n# File: update_bin_calendar.sh\n\n# Set variables\nCOUNCIL=\"YourCouncilName\"\nCOUNCIL_URL=\"https://your-council-website.gov.uk/bins\"\nPOSTCODE=\"YOUR_POSTCODE\"\nHOUSE_NUMBER=\"YOUR_HOUSE_NUMBER\"\nOUTPUT_DIR=\"/var/www/html/calendars\"  # Web-accessible directory\nCALENDAR_NAME=\"Household Bins\"\n\n# Ensure output directory exists\nmkdir -p $OUTPUT_DIR\n\n# Run the collector and generate the calendar\ncd /path/to/UKBinCollectionData \u0026\u0026 \\\npython uk_bin_collection/uk_bin_collection/collect_data.py $COUNCIL \"$COUNCIL_URL\" \\\n  -p \"$POSTCODE\" -n \"$HOUSE_NUMBER\" | \\\npython bin_to_ics.py --name \"$CALENDAR_NAME\" --output \"$OUTPUT_DIR/bins.ics\" --alarms \"1d,6h\"\n\n# Add timestamp to show last update time\necho \"Calendar last updated: $(date)\" \u003e \"$OUTPUT_DIR/last_update.txt\"\n```\n\nMake the script executable:\n```bash\nchmod +x update_bin_calendar.sh\n```\n\nAdd to crontab to run weekly (every Monday at 2 AM):\n```bash\n0 2 * * 1 /path/to/update_bin_calendar.sh\n```\n\n**Google Assistant/Alexa Integration**\n\nIf you have your calendar connected to Google Calendar or Outlook, you can ask your smart assistant about upcoming bin collections:\n\n- \"Hey Google, when is my next bin collection?\"\n- \"Alexa, what's on my calendar tomorrow?\" (will include bin collections)\n\n## Docker API Server\nWe have created an API for this located under [uk_bin_collection_api_server](https://github.com/robbrad/UKBinCollectionData/uk_bin_collection_api_server)\n\n### Prerequisites\n\n- Docker installed on your machine.\n- Python (if you plan to run the API locally without Docker).\n\n### Running the API with Docker\n\n1. Clone this repository.\n2. Navigate to the `uk_bin_collection_api_server` directory of the project.\n\n#### Build the Docker Container\n\n```bash\ndocker build -t ukbc_api_server .\n```\n\n```\ndocker run -p 8080:8080 ukbc_api_server\n```\n\n#### Accessing the API\n\nOnce the Docker container is running, you can access the API endpoints:\n\n    API Base URL: http://localhost:8080/api\n    Swagger UI: http://localhost:8080/api/ui/\n\n#### API Documentation\n\nThe API documentation can be accessed via the Swagger UI. Use the Swagger UI to explore available endpoints, test different requests, and understand the API functionalities.\n\n![Swagger UI](SwaggerUI.png)\n\n#### API Endpoints\n`GET /bin_collection/{council}`\n\nDescription: Retrieves information about bin collections for the specified council.\n\nParameters:\n\n    council (required): Name of the council.\n    Other optional parameters: [Specify optional parameters if any]\n\nExample Request:\n\n```bash\ncurl -X GET \"http://localhost:8080/api/bin_collection/{council}\" -H \"accept: application/json\"\n```\n\n## Docker Compose\nThis includes the Selenium standalone-chrome for Selenium-based councils.\n\n```yaml\nversion: '3'\n\nservices:\n  ukbc_api_server:\n    build:\n      context: .\n      dockerfile: Dockerfile \n    ports:\n      - \"8080:8080\"  # Adjust the ports as needed\n    depends_on:\n      - selenium\n\n  selenium:\n    image: selenium/standalone-chrome:latest\n    ports:\n      - \"4444:4444\"\n\n```\n### Run with\n```bash\nsudo apt-get update\nsudo apt-get install docker-compose\n\ndocker-compose up\n```\n\n---\n\n## FAQ\n#### I've got an issue/support question—what do I do?\nPlease post in the [HomeAssistant thread](https://community.home-assistant.io/t/bin-waste-collection/55451) or raise a new (non-council request) [issue](https://github.com/robbrad/UKBinCollectionData/issues/new).\n\n#### I'd like to contribute, where do I start?\nContributions are always welcome! See ```CONTRIBUTING.md``` to get started. Please adhere to the project's [code of conduct](https://github.com/robbrad/UKBinCollectionData/blob/master/CODE_OF_CONDUCT.md).\n\n- If you're new to coding/Python/BeautifulSoup, feel free to check [here](https://github.com/robbrad/UKBinCollectionData/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) for issues that are good for newcomers!\n- If you would like to try writing your own scraper, feel free to fork this project and use existing scrapers as a base for your approach (or `councilclasstemplate.py`).\n\n## Contributors\n\u003ca href=\"https://github.com/robbrad/UKBinCollectionData/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=robbrad/UKBinCollectionData\"  alt=\"Image of contributors\"/\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobbrad%2Fukbincollectiondata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobbrad%2Fukbincollectiondata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobbrad%2Fukbincollectiondata/lists"}