### Install Docker Compose and Run with Docker Compose Source: https://github.com/robbrad/ukbincollectiondata/blob/master/README.md Installs Docker Compose on Debian-based systems and then starts the services defined in the `docker-compose.yml` file. ```bash sudo apt-get update sudo apt-get install docker-compose docker-compose up ``` -------------------------------- ### Setup Project Logging Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/utilities.md Configures the project's unified logging system. Specify log level, file path, and message format. Call this once at the start of your application. ```python from uk_bin_collection.uk_bin_collection.utils.logger import get_logger, setup_logging # Set up logging (only needed once, usually in the main script) setup_logging( log_level="INFO", log_file="/path/to/log/file.log", log_format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" ) ``` -------------------------------- ### Start and Enable Docker Service Source: https://github.com/robbrad/ukbincollectiondata/blob/master/README.md Commands to start the Docker service and enable it to start on boot. These commands are for Linux systems. ```bash sudo systemctl start docker ``` ```bash sudo systemctl enable docker ``` -------------------------------- ### Install Poetry and Project Dependencies Source: https://github.com/robbrad/ukbincollectiondata/blob/master/CONTRIBUTING.md Installs Poetry, clones the repository, and sets up project dependencies using Poetry. Ensures the development environment is ready. ```bash pip install poetry # Clone the Repo git clone https://github.com/robbrad/UKBinCollectionData cd UKBinCollectionData # Install Dependencies poetry install poetry shell ``` -------------------------------- ### Docker Setup and API Query for UK Bin Collection Data Source: https://context7.com/robbrad/ukbincollectiondata/llms.txt This section provides instructions for building and running a Docker container for the UK Bin Collection Data REST API server. It includes an example `curl` command to query bin collections for a specific council and the expected JSON response. ```bash # Build and run cd uk_bin_collection_api_server docker build -t ukbc_api_server . docker run -p 8080:8080 ukbc_api_server # Or with Selenium included (docker-compose from the repo root): docker-compose up # Retrieve bin collections for Leeds City Council curl -X GET \ "http://localhost:8080/api/bin_collection/LeedsCityCouncil?url=https%3A%2F%2Fwww.leeds.gov.uk%2F...&postcode=LS1%202JG&number=41" \ -H "accept: application/json" # Expected response: # { # "bins": [ # { "type": "General Waste", "collectionDate": "15/06/2025" }, # { "type": "Recycling", "collectionDate": "22/06/2025" } # ] # } # Swagger UI available at: # http://localhost:8080/api/ui/ ``` -------------------------------- ### Install Project Dependencies with Poetry Source: https://github.com/robbrad/ukbincollectiondata/blob/master/README.md Install project dependencies using Poetry. This command should be run from the root of the repository. ```bash poetry install ``` -------------------------------- ### Install Specific HA Version and Component Source: https://github.com/robbrad/ukbincollectiondata/blob/master/COMPATIBILITY.md Install a specific Home Assistant version and the component in development mode for local testing. Then, run the compatibility check. ```bash pip install homeassistant==2024.12.0 pip install -e . python scripts/check_ha_compatibility.py ``` -------------------------------- ### Install Specific Package Version Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/release-workflow-setup-checklist.md Installs a specific version of the uk-bin-collection package from PyPI. Replace X.Y.Z with the desired version number. ```bash pip install uk-bin-collection==X.Y.Z ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/robbrad/ukbincollectiondata/blob/master/CONTRIBUTING.md Check if Docker is installed and running correctly on your system by verifying its version. This is a prerequisite for using the dev container. ```bash docker -v ``` -------------------------------- ### Example Workflow Names Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/workflow-naming-conventions.md Illustrates the application of the naming convention across different workflow categories. ```text Build - Docker Image ``` ```text Deploy - Wiki ``` ```text PR - Lint Commit Messages ``` ```text PR - Test Councils ``` ```text PR - Validate HACS ``` ```text PR - Validate Release Ready ``` ```text Release - Bump Version ``` ```text Release - Publish to PyPI ``` ```text Release - Rollback ``` ```text Scheduled - Test All Councils ``` ```text CodeQL ``` -------------------------------- ### Home Assistant Sensor Entity Configuration and Example Source: https://context7.com/robbrad/ukbincollectiondata/llms.txt This section shows how to configure icon and color overrides for bin collection sensors in Home Assistant via the UI. It also provides an example of the resulting sensor states and attributes. ```yaml # Icon and colour override JSON (entered in the config flow): { "General Waste": { "icon": "mdi:trash-can", "color": "grey" }, "Recycling": { "icon": "mdi:recycle", "color": "blue" }, "Garden Waste": { "icon": "mdi:leaf", "color": "green" } } # Resulting sensor states (example): # sensor.my_home_general_waste → "In 3 days" # colour: grey # next_collection: 15/06/2025 # days: 3 # # sensor.my_home_general_waste_bin_type → "General Waste" # sensor.my_home_general_waste_days_until_collection → 3 # sensor.my_home_raw_json → '{"General Waste":"15/06/2025","Recycling":"22/06/2025"}' ``` -------------------------------- ### HouseholdBinCoordinator Setup and Usage Source: https://context7.com/robbrad/ukbincollectiondata/llms.txt Demonstrates how to set up and use the HouseholdBinCoordinator within a Home Assistant integration, including initial refresh and manual refresh calls. ```APIDOC ## HouseholdBinCoordinator Setup This section shows how to initialize and use the `HouseholdBinCoordinator` within the Home Assistant integration. ### Initialization ```python from custom_components.uk_bin_collection import HouseholdBinCoordinator, build_ukbcd_args from uk_bin_collection.uk_bin_collection.collect_data import UKBinCollectionApp from datetime import timedelta config_data = { "name": "My Home", "council": "LeedsCityCouncil", "url": "https://www.leeds.gov.uk/residents/bins-and-recycling/check-your-bin-day", "postcode": "LS1 2JG", "number": "41", "timeout": 60, "update_interval": 12, "manual_refresh_only": False, "icon_color_mapping": '{"General Waste": {"icon": "mdi:trash-can", "color": "black"}}', } args = build_ukbcd_args(config_data) ukbcd = UKBinCollectionApp() ukbcd.set_args(args) coordinator = HouseholdBinCoordinator( hass=hass, ukbcd=ukbcd, name="My Home", timeout=60, update_interval=timedelta(hours=12), ) await coordinator.async_config_entry_first_refresh() ``` ### Data Structure The coordinator's data is structured as a dictionary mapping bin types to their next collection dates: ```python # coordinator.data == # { # "General Waste": datetime.date(2025, 6, 15), # "Recycling": datetime.date(2025, 6, 22), # } ``` ### Manual Refresh To trigger a manual refresh of the bin collection data: ```python await hass.services.async_call( "uk_bin_collection", "manual_refresh", {"entry_id": config_entry.entry_id}, ) ``` ``` -------------------------------- ### Valid New Workflow Name Examples Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/workflow-naming-conventions.md Provides examples of correctly formatted names for new workflows, adhering to the specified category and action guidelines. ```text PR - Validate Dependencies ``` ```text Release - Create Changelog ``` ```text Build - API Server ``` ```text Deploy - Documentation ``` -------------------------------- ### Example Automation for Manual Refresh Source: https://github.com/robbrad/ukbincollectiondata/blob/master/custom_components/uk_bin_collection/README.md An example Home Assistant automation to trigger the `uk_bin_collection.manual_refresh` service daily. Replace 'YOUR_CONFIG_ENTRY_ID' with your actual configuration entry ID. ```yaml automation: - alias: "Daily Manual Refresh for UK Bin Collection" description: "Triggers a manual refresh of the bin collection data every day at 7 AM for integrations set to manual refresh only." trigger: - platform: time at: "07:00:00" action: - service: uk_bin_collection.manual_refresh data: entry_id: "YOUR_CONFIG_ENTRY_ID" mode: single ``` -------------------------------- ### Example Automation for Manual Refresh Source: https://github.com/robbrad/ukbincollectiondata/blob/master/custom_components/uk_bin_collection/README.md An example of a Home Assistant automation that uses the `uk_bin_collection.manual_refresh` service to trigger a daily update of bin collection data. ```APIDOC ## Example Automation to Refresh Bin Data (Manual Refresh Mode) Below is an example automation that triggers a manual refresh of the bin collection data every day at 7:00 AM. This is useful if your integration is configured for manual refresh only. Be sure to replace `"YOUR_CONFIG_ENTRY_ID"` with the actual entry ID of your configuration. ```yaml automation: - alias: "Daily Manual Refresh for UK Bin Collection" description: "Triggers a manual refresh of the bin collection data every day at 7 AM for integrations set to manual refresh only." trigger: - platform: time at: "07:00:00" action: - service: uk_bin_collection.manual_refresh data: entry_id: "YOUR_CONFIG_ENTRY_ID" mode: single ``` ``` -------------------------------- ### Setup HouseholdBinCoordinator in Home Assistant Source: https://context7.com/robbrad/ukbincollectiondata/llms.txt This Python excerpt shows how to set up the `HouseholdBinCoordinator` within an `async_setup_entry` function in Home Assistant. It involves building arguments for `UKBinCollectionApp`, initializing the coordinator, and performing the first data refresh. ```python from custom_components.uk_bin_collection import HouseholdBinCoordinator, build_ukbcd_args from uk_bin_collection.uk_bin_collection.collect_data import UKBinCollectionApp from datetime import timedelta config_data = { "name": "My Home", "council": "LeedsCityCouncil", "url": "https://www.leeds.gov.uk/residents/bins-and-recycling/check-your-bin-day", "postcode": "LS1 2JG", "number": "41", "timeout": 60, "update_interval": 12, "manual_refresh_only": False, "icon_color_mapping": '{"General Waste": {"icon": "mdi:trash-can", "color": "black"}}' } args = build_ukbcd_args(config_data) # args == ["LeedsCityCouncil", # "https://www.leeds.gov.uk/...", # "--postcode=LS1 2JG", "--number=41", "--headless"] ukbcd = UKBinCollectionApp() ukbcd.set_args(args) coordinator = HouseholdBinCoordinator( hass=hass, ukbcd=ukbcd, name="My Home", timeout=60, update_interval=timedelta(hours=12), ) await coordinator.async_config_entry_first_refresh() # coordinator.data == # { # "General Waste": datetime.date(2025, 6, 15), # "Recycling": datetime.date(2025, 6, 22), # } # Trigger a manual refresh via the HA service call await hass.services.async_call( "uk_bin_collection", "manual_refresh", {"entry_id": config_entry.entry_id}, ) ``` -------------------------------- ### Install Docker on Ubuntu Source: https://github.com/robbrad/ukbincollectiondata/blob/master/README.md Commands to install Docker CE on Ubuntu systems. Ensure you have apt-transport-https, ca-certificates, curl, gnupg, and lsb-release installed. ```bash sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io ``` -------------------------------- ### Release Workflow Summary Output Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/workflow-improvements-summary.md Example summary output for the enhanced release workflow, including version, status, and links to PyPI and GitHub releases. ```yaml ## Release Summary - Version: 0.156.0 - Status: success - PyPI: https://pypi.org/project/uk-bin-collection/0.156.0/ - GitHub Release: https://github.com/robbrad/UKBinCollectionData/releases/tag/0.156.0 ✅ Release published successfully! ``` -------------------------------- ### CLI Arguments for Data Collection Source: https://github.com/robbrad/ukbincollectiondata/blob/master/CONTRIBUTING.md Example of running the data collection script with additional parameters like postcode and house number. Ensure postcodes and web driver URLs are quoted if they contain spaces. ```bash python collect_data.py LeedsCityCouncil https://www.leeds.gov.uk/residents/bins-and-recycling/check-your-bin-day -p "LS1 2JG" -n 41 ``` -------------------------------- ### Example API Request for Bin Collections Source: https://github.com/robbrad/ukbincollectiondata/blob/master/README.md Example cURL request to retrieve bin collection information for a specified council. Replace `{council}` with the actual council name. ```bash curl -X GET "http://localhost:8080/api/bin_collection/{council}" -H "accept: application/json" ``` -------------------------------- ### Bump Workflow Summary Output Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/workflow-improvements-summary.md Example output from the enhanced bump workflow, showing the status, new version, and tag creation. ```yaml ## Bump Summary - Status: ✅ Success - New Version: 0.156.0 - Tag Created: 0.156.0 ``` -------------------------------- ### Clone the Repository Source: https://github.com/robbrad/ukbincollectiondata/blob/master/CONTRIBUTING.md Use this command to clone the project repository to your local machine. Ensure you have Git installed. ```bash git clone https://github.com/robbrad/UKBinCollectionData.git ``` -------------------------------- ### Invalid New Workflow Name Examples Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/workflow-naming-conventions.md Highlights examples of workflow names that do not follow the convention, indicating common pitfalls to avoid. ```text Test ``` ```text PR - This workflow tests the councils ``` -------------------------------- ### CLI for Council Needing UPRN Source: https://context7.com/robbrad/ukbincollectiondata/llms.txt Example of using the CLI tool for a council that requires a UPRN instead of postcode and house number. ```bash python uk_bin_collection/uk_bin_collection/collect_data.py \ AberdeenCityCouncil \ "https://www.aberdeencity.gov.uk" \ -u 9051156186 ``` -------------------------------- ### Rollback Workflow Summary Output Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/workflow-improvements-summary.md Example summary output for the rollback workflow, detailing the status of GitHub release and Git tag deletion, and providing guidance for PyPI yanking. ```yaml ## Rollback Summary - Version: 0.155.0 - GitHub Release: ✅ Deleted - Git Tag: Deleted from remote - PyPI: ⚠️ Manual yank required ### Next Steps for PyPI 1. Go to https://pypi.org/manage/project/uk-bin-collection/releases/ 2. Find version 0.155.0 3. Click 'Options' -> 'Yank release' ### ⚠️ Important Notes - The version bump commit still exists in git history - To fully rollback, you may need to revert the bump commit - Users who already installed this version will keep it ``` -------------------------------- ### Icon Color Mapping JSON Example Source: https://github.com/robbrad/ukbincollectiondata/blob/master/custom_components/uk_bin_collection/README.md Provides a valid JSON structure for mapping bin types to icons and colors within the sensor platform. Ensure bin names match council data. ```json { "general": { "icon": "mdi:trash-can", "color": "green" }, "recycling": { "icon": "mdi:recycle", "color": "blue" }, "food": { "icon": "mdi:food", "color": "red" }, "garden": { "icon": "mdi:leaf", "color": "brown" } } ``` -------------------------------- ### Install ICS Calendar Generation Requirements Source: https://github.com/robbrad/ukbincollectiondata/blob/master/README.md Install the 'icalendar' Python package required for the bin_to_ics.py script. This script converts bin collection data to an ICS calendar file. ```bash pip install icalendar ``` -------------------------------- ### Conventional Commit Message Format Example Source: https://github.com/robbrad/ukbincollectiondata/blob/master/docs/release-workflow.md Illustrates the structure of a conventional commit message, including type, scope, subject, body, and footer. ```markdown ():