Skip to content

High Peak Borough Council - bin sensor goes Unavailable when next collection falls just outside the current Month view #2218

Closed

Description

@ttaggorf

The scraper waits for .e-appointment elements in the default Month view, then filters for collectionDate >= today. Because the Month grid only renders trailing days up to the end of the last displayed week (not a full rolling window), a bin type whose next collection falls just past that cutoff - while its last collection is already in the past — returns zero appointments and the HA sensor shows Unavailable.

Additionally, the < today filter (not <= today) means a bin type with an appointment dated today that's already been collected (Status: Closed-Complete) is still returned as if it were the next collection - masking the bug for bins whose cycle happens to align with today.

Suggested fix: switch to the site's built-in Agenda view (option: "Agenda", agendaDaysCount: 31), which shows a rolling 31-day window from today rather than a fixed calendar month - or advance to the next month if no valid appointment is found before returning.

Happy to test a fix if pointed in the right direction.

Activity

  1. changed the title [-]High Peak Borough Council — bin sensor goes Unavailable when next collection falls just outside the current Month view[/-] [+]High Peak Borough Council - bin sensor goes Unavailable when next collection falls just outside the current Month view[/+] on Aug 31, 2026
  2. robbrad commented on Sep 2, 2026

    @robbrad
    Owner

    Great diagnosis, and confirmed both parts live.

    Fixed the primary bug: switched the scraper to the site's built-in Agenda view (a toolbar button already on the page) before reading appointments, which gives a genuine rolling window from today instead of a fixed calendar month. Verified end-to-end that this resolves the cutoff. Included in the September release PR.

    On the second part — the "today, already collected" edge case — I looked for a way to detect completion status in the appointment data (the way a couple of other councils in this repo expose a Status: Closed-Complete field), but High Peak's calendar appointments carry no such signal in their aria-labels or CSS classes to distinguish "today, not yet collected" from "today, already done". Changing the filter to exclude today entirely would risk hiding a genuine same-day collection for anyone checking before it happens, which seems like a worse trade-off than the rare case this issue describes. Leaving that part as-is for now — happy to revisit if you spot a status signal I missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions