mampfes / hacs_waste_collection_schedule

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

Feature request: Make sensors config part of waste_collection_schedule #318

Open Sirs0ri opened 2 years ago

Sirs0ri commented 2 years ago

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!

mampfes commented 2 years ago

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.

Sirs0ri commented 2 years ago

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?

mampfes commented 2 years ago

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?

jamesmyatt commented 1 year ago

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
sytchi commented 1 year ago

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

kevinholtkamp commented 12 months ago

Just stumpled upon this. Any news?

mampfes commented 12 months ago

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