mampfes / hacs_waste_collection_schedule

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

Tewkesbury borough council: No data, no errors, nothing? #897

Closed tribey2 closed 1 year ago

tribey2 commented 1 year ago

I've just attempted to set up a very basic config hacs_waste_collection_schedule but can't seem to get any data into my calendar - it's completely empty, and the sensor says 'unknown'. I also can't see anything relevant in the logs (no results if I search the logs for 'waste').

Configuration.yaml:

waste_collection_schedule:
  sources:
    - name: tewkesbury_gov_uk
      args:
        postcode: "GL3 1NH"
      calendar_title: "TBC waste collections"
  day_switch_time: "10:00"

sensor:
  - platform: waste_collection_schedule
    name: "TBC waste collections"
    details_format: appointment_types
    add_days_to: true
Screenshot 2023-04-19 at 20 08 56

Any ideas why this might be the case? As far as I can see and from checking other issues/configs, I'm not missing anything - but I'm surprised there's nothing in the logs.

Thanks!

tribey2 commented 1 year ago

Investigating a little further and looking into the code, I can see that if you call the API with my postcode:

https://api-2.tewkesbury.gov.uk/general/rounds/GL31NH/nextCollection

There is an API response of:

{
    "status": "TMR",
    "body": "Too many results - please use a lookup API to find a uprn"
}

This doesn't happen with either of the test postcodes (GL205TT) which return data as expected.

If I provide my UPRN instead, it returns the correct data for my address, e.g.:

https://api-2.tewkesbury.gov.uk/general/rounds/100120544973/nextCollection

So, I have updated my configuration.yaml to the following, which now works as expected:

waste_collection_schedule:
  sources:
    - name: tewkesbury_gov_uk
      args:
        postcode: "100120544973"
      calendar_title: "TBC waste collections"
  day_switch_time: "10:00"

Would it be possible for someone to update tewkesbury_gov_uk.py to accept EITHER a postcode OR a UPRN in case anyone else has this issue? It does work if you simply provide a UPRN to the existing postcode field, but this could probably be clearer by means of an added option 'uprn' param...

5ila5 commented 1 year ago

fixed by #904