mampfes / hacs_waste_collection_schedule

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

[Bug]: Static sensors becoming unknown #1407

Open CZonin opened 9 months ago

CZonin commented 9 months ago

I Have A Problem With:

A specific source

What's Your Problem

Since 2023.11.x my static sensors are randomly changing their state to unknown. The only fix I've found is commenting out my config, restarting, then un-commenting, and restarting again.

Source (if relevant)

No response

Logs

no relevant logs

Relevant Configuration

waste_collection_schedule:
  sources:
    - name: static
      args:
        type: garbage
        frequency: WEEKLY
        weekdays: { MO, TH }
    - name: static
      args:
        type: papers
        frequency: WEEKLY
        interval: 2
        weekdays: WE
        start: '2023-11-15'
    - name: static
      args:
        type: bottles
        frequency: WEEKLY
        interval: 2
        weekdays: WE
        start: '2023-07-05'

sensor:
  - platform: waste_collection_schedule
    name: Garbage
    types:
      - garbage
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}{{value.date.strftime("%a, %b %d")}}{% endif %}'
    source_index: 0
  - platform: waste_collection_schedule
    name: Papers
    types:
      - papers
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}{{value.date.strftime("%a, %b %d")}}{% endif %}'
    source_index: 1
  - platform: waste_collection_schedule
    name: Bottles
    types:
      - bottles
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}{{value.date.strftime("%a, %b %d")}}{% endif %}'
    source_index: 2

Checklist Source Error

Checklist Sensor Error

Required

DerHerzog7 commented 9 months ago

I have the same issue except it won't add the collection schedule at all. Just says "unavailable".

geozza123 commented 9 months ago

Same issue here. I was using an iCal for London Borough of Bromley. I saw this now had direct support, and making the switch got things working again. However after a week it is back to reporting unknown

alanmilinovic commented 9 months ago

I am using mymuell.jumomind.com and they provide ics that can be used in hassio with ics calendar custom component. Then with sensor template, I am able to build sensors for my garbage. That way no need for this component.

stephenjamieson commented 9 months ago

I had this issue, I modified start: '2023-07-05' to the next day in the future for the source, and it came back after that.

capandcamera commented 9 months ago

Same issue here. I was using an iCal for London Borough of Bromley. I saw this now had direct support, and making the switch got things working again. However after a week it is back to reporting unknown

@geozza123 A fix has gone in for Bromley which could be contributing to them being unknown: https://github.com/mampfes/hacs_waste_collection_schedule/issues/1269

geozza123 commented 9 months ago

The latest update has fixed my garden waste, but the others are still showing unknown.

geozza123 commented 9 months ago

I have found what my issue is. It looks like the names have changed, (I had some customisation that shortened long names) and it seems these no longer report "collection" on the end. Removing this has fixed my issue

      customize:
        - type: Food Waste collection
          alias: Food Waste
        - type: Garden Waste collection
          alias: Garden Waste
        - type: Mixed Recycling (Cans, Plastics & Glass)
          alias: Mixed Recycling
        - type: Non-Recyclable Refuse
          alias: General Waste
        - type: Paper & Cardboard
          alias: Cardboard

The above seems to now work