Garbage Collection

Hello,
first of all many thanks for your support.

The part about the items is exactly what I don’t understand. I have read the two articles

as a guide, but I don’t really understand how to get from the things to the items and then the items into the widget.

The first post says:
4.3 The used channel is "result_0#begin

Since I did not manage to create multiple items with this code snippet, I created 1 groupe item.

However, I think that this way was wrong, right?

In the end, the question remains for me:

What is the exact path: calendar thing → items → widget?

please read the principles of openHAB again here:

with the Garbage Collection widget you have to first install a “icalendar”-Thing as described in your first link. Some Bindings need mor things - and this is the case here. First of you have the “icalendar configuration” thing, which simply provides access to the CalDAV-calendar. Then theres (three of four) things for each of the garbage colour (“icalendar filter” things). Those things filter your garbage calendar for the different kind of garbages - you only have to filter for e.g. the text in the title.

So at the end you have four or five things, and only the filter things have the channels we need to use for the widget:

  1. Start (at least this one is needed!)
  2. End
  3. Title

you open one of those “channels” and add one item at least every “start” channel, so you end up with a minimum of 3 items (each color one item - if you’re not having “gelber Sack” also, which would be #4 then)
In your example you added both “Restmüll” and “Biotonne” Start-channel to one item, you have to have different items!

last of all, you then enter the item-names in the widget with the “datearray”-attribut and the widget does the rest, for example my configuration:

datearray = 
'"Restmüll","black","f7:trash","Restmuell_Start"|
"Bioabfall","orange","f7:trash","Biotonne_Start"|
"Gelber Sack","yellow","f7:trash","GelberSack_Start"|
"Altpapier","blue","f7:trash","Altpapier_Start"'

so, as you can see, theres four different sets of information for each “garbage colour”:

  • name (first column)
  • colour (second column)
  • icon (third coloumn)
  • item name (fourth column)

then there’s the divider “|” between the set of garbage collection items. you can have a (theoretically) infinite number of garbage collection “Start” items, and the widget would iterate through each of them.

same with the footer-array, for that you need a special filter thing, which only filters for the “next” garbage date (regardless the “colour”) and results in a separate “next garbage collection item”. That item you have to seperately filter and insert in the “footer”-part of the widget. in my case I named the item “naechsteAbfuhr_Start”:

footer: '="Nächste Abfuhr: " +
                    ((dayjs(items.naechsteAbfuhr_Start.state).diff(dayjs().startOf("day"),
                    "days")) == 0 ? "Heute" :
                    (dayjs(items.naechsteAbfuhr_Start.state).diff(dayjs().startOf("day"),
                    "days")) == 1 ? "Morgen" : "In " +
                    (dayjs(items.naechsteAbfuhr_Start.state).diff(dayjs().startOf("day"),
                    "days")) + " Tagen")'

Thank you Thomas!

I think that the item names you are referring to in the widget do not exist yet so you would need to create these first by following the explanations of Thomas.

Just one remark on this paragraph:

This is definitely one way to do it but not the only one: I added all my garbage collection dates to a group which aggregates all items states to the earliest state and use this group item for the footer. The result is the same of course so you can choose which way you prefer.

1 Like

Thank you both, now it works.

BTW: Would it make sense to document the whole way I went and post it here in the forum. I don’t want to clutter the forum, but I had to search quite a bit until I had all the parameters together and understood.

2 Likes

In my opinion this is always welcome if it has the potential to help other users in the future. Just keep in mind that there might be different approaches on how to setup things and items depending on which binding you are using so not necessarily all of what you did has to apply for other users. This is after all just a widget that does not care where the data came from in the first place. However I guess the vast majority of users will receive their dates via the icalender binding so I think your setup is pretty standard and might be of use for potentially lots of other people.

I have a question as to what my best approach is.
My local garbage collection is organized through the city, and published through an ical service that gives the type of pickup as the event description, and then the start/stop times.
They are not separate calendars for each type of pickup. It appears that this widget is depending on multiple calendars, one for each form of waste/paper/organics pickup.

This widget looks nice, but doesn’t seem well tailored to this single calendar approach.
There are only two types of service (Organics and Recycling, and Organics and Garbage), which occur on alternating weeks.
I likely have my work cut out for me, as I don’t see other garbage or calendar widgets.

Am I better off to create a rule that parses the items every time the calendar refreshes, then populates manual items for each pickup type (one for Organics and Recycling, and the other for Organics and Garbage) with their start/stop times, or am I better off to re-code (learn to re-code, then do it) the widget to be better suited to this need? I imagine the configuration parameters would allow for text string to match for various forms of collection.

Of course, if there is an existing solution that would do this already, or I am misunderstanding this widget, please correct me!

I appreciate the advice/direction.

Hi Ben,

actually the widget does not care where your dates come from. I use the exact same setup as you do. I have one iCal calendar for all the different pickups. You can use eventfilter things from the iCal binding to extract the dates of individual pickup types. If I remember correctly we already had some screenshots in this thread but the binding documentation will also be helpful here. If you have all your required items in place you can just use the widget without any changes.

Thanks DrRSatzteil,
The event filter was what I needed. Looking back through this thread, I found this post that perfectly outlined the steps I needed to do.

I assume we’re limited to the 15 colors F7 offers (Color Themes | Framework7 Documentation)? Although it appears that if I use an HTML code for a color outside that range of 15, I get a gray icon (which is useful for ‘general waste’). Or am I misunderstanding how these colors work?

Exactly. At least I don’t think there is another simple way to colour these icons but by the use of one of the predefined colour themes. I think if you use something invalid as a colour the icon just stays uncoloured. Don’t know if I ever tried that but yes this would probably give you another option then.

Hi all,
just wanted to share my progress with this. Instead of using the same datasource as shown above I always tracked my garbage collection via ical and google calendar.
The difference in my setup shows in the items itself as I don’t have items for each trash can, but items for the next few events in the calendar and they are therefore sorted right away.

image

MullkalenderEintragsfilter_Result_0_Begin ➔ Date of event start
MullkalenderEintragsfilter_Result_0_Title ➔ Trash information converted into readable names
MullkalenderEintragsfilter_Result_0_Color ➔ Trash information converted into matching color

Title and Color are two items connected to the same thing, being the calendar event title, but they are transformed via two separate .map files shown below.

uid: garbage_list_v1
tags: []
props:
  parameters:
    - description: Title of the card
      label: Title
      name: title
      required: false
      type: TEXT
    - description: Your local translation for <tomorrow>
      label: Tomorrow translation
      name: tomorrow
      required: true
      type: TEXT
    - description: Your local translation for <today>
      label: Today translation
      name: today
      required: true
      type: TEXT
    - description: Date items
      label: Date items
      name: datearray
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Feb 24, 2024, 2:16:23 AM
component: f7-card
config:
  title: =props.title
slots:
  default:
    - component: f7-card-content
      slots:
        default:
          - component: f7-list
            config:
              mediaList: true
            slots:
              default:
                - component: oh-repeater
                  config:
                    for: listitem
                    in: =props.datearray.split("|")
                    fragment: true
                  slots:
                    default:
                      - component: oh-list-item
                        config:
                          title: =items[loop.listitem.split("\"")[1]].state
                          icon: =loop.listitem.split("\"")[5]
                          iconColor: =items[loop.listitem.split("\"")[3]].state
                          badge: '=((dayjs(items[loop.listitem.split("\"")[7]].state).diff(dayjs().startOf("day"), "days")) == 0 ? (props.today) : (dayjs(items[loop.listitem.split("\"")[7]].state).diff(dayjs().startOf("day"), "days")) == 1 ? (props.tomorrow) : false)'
                          badgeColor: '=((dayjs(items[loop.listitem.split("\"")[7]].state).diff(dayjs().startOf("day"), "days")) == 0 ? "red" : "yellow")'
                          footer: =items[loop.listitem.split("\"")[7]].displayState
                          visible: '=items[loop.listitem.split("\"")[7]].state == "UNDEF" ? false : true'

"MullkalenderEintragsfilter_Result_0_Title","MullkalenderEintragsfilter_Result_0_Color","f7:trash","MullkalenderEintragsfilter_Result_0_Begin"|"MullkalenderEintragsfilter_Result_1_Title","MullkalenderEintragsfilter_Result_1_Color","f7:trash","MullkalenderEintragsfilter_Result_1_Begin"|"MullkalenderEintragsfilter_Result_2_Title","MullkalenderEintragsfilter_Result_2_Color","f7:trash","MullkalenderEintragsfilter_Result_2_Begin"|"MullkalenderEintragsfilter_Result_3_Title","MullkalenderEintragsfilter_Result_3_Color","f7:trash","MullkalenderEintragsfilter_Result_3_Begin"

Trash.map

USB\ Abfuhr\ Gelb\ -\ kombinierte\ Wertstofftonne=Gelbe Tonne
USB\ Abfuhr\ Grau\ -\ Restmüll=Restmüll
USB\ Abfuhr\ Blau\ -\ Altpapier=Papiermüll
USB\ Abfuhr\ Braun\ -\ Bioabfälle=Bio Tonne

Color.map

USB\ Abfuhr\ Gelb\ -\ kombinierte\ Wertstofftonne=yellow
USB\ Abfuhr\ Grau\ -\ Restmüll=black
USB\ Abfuhr\ Blau\ -\ Altpapier=blue
USB\ Abfuhr\ Braun\ -\ Bioabfälle=brown
1 Like

Thank you for sharing this, I really like it. The reason why I chose a different approach is that we have garbage collections for bulk trash that only takes place a few times in the year. I still wanted to be able to see the next pickup date for the bulk trash collection even if there are multiple other collection types in between. However I really like the sorted list. Mine is still unsorted but it did not bother me enough to go and change this :wink:

You’re talking about christmas trees for example? They are actually showing up in my case, I just need to add them to the mapping - Unless they are in there they are just shown with a weird title.
The only disadvantage in that case is that one of the others is falling down behind once one of those “special” collections is getting closer.

Thanks for your great work! :slight_smile:

Yes christmas trees is another category however that does not bother me too much. I’m more interested in the bulk trash pickup. Yes I see that this will also show up in your version but only if it is within the next 4 pickup dates. With my approach it is also shown when it is still 6 months in the future and there are, let’s say 20 other pickups in between.

But in the end this is just a matter of what kind of information you’re most interested in. I probably could also live with your approach :slight_smile: