hacs_waste_collection_schedule icon indicating copy to clipboard operation
hacs_waste_collection_schedule copied to clipboard

Feature request: Make sensors config part of waste_collection_schedule

Open Sirs0ri opened this issue 2 years ago • 7 comments

Hi, would it be possible to move the sensor config in my homeassistant yaml file from the sensor: scope to the waste_collection_schedule: scope, similar to how for example the rest platform is set up?

ie, something like this:

waste_collection_schedule:
  # "sources" remains unchanged:
  sources:
    - name: abfall_io
      args:
        # key, f_id_kommune, f_id_bezirk, f_id_strasse...
        f_abfallarten:
          - 17 # Recycling
  # this is new inside the waste_collection_schedule namespace:
  sensor:
    - name: Recycling
      count: 3
      value_template: '{{ value.date.strftime("%d.%m.%Y") }}'
      date_template: '{{ value.date.strftime("%a, %d.%m.%Y") }}'
      add_days_to: true
      types:
        - Recycling

# this would be no longer necessary:
sensor:
  - platform: waste_collection_schedule
    name: Recycling
    # Rest of the config...

It would make the YAML a bit easier to read since the config would no longer be partially in the waste_collection_schedule: namespace, and also part of sensor:

Thanks for considering!

Sirs0ri avatar Aug 02 '22 00:08 Sirs0ri

Hi, I also already thought about this. The main problem is that there is a huge installed base and that changing the schema would cause a lot of installations to break. I know that HomeAssistant today uses the schema you described, but at the time when I started this projects, they did it the other way round.

mampfes avatar Aug 07 '22 15:08 mampfes

Yeah, I get that, HA started transitioning to the new format not too long ago itself.

How much work would it be to have both options available for a couple of versions with a depreciation warning for the current format, so that there's a transitioning period instead of making it a fully breaking change, similar to how HA does it?

Sirs0ri avatar Aug 07 '22 21:08 Sirs0ri

Should be feasible. But due to my workload I'm not able to do more than merging PRs and to fix bugs at the moment. Are you willing to create a PR?

mampfes avatar Aug 12 '22 05:08 mampfes

I think you can just do this locally with packages.

I haven't tried it but you can probably create a package file that looks like this:

waste_collection_schedule:
  sources:
    - ...

sensor:
  - platform: waste_collection_schedule
    name: next_collection

jamesmyatt avatar Jan 06 '23 15:01 jamesmyatt

Home Assistant is already warning, that support for the old format will be discontinued in August. It's becoming a bit urgent now 🥲

sytchi avatar Jun 22 '23 07:06 sytchi

Just stumpled upon this. Any news?

kevinholtkamp avatar Sep 18 '23 22:09 kevinholtkamp

@sytchi @kevinholtkamp I do not see a warning in my logs. Could s.o. post it here?

mampfes avatar Sep 21 '23 12:09 mampfes