Giter Club home page Giter Club logo

wastecollectionreminder's Introduction

🗑 Udine waste collection

This repository contains the code to run a bash script that sends you a Telegram message remembering to expose the correct waste bin for the following day city waste collection.

my alt text

Telegram notifications

Collection days

Following the Udine collection calendar for the 2022, the city collections happens in this days:

Monday Tuesday Wednesday Thursday Friday Saturday Sunday
Circ. 1 🟤 ⚫️⚪️ 🟡 🔵 🟤 🟢 ⚫️⚪️
Circ. 2 🟤⚪️ 🔵 🟡 ⚫️⚪️ 🟤 🟢*
Circ. 3 🟤⚪️ 🔵 🟡 🟤 ⚫️⚪️ 🟢*
Circ. 4 🟤⚪️ 🔵 🟡 ⚫️⚪️ 🟤 🟢*
Circ. 5 🟤⚪️ 🔵 🟡 ⚫️⚪️ 🟤 🟢*
Circ. 6 🟤⚪️ 🔵 🟡 ⚫️⚪️ 🟤 🟢*
Circ. 7 🟤⚪️ 🔵 🟡 🟤 ⚫️⚪️ 🟢*

where

  • 🔵 represents the paper packagings collection;
  • 🟡 represents the plastic packagings collection;
  • 🟤 represents the organic waste collection;
  • ⚫️ represents the undifferentiate collection;
  • ⚪️ represents the diapers collection;
  • 🟢 represents the glass and jar collection.

Requirements

In order to successfully run the code, you only need curl installed on your system.

Usage

1. Clone this repository on your PC

First of all, clone in you home folder (or wherever you like in your system) the project folder from the GitHub repository.

cd ~    # Navigate to the place where you want the project folder to be
git clone enstit/wastecollection_reminder

2. Create a Telegram bot

Note If you don't know how to create a Telegram bot using BotFather, read the official guide.

After creating the Telegram bot, save your BOT_TOKEN and GROUP_ID.

3. Edit the configuration file

After cloning this repository, and once insite its directory, make your copy of the config file

cp config.ini.example config.ini

and edit it with your chosen values for the variables.

nano config.ini
Environment variables
Collection days section
  • Monday: the waste bin that is being collected each Monday;
  • Tuesday: the waste bin that is being collected each Tuesday;
  • ...
  • Saturday: the waste bin that is being collected each Saturday.

If multiple bins are being collected in a single day, place them into an array.

Notify config section
  • BOT_TOKEN: yout Telegram API token to send the notifications with the bot you created previously;
  • GROUP_ID: the Telgram bot chat ID.

4. Add the script to crontab

Enter the crontab configuration file

crontab -l > mycron # write out current crontab
echo "<MINUTE> <HOUR> * * * /bin/sh <PATH TO THE PROJECT FOLDER>/send_wastecollection_notify.sh" >> mycron # echo new cron into cron file
crontab mycron # install new cron file
rm mycron # remove temporary file

changin MINUTE to the minute of the HOUR, and HOUR to the 24-format hour you want to receive the notification. So for example, if you want to be notified each day at 7pm the day before the city collection, simply run

crontab -l > mycron
echo "00 19 * * * /bin/sh <PATH TO THE PROJECT FOLDER>/send_wastecollection_notify.sh" >> mycron
crontab mycron && rm mycron

And you're done!

wastecollectionreminder's People

Contributors

enstit avatar

Stargazers

Luca Danelutti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.