mampfes / hacs_waste_collection_schedule

Home Assistant integration framework for (garbage collection) schedules
MIT License
1.11k stars 666 forks source link

Request for Ribble Valley Borough Council - UK #983

Open TheCableGuy99 opened 1 year ago

TheCableGuy99 commented 1 year ago

Hi,

Please could I request support for [Ribble Valley Borough Council] (https://www.ribblevalley.gov.uk/) in the UK?

I'm not sure what you need but here's a couple of links for looking up on their website: https://www.ribblevalley.gov.uk/directory/1/find-your-bin-collection-day https://www.ribblevalley.gov.uk/downloads/download/434/bin-collection-calendars-2023-2024

If I can be of any further help please let me know, I just don't know what info you need to implement it?

Thanks.

dt215git commented 1 year ago

It doesn't look like they display collection dates, just the day of the next collection. You could use the printed calendar and the static source to generate the schedule. For example, this calendar and config should be equivalent .

image

waste_collection_schedule:
  sources:
    - name: static # Source 0
      args:
        type: Burgundy
        weekdays: WE
        frequency: WEEKLY
        start: '2023-05-05'
    - name: static # Source 1
      args:
        type: Blue
        frequency: WEEKLY
        interval: 2
        weekdays: WE
        start: '2023-05-12'
        dates: '2023-12-27'
    - name: static # Source 2
      args:
        type: Green
        frequency: WEEKLY
        interval: 2
        weekdays: WE
        start: '2023-05-05'
    - name: static # Source 3
      args:
        type: White
        frequency: WEEKLY
        interval: 2
        weekdays: WE
        start: '2023-05-05'
sensor:
  - platform: waste_collection_schedule
    source_index: 0
    name: Burg
    details_format: appointment_types
    add_days_to: true
  - platform: waste_collection_schedule
    source_index: 1
    name: Blue
    details_format: appointment_types
    add_days_to: true
  - platform: waste_collection_schedule
    source_index: 2
    name: Green
    details_format: appointment_types
    add_days_to: true
  - platform: waste_collection_schedule
    source_index: 3
    name: White
    details_format: appointment_types
    add_days_to: true

image

You could probably combine Green and White into a single item given they always seem to be collected together.

TheCableGuy99 commented 1 year ago

Hi,

Thanks for looking into that for me. I have to say that i'm confused how to set this up though. I'm very new to HA and am setting it up for the first time.

I've installed HACS and your plugin but what do I do now please? Do I just put all that code above in the configuration.yaml and that's it? Sorry but it's such a steep learning curve my heads battered now with all the other integrations as well.

Thank you for your help!

dt215git commented 1 year ago

Mampfes plug-in, not mine :smiley:

Do I just put all that code above in the configuration.yaml and that's it?

Essentially, yes, rebooting your HA instance helps it pick up the change.

Start simple - just set up one of the collection types and get it working, then add the others. The static source is quite flexible, so with a bit or reading and some trial & error you should be able to replicated your specific printed schedule. The other configuration options can be used to fine tune things further if you feel the need to.

TheCableGuy99 commented 1 year ago

Hi,

Sorry for the delay in replying. I was just too tired to look into this yesterday.

So I've added the config and rebooted but I got an error that there was a problem with the config when rebooting. I looked at the logs but don't really know what it's saying is wrong:

`2023-05-22 09:27:26.569 ERROR (MainThread) [homeassistant.setup] Error during setup of component waste_collection_schedule Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/dateutil/parser/isoparser.py", line 208, in _parse_isodate return self._parse_isodate_common(dt_str) File "/usr/local/lib/python3.10/site-packages/dateutil/parser/isoparser.py", line 217, in _parse_isodate_common raise ValueError('ISO string too short') ValueError: ISO string too short

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 257, in _async_setup_component result = await task File "/config/custom_components/waste_collection_schedule/init.py", line 109, in async_setup api.add_source_shell( File "/config/custom_components/waste_collection_schedule/init.py", line 202, in add_source_shell SourceShell.create( File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 196, in create source = source_module.Source(*source_args) # type: ignore File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/static.py", line 91, in init self._dates = [parser.isoparse(d).date() for d in dates or []] File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/static.py", line 91, in self._dates = [parser.isoparse(d).date() for d in dates or []] File "/usr/local/lib/python3.10/site-packages/dateutil/parser/isoparser.py", line 37, in func return f(self, str_in, args, **kwargs) File "/usr/local/lib/python3.10/site-packages/dateutil/parser/isoparser.py", line 134, in isoparse components, pos = self._parse_isodate(dt_str) File "/usr/local/lib/python3.10/site-packages/dateutil/parser/isoparser.py", line 210, in _parse_isodate return self._parse_isodate_uncommon(dt_str) File "/usr/local/lib/python3.10/site-packages/dateutil/parser/isoparser.py", line 255, in _parse_isodate_uncommon raise ValueError('ISO string too short') ValueError: ISO string too short 2023-05-22 09:27:26.576 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform waste_collection_schedule.sensor: Unable to set up component. 2023-05-22 09:27:26.579 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform waste_collection_schedule.sensor: Unable to set up component. 2023-05-22 09:27:26.580 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform waste_collection_schedule.sensor: Unable to set up component. 2023-05-22 09:27:26.580 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform waste_collection_schedule.sensor: Unable to set up component. 2023-05-22 09:27:29.879 WARNING (SyncWorker_3) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "sensor". Check lines 46 and 86 2023-05-22 09:27:30.942 ERROR (MainThread) [homeassistant.components.mqtt.client] Failed to connect to MQTT server due to exception: [Errno -2] Name does not resolve 2023-05-22 09:27:32.243 WARNING (MainThread) [homeassistant.components.heos] 192.168.10.25 is not logged in to a HEOS account and will be unable to retrieve HEOS favorites: Use the 'heos.sign_in' service to sign-in to a HEOS account`

Would you be able to offer any assistance please?

Thank you for your help.

TheCableGuy99 commented 1 year ago

Okay I'm getting closer with this. It was the "until" date it didn't like. I removed it and there's no errors.

So I've taken it down to a single bin for now to keep it simple and try get it all customised but i'm struggling with getting certain things customised. For example, the name, the colour and icon. This is what I have no but no matter what I try the I think the customise is in the wrong place and I can't seem to find any way to change the colour:

  sources:
    - name: static # Source 0
      args:
        weekdays: WE     
        type: Altpapier
      customize:
        alias: Paper Collection
        icon: mdiDelete 
        frequency: WEEKLY
        interval: 2
        start: '2023-04-05'

sensor:
  - platform: waste_collection_schedule
    source_index: 0
    name: White
    details_format: appointment_types
    add_days_to: true

Thanks.

dt215git commented 1 year ago

I'd be inclined to strip out the customisations and get the basic schedule working first.

waste_collection_schedule:
  sources:
    - name: static
      args:
        weekdays: WE
        type: Paper Collection
        frequency: WEEKLY
        interval: 2
        start: "2023-04-05"
      calendar_title: Paper Collection

sensor:
- platform: waste_collection_schedule
  name: Paper Collection
  details_format: appointment_types
  add_days_to: true

I don't think you need to use alias given you can define the type within the config. If this was pulling waste types from a website you wouldn't have any control over what the wastes were called, in that scenario you could use alias to remap "White Sack" to "Paper Collection". I've never used the icon option, but others might have experience with that.

What to you mean by changing colour? The colours used for the calendar entries are determined by HA and, currently, I don't think you can specify those.

TheCableGuy99 commented 1 year ago

brilliant, yeah I was getting mixed up with the alias and trying to called it Paper Collection as it was saying Static Source. That's resolved that thank you!

So all I want to do now is change the colour if possible to the background of the writing. So I could make the green bin a green background. If you don't think it's possible I'll just have a Google around and probably ask on Facebook to be sure. If not I can live with the random default colour.

Thank you very much for all your help!