Script to grab the date of the next bin collection from the Local Council's website.
This script requests the HTML of the Local Council's webpage. XPath expressions are then used to navigate the DOM, returning information relating to the dates various bins will be emptied (e.g. refuse, recycling, food, etc.). This information is then written to an Inky pHAT e-paper display from Pimoroni, attached to a Raspberry Pi Zero W.
It is suggested the script is run regularly as a cron job (once at midnight, once at 12 noon). You will need to modify the XPath expression to allow it to work with your Local Council's website.
To run the script, the following packages are required:
Pillow
- Python Imaging Library (Fork) Pillowinky
- Python library for the Pimoroni Inky pHAT e-paper displaylxml
- Used to parse the DOM of the webpagerequests
- Requests the HTML of a webpagenexmo
- SMS service
Install these via pip:
pip install Pillow inky lxml requests nexmo
Suggested cron schedule (twice per day- midnight and at 12 noon):
0 0 * * * /usr/bin/python /home/pi/BinDayAlert/Code/binDayAlert.py >> /home/pi/log.txt 2>&1
0 12 * * * /usr/bin/python /home/pi/BinDayAlert/Code/binDayAlert.py >> /home/pi/log.txt 2>&1
- Tidy script