A rule created by this rule template will query the recycleapp.be website once per day for the waste collection calendar on a specific address in Belgium. It will then update a number of items by fraction for the next collection date of that specific fraction.
The rule has a number of parameters:
- Time: time of day to trigger the rule, defaults to midnight
- Street: street name for collection
- Street number: street number for collection
- Zip code: zip code for collection
- Days: number of days to look ahead, optional parameter, default 60
The rule will update one or more DateTime items with the next collection date for the specific fraction. These items are optional. You only need to create items for, and configure the ones, you are interested in.
- Residual Waste Item
- PMD Item
- GFT Item
- Paper and Cardboard Item
- Textile Item
- Pruning Wood Item
- Bulky Waste Item
Note that the above 7 fractions are the ones configured in the rule. The collection of fractions may vary by region. E.g. pruning wood would return the deadline for a pruning woord collection appointment in some places.
Also, the strings used in the API response to describe certain (the same) fractions vary by region. Therefore, if one of your fractions is not recognized, it may require adding alternative detection strings to the rule. If you notice this, let me know and the template rule will be completed.
If you have other fractions, you can manually add them to the created rule. If you communicate back, the template will be adjusted.
The rule template will by default log success and failure. The logging level can be increased to DEBUG or TRACE for more detailed information. Use following command in the openHAB console for DEBUG level:
log:set DEBUG org.openhab.model.script.mherwege.wasteBelgium
If you use sitemaps, you can easily render a line in the UI when the collection is in the next days. Here is an example of such a configuration:
Text item=ResidualWaste label="Residual waste [%1$tA]" icon="error" visibility=[ResidualWaste > -172800] Text item=PMD label="PMD [%1$tA]" icon="error" visibility=[PMD > -172800] Text item=Paper label="Paper and cardboard [%1$tA]" icon="error" visibility=[Paper > -172800]
A line will only render for a collection within the next 48 hours.
This rule template is heavily inspired by the work of @BeanzBE, who developed a binding for the same purpose, not currently part of the openHAB distribution. Many thanks for that. Rather than using the binding as a dependency, I opted to do the required http GET calls directly from the rule.
- implemented retry functionality when http request fails
- changed capitalization of header field, should not matter but seems to make a difference in stability
- added bulky waste
- add alternative GFT detection string
- filtered non collection events
- captured different collection name for residual waste (huisvuil)
- initial release