Skip to content

Simple HTTP service to generate iCal definitions for mijnafvalwijzer for use in calendar apps or home automation

License

Notifications You must be signed in to change notification settings

jeffreykog/mijnafvalwijzer-ical-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mijnafvalwijzer iCal Proxy

This is a simple Python project acting as a proxy for Mijnafvalwijzer. The problem with Mijnafvalwijzer is that they don't provide an easy API which can be used for home automation, or showing the pickup moments in your agenda. This application parses the Mijnafvalwijzer portal using Beautifulsoup. The content is then returned as a nice json object containing the next pickup moment, or as a full iCal file which can be dynamically imported to your agenda.

Installing

First, install all the dependencies using pip:

$ pip install -r requirements.txt

Afterwards you can simply start the application using uvicorn:

$ uvicorn mijnafvalwijzer_ical_proxy:app

By default uvicorn will listen on port 8000, but that can be customized. For more information see uvicorn --help.

There are no external dependencies and there is no configuration needed.

API endpoints

Currently this application exposes 2 API endpoints.

To fetch information about the next pickup moment per waste type call the following endpoint:

$ curl 'http://localhost:8000/next-pickup/?postal_code=<postal code>&number=<number>&suffix=<optional suffix>&waste_type=<waste type>'

This will return the following json object:

{
    "waste_type": "gft",
    "pickup_date": "2022-09-29",
    "description": "Groente, Fruit en Tuinafval en Etensresten"
}

The output of this endpoint could be used as a Json sensor in Home Assistant.

It's also possible to retrieve an iCal file containing the next pickup moments of this year:

$ http://localhost:8000/ical/?postal_code=<postal code>&number=<number>&suffix=<optional suffix>

About

Simple HTTP service to generate iCal definitions for mijnafvalwijzer for use in calendar apps or home automation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages