mampfes / hacs_waste_collection_schedule

Home Assistant integration framework for (garbage collection) schedules
MIT License
991 stars 634 forks source link

[Bug]: No Dates being pulled - Somerset #1773

Open OneScuzzie2k opened 7 months ago

OneScuzzie2k commented 7 months ago

I Have A Problem With:

The integration in general

What's Your Problem

I have set it to somerset, it pulled one date today, and not added any other dates, I have re-added it from HACS but still no data being pulled. I cannot see anything or errors that look obvious in the Logs.

Source (if relevant)

No response

Logs

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 11:13:23 (5 occurrences)
Last logged: 11:14:23
Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/soco/events_asyncio.py", line 138, in notify
    variables = parse_event_xml(content)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/soco/events_base.py", line 104, in parse_event_xml
    value = from_didl_string(value)[0]
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/soco/data_structures_entry.py", line 31, in from_didl_string
    root = XML.fromstring(string.encode("utf-8"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/xml/etree/ElementTree.py", line 1338, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 372

Relevant Configuration

No response

Checklist Source Error

Checklist Sensor Error

Required

OneScuzzie2k commented 7 months ago

I have removed completely and re-added I seem to only get todays collection nothing else. Here is my setup:

OneScuzzie2k commented 7 months ago

waste_collection_schedule: sources:

OneScuzzie2k commented 4 months ago

Still not working? anyone?

Dukeicon commented 4 months ago

Somerset is working for me (TA2 based).

It's worth noting though, that it only returns one date for each of the three types of recycling, this is due to the limitations of the source.

Screenshot 2024-05-17 at 16 00 39

Data Source: https://iweb.itouchvision.com/portal/f?p=customer:BIN_DAYS:::NO:RP:UID:625C791B4D9301137723E9095361401AE8C03934

It's also worth noting that sometimes it takes a few hours past midnight for the source website to show the next collection date(s). As you can see here, there was a 2 hour break where it was unknown.

Screenshot 2024-05-17 at 16 12 28

I have set up an automation to run ever hour when any of the sensor's states are 'unknown'.

alias: Rubbish & Recycling - Refetch
description: Fetches Rubbish & Recycling every hour when it becomes Unknown.
trigger:
  - platform: time_pattern
    hours: /1
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: sensor.refuse_collection
        state: unknown
      - condition: state
        entity_id: sensor.recycling_collection
        state: unknown
      - condition: state
        entity_id: sensor.garden_collection
        state: unknown
action:
  - service: waste_collection_schedule.fetch_data
    data: {}
mode: single

I think the title for the black bin has changed from 'Refuse' to 'Rubbish' on the source site. I have both Refuse and Rubbish in my configuration.

waste_collection_schedule:
  sources:
    - name: iweb_itouchvision_com
      args:
        postcode: !secret home_postcode
        uprn: !secret home_uprn
        council: !secret home_county
      customize:
        - type: Refuse
          show: True
          icon: mdi:trash-can
        - type: Recycling
          show: True
          icon: mdi:recycle
        - type: Garden
          show: True
          icon: mdi:compost
      calendar_title: Waste Collections
  day_switch_time: "23:59"
  fetch_time: "00:30"

sensor:
  - platform: waste_collection_schedule
    name: Refuse Collection
    value_template: "{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}"
    date_template: '{{value.date.strftime("%d/%m/%Y")}}'
    add_days_to: TRUE
    types:
      - Refuse
      - Rubbish
  - platform: waste_collection_schedule
    name: Recycling Collection
    value_template: "{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}"
    date_template: '{{value.date.strftime("%d/%m/%Y")}}'
    add_days_to: TRUE
    types:
      - Recycling
  - platform: waste_collection_schedule
    name: Garden Collection
    value_template: "{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}"
    date_template: '{{value.date.strftime("%d/%m/%Y")}}'
    add_days_to: TRUE
    types:
      - Garden

There does appear to be a new source for the data which has the next and future collection date (although no year in the date). https://iportal.itouchvision.com/icollectionday/collection-day/?uuid=625C791B4D9301137723E9095361401AE8C03934&lang=en

Screenshot 2024-05-17 at 16 11 04

I wouldn't know where to start with getting this update into the code though.

OneScuzzie2k commented 4 months ago

Thanks mine all of sudden started working yesterday!

Dukeicon commented 4 months ago

What day is your usual collection?

Before I created the automation to update if the entity(s) were 'unknown', the sensor(s) were showing in HA as unknown for a couple days after my collection day.