olibos/HomeAssistant-RecycleApp

Bug in original apps API creates duplicates

Closed this issue · 6 comments

As explained in this issue from another integration here pippyn/Home-Assistant-Sensor-Afvalbeheer#367 (comment), the original Recycle App API sometimes creates duplicates in the data returned, and they're not going to fix it. It also affects this integration, especially the calendar entity:
image

Duplicated events are returned for PMC (here using service: calendar.get_events, see two first events):

calendar.ceroux:
  events:
    - start: "2024-02-15"
      end: "2024-02-16"
      summary: Céroux PMC
    - start: "2024-02-15"
      end: "2024-02-16"
      summary: Céroux PMC
    - start: "2024-02-15"
      end: "2024-02-16"
      summary: Déchets organiques
    - start: "2024-02-20"
      end: "2024-02-21"
      summary: Déchets organiques
    - start: "2024-02-15"
      end: "2024-02-16"
      summary: Ordures ménagères résiduelles
    - start: "2024-02-20"
      end: "2024-02-21"
      summary: Ordures ménagères résiduelles

The two first entries are duplicates and therefore repeat in the calendar view. So the integration should ideally correct the API bug by filtering out the duplicates when creating the events (preferably already when fetching the data).

Hello @Friedrieck , I'll have a look and see how I can dedupe thoses collects.
Thank you for reporting.

May I ask you an approximate address to check the api result?

May I ask you an approximate address to check the api result?

I answered you via a PM on the HA community forum (did not find a way to PM here...)

Thank you for the PM.

I didn't know about service: calendar.get_events 😉
I'll fix the duplicate collection and also sort results per date.

Here is a short preview:
Request:

service: calendar.get_events
data:
  start_date_time: "2024-02-15 00:00:00"
  end_date_time: "2024-02-20 00:00:00"
target:
  entity_id: calendar.ceroux

Response:

calendar.ceroux:
  events:
    - start: "2024-02-15"
      end: "2024-02-16"
      summary: PMC
    - start: "2024-02-15"
      end: "2024-02-16"
      summary: Déchets organiques
    - start: "2024-02-15"
      end: "2024-02-16"
      summary: Ordures ménagères résiduelles
    - start: "2024-02-20"
      end: "2024-02-21"
      summary: Déchets organiques
    - start: "2024-02-20"
      end: "2024-02-21"
      summary: Ordures ménagères résiduelles

It should be fixed in v2.3.1
Can you have a look?

It should be fixed in v2.3.1
Can you have a look?

It seems fixed, thanks!