Coder Social home page Coder Social logo

iokaravas / deddie_outages Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 31 KB

A script that parses the planned power interruptions' website of the Hellenic Electricity Distribution Network Operator (DEDDIE/HEDNO) deddie.gr

License: MIT License

JavaScript 100.00%

deddie_outages's Introduction

deddie_outages

A Node script that parses the planned power interruptions' website of the Hellenic Electricity Distribution Network Operator (DEDDIE/HEDNO) deddie.gr

The script can be run once or set to check every X minutes. It keeps the latest planned outages scrapped in ./.outages.json. It will compare these outages and report back/notify only for new ones.

Please note that this is a personal side project I worked on during my free time. I may use weird/uncommon ways of doing stuff just for learning purposes. As it stands though, the software is fully functional, and I'm pushing only working prototypes.

If you wish you can always drop me a line with suggestions/issues in issues or at @karavas.

Dependencies

deddie_outages has the following dependencies:

Quick Start

You can grab a copy:

git clone https://github.com/iokaravas/deddie_outages

Executing

Example run to get all outages for ATTICA (ΑΤΤΙΚΗ)

deddie_outages --p=10

Getting all options

deddie_outpages.js --help

In order to use you need a prefectureID (--p) and a municipalityID (--m)
You can get a list using --list-prefectures and --list-municipalities=number
---
Usage: < --p=number --m=number [--runevery=number (minutes)] [--notify]
 deddie_outages --p=10 --m=112 --runevery=3 --notify

Optionally you should setup .env for notifications to work, (need a Pushover app/api key)

PUSHOVER_DEVICE=S10
PUSHOVER_USER=u6Xwnb3DAfGx9BNuGKyDfD33ZiQVbh
PUSHOVER_TOKEN=a7ui5sturig74qw4cz843ukv658e316
PUSHOVER_SUFFIX= @deddie
PUSHOVER_SOUND=

Required IDs (Prefecture/Municipality)

You can find all prefecture/municipality combinations of IDs in file prefs.munics.csv and can access the lists through the CLI, too:

Listing all prefectures:

deddie_outages --list-prefectures

Listing municipalities for a single prefecture:

deddie_outages --list-municipalities=10

Authors

  • Ioannis (John) Karavas - Initial work - iokaravas

See also the list of contributors who participated in this project.

DISCLAIMER:

Parsing is quite fragile. Since sites change all the time, it is not uncommon for parsers to break when pages change in some way.

TODO

Several things could be added and/or improved, including :

  • Perhaps use of node-cron for refined scheduling?
  • Better way to read CSV? Didn't want to include a csv reader...
  • Allow for better search for prefectures/municipalities
  • Handle more potential errors
  • Add verbose option
  • Batch lookup
  • Better naming

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.