mampfes / hacs_waste_collection_schedule

Home Assistant integration framework for (garbage collection) schedules
MIT License
1.09k stars 660 forks source link

North Lincs Error #919

Closed V3L closed 1 year ago

V3L commented 1 year ago

I am getting the following error in Home Assistant for the North Lincs source:

This error originated from a custom integration.

Logger: waste_collection_schedule.source_shell
Source: custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py:136
Integration: waste_collection_schedule (documentation)
First occurred: 12:32:01 (1 occurrences)
Last logged: 12:32:01

fetch failed for source North Lincolnshire Council: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 134, in fetch entries = self._source.fetch() File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/northlincs_gov_uk.py", line 40, in fetch waste_type = collection["BinCodeDescription"] KeyError: 'BinCodeDescription'

The information I have in my configuration.yaml is:

waste_collection_schedule:
  sources:
    - name: northlincs_gov_uk
      args:
        uprn: "100050196285"
      customize:
        - type: Brown garden waste wheeled bin
          alias: Brown Bin
          icon: mdi:mdiTrashCanOutline
        - type: Plastic and cardboard wheeled bin
          alias: Red Bin
          icon: mdi:mdiTrashCanOutline
        - type: Blue kerbside box - paper
          alias: Blue Box
          icon: mdi:mdiTrashCanOutline
        - type: Green kerbside box - cans, glass and aluminium foil
          alias: Green Box
          icon: mdi:mdiTrashCanOutline
        - type: General waste wheeled bin
          alias: Green Bin
          icon: mdi:mdiTrashCanOutline
        - type: Textiles Bag
          show: False

Additional Logic for a Sensor:

  - platform: waste_collection_schedule
    name: Bin Schedule
    details_format: upcoming
    leadtime: 14
    date_template: '{{value.date.strftime("%d/%m/%Y (%a)")}}'

Running the current version of Home Assistant and the Plugin.

Please note I've replaced my UPRN in the config above.

If you need anymore information just let me know.

Thanks, Vel

dt215git commented 1 year ago

That error suggests the source didn't return a valid response for the uprn you supplied. How many digits are in your uprn? The test cases all seem to work okay (Test_004 is the uprn you have in your sample config)

  found 36 entries for Test_004
    2023-04-28 : Brown garden waste wheeled bin [mdi:leaf]
    2023-04-28 : Plastic and cardboard wheeled bin [mdi:recycle]
    2023-05-05 : Blue kerbside box - paper [mdi:package-variant]
    2023-05-05 : Green kerbside box - cans, glass and aluminium foil [mdi:glass-fragile]
    2023-05-05 : General waste wheeled bin [mdi:trash-can]
    2023-05-05 : Textiles Bag [mdi:sack]
    2023-05-12 : Brown garden waste wheeled bin [mdi:leaf]
    2023-05-12 : Plastic and cardboard wheeled bin [mdi:recycle]
    2023-05-19 : Blue kerbside box - paper [mdi:package-variant]
    2023-05-19 : Green kerbside box - cans, glass and aluminium foil [mdi:glass-fragile]
    2023-05-19 : General waste wheeled bin [mdi:trash-can]
    2023-05-19 : Textiles Bag [mdi:sack]
    2023-05-26 : Brown garden waste wheeled bin [mdi:leaf]
    2023-05-26 : Plastic and cardboard wheeled bin [mdi:recycle]
    2023-06-02 : Blue kerbside box - paper [mdi:package-variant]
    2023-06-02 : Green kerbside box - cans, glass and aluminium foil [mdi:glass-fragile]
    2023-06-02 : General waste wheeled bin [mdi:trash-can]
    2023-06-02 : Textiles Bag [mdi:sack]
    2023-06-09 : Brown garden waste wheeled bin [mdi:leaf]
    2023-06-09 : Plastic and cardboard wheeled bin [mdi:recycle]
    2023-06-16 : Blue kerbside box - paper [mdi:package-variant]
    2023-06-16 : Green kerbside box - cans, glass and aluminium foil [mdi:glass-fragile]
    2023-06-16 : General waste wheeled bin [mdi:trash-can]
    2023-06-16 : Textiles Bag [mdi:sack]
    2023-06-23 : Brown garden waste wheeled bin [mdi:leaf]
    2023-06-23 : Plastic and cardboard wheeled bin [mdi:recycle]
    2023-06-30 : Blue kerbside box - paper [mdi:package-variant]
    2023-06-30 : Green kerbside box - cans, glass and aluminium foil [mdi:glass-fragile]
    2023-06-30 : General waste wheeled bin [mdi:trash-can]
    2023-06-30 : Textiles Bag [mdi:sack]
    2023-07-07 : Brown garden waste wheeled bin [mdi:leaf]
    2023-07-07 : Plastic and cardboard wheeled bin [mdi:recycle]
    2023-07-14 : Blue kerbside box - paper [mdi:package-variant]
    2023-07-14 : Green kerbside box - cans, glass and aluminium foil [mdi:glass-fragile]
    2023-07-14 : General waste wheeled bin [mdi:trash-can]
    2023-07-14 : Textiles Bag [mdi:sack]
V3L commented 1 year ago

My UPRN is 12 characters, I removed the quotes from the number in the configuration.yaml file and it appears to have loaded the data now.

5ila5 commented 1 year ago

Removing quotes should not make a difference, the source converts Integers directly to Strings. The Server probably was not available for the last fetch (Error message (1 occurrences))