From ba836eaa16999f50259cdf5cd6b601053dbe0798 Mon Sep 17 00:00:00 2001 From: Andy Barratt Date: Tue, 11 Apr 2023 10:24:11 +0100 Subject: [PATCH] Update fife_gov_uk.md Thank you so much for your work adding Fife to the tool. I've added a more advanced example that features Fife's bin type names and a quicky example of sensors for them too. I noticed that you include a type for bottles in your code, though I'm not aware of a bottle collection. Happy to add to the example though if this is the case :) I've also added the yaml I used to create a widget on my dashboard. I just thought it a nice example and wanted to share what I was using but do say if you feel this isn't appropriate here. --- doc/source/fife_gov_uk.md | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/doc/source/fife_gov_uk.md b/doc/source/fife_gov_uk.md index ab7f40c4..0e2e75e1 100644 --- a/doc/source/fife_gov_uk.md +++ b/doc/source/fife_gov_uk.md @@ -33,3 +33,80 @@ waste_collection_schedule: An easy way to discover your Unique Property Reference Number (UPRN) is by going to and entering in your address details. Otherwise you can inspect the web requests the Fife Council website makes when entering in your postcode and then selecting your address. + +### A more complete example with a dashboard card + +Here's a more complete example of the sources that adds pictures and shorter names to the types that come back from Fife's API: + +```yaml +waste_collection_schedule: + sources: + - name: fife_gov_uk + args: + uprn: "320069189" + customize: + - type: "Food and Garden Waste / Brown Bin" + alias: "Brown Bin" + picture: https://www.binfactoryoutlet.co.uk/wp-content/uploads/2020/06/240L-Brown.jpg + - type: "Landfill / Blue Bin" + alias: "Blue Bin" + picture: https://www.binfactoryoutlet.co.uk/wp-content/uploads/2020/06/240L-BLUE.jpg + - type: "Paper and Cardboard / Grey Bin" + alias: "Grey Bin" + picture: https://www.binfactoryoutlet.co.uk/wp-content/uploads/2020/05/240L-ANTRACITE.jpg + - type: "Cans and Plastics / Green Bin" + alias: "Green Bin" + picture: https://www.binfactoryoutlet.co.uk/wp-content/uploads/2020/06/240L-Green.jpg + day_switch_time: "18:00" + +``` + +Once you've done that, you can add sensors for each bin using just those short names: + +```yaml +sensors: + - platform: waste_collection_schedule + name: Next Bin Collection + add_days_to: true + - platform: waste_collection_schedule + name: Next Blue Bin Collection + add_days_to: true + types: + - "Blue Bin" + - platform: waste_collection_schedule + name: Next Brown Bin Collection + add_days_to: true + types: + - "Brown Bin" + - platform: waste_collection_schedule + name: Next Grey Bin Collection + add_days_to: true + types: + - "Grey Bin" + - platform: waste_collection_schedule + name: Next Green Bin Collection + add_days_to: true + types: + - "Green Bin" + + ``` + +And finally, you can use those sensors with an entity-filter card to produce a widget that shows a picture of the upcoming bin collections this week: + +```yaml +type: entity-filter +entities: + - sensor.next_blue_bin_collection + - sensor.next_brown_bin_collection + - sensor.next_grey_bin_collection + - sensor.next_green_bin_collection +state_filter: + - operator: regex + value: \s(0|1|2|3|4|5|6)\s +card: + type: glance + show_name: false + show_state: true +show_empty: false + +```