#:########################################################################################:#
# Auckland Council Waste Collection Package                                             #
#:########################################################################################:#
#
# TITLE:
#   Auckland Council Waste Collection
#
# FILE:
#   packages/waste_collection.yaml
#
# VERSION:
#   V1.1 2026-07-20
#
# VERSION HISTORY:
#   V1.1 2026-07-20
#     - Added source setup, schedule, MQTT, and maintenance documentation.
#
#   V1.0
#     - Initial Auckland Council schedules and MQTT bin-status sensors.
#
# PURPOSE:
#   Provides Auckland Council rubbish, recycling, and food-waste collection
#   schedules, plus independent MQTT sensors indicating whether bins are out.
#
# DEPENDENCY:
#   Requires the Waste Collection Schedule custom integration and its
#   aucklandcouncil_govt_nz source.
#
# AREA NUMBER SETUP:
#   - Open the Auckland Council rubbish and recycling collection-day finder.
#   - Select the property address.
#   - Use the displayed assessment number as area_number below.
#   - Source documentation:
#     https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/aucklandcouncil_govt_nz.md
#
# SCHEDULE SENSORS:
#   - Types are rubbish, recycle, and food-waste.
#   - Each sensor returns one upcoming collection with a one-day lead time.
#   - details_format is upcoming and add_days_to adds relative-day text.
#
# MQTT BIN-OUT SENSORS:
#   - These sensors are independent of the council collection schedules.
#   - An external publisher must send status to the configured MQTT topics.
#   - Payloads remain raw sensor strings such as "true"; these are not binary
#     sensor entities and no boolean conversion is performed here.
#
# CURRENT STATUS:
#   - As of 2026-07-20, the rubbish schedule resolves correctly.
#   - Recycling and food-waste report unknown; review the source type names when
#     investigating those schedules.
#
#:########################################################################################:#

waste_collection_schedule:
  sources:
    - name: aucklandcouncil_govt_nz
      args:
        area_number: 12344403722 # Auckland Council assessment number.

sensor:
  - platform: waste_collection_schedule
    #source_index: 0
    name: Auckland Council Waste
    details_format: upcoming
    count: 1
    leadtime: 1
    #value_template: VALUE_TEMPLATE
    #date_template: DATE_TEMPLATE
    add_days_to: true
    #event_index: EVENT_INDEX
    types:
      - rubbish
  - platform: waste_collection_schedule
    #source_index: 0
    name: Auckland Council Recycling
    details_format: upcoming
    count: 1
    leadtime: 1
    #value_template: VALUE_TEMPLATE
    #date_template: DATE_TEMPLATE
    add_days_to: true
    #event_index: EVENT_INDEX
    types:
      - recycle
  - platform: waste_collection_schedule
    #source_index: 0
    name: Auckland Council Food-Waste
    details_format: upcoming
    count: 1
    leadtime: 1
    #value_template: VALUE_TEMPLATE
    #date_template: DATE_TEMPLATE
    add_days_to: true
    #event_index: EVENT_INDEX
    types:
      - food-waste

mqtt:
  sensor:
    - unique_id: auckland_council_red_waste_bin_out
      name: "Red Waste Bin Out"
      state_topic: "viewroad-status/rubbishbinstatus/redbin-out"
    - unique_id: auckland_council_green_recycling_bin_out
      name: "Green Recycling Bin Out"
      state_topic: "viewroad-status/rubbishbinstatus/greenbin-out"
    - unique_id: auckland_council_food_waste_bin_out
      name: "Food Waste Bin Out"
      state_topic: "viewroad-status/rubbishbinstatus/foodbin-out"
