Giter VIP home page Giter VIP logo

solivia-scraper's Introduction

Solivia Scraper

Scraper for Solivia Solar Inverters web site.

Set up

Clone the project.

git clone https://github.com/kinow/solivia-scraper.git

Create a dotEnv file

cd solivia-scraper
touch .env

Here's an example dotEnv file.

[email protected]
SOLIVIA_PASS=MyPassWord
SOLIVIA_INVERTERS=comma,separated,list,of,inverters
SOLIVIA_PLANTGUID=my-plant-gui-id

You also need to install the project dependencies

pip install -r requirements.txt

Finally, you can run the scrap.

python scraper.py --date YYYY-MM-DD

The output will be logged to your console, as in the follow example.

user@host$ python scraper.py --date 2016-08-09
2016-08-09 13:58:55,759 Starting Solivia scraper, for date 09/08/2016
2016-08-09 13:58:55,763 Starting new HTTPS connection (1): login.solar-inverter.com
2016-08-09 13:58:58,213 Starting new HTTPS connection (1): monitoring.solar-inverter.com
2016-08-09 13:59:07,054 Time,RPI M10A[1],,,
, AC Power (P1), AC Power (P2), AC Power (P3), Total Power
07:53,"0","0","0","0"
07:58,"0","0","0","0"
08:03,"0.015","0.009","0.022","0.046"
08:08,"0.033","0.023","0.037","0.093"
08:13,"0.042","0.033","0.045","0.12"
08:18,"0.052","0.042","0.052","0.146"
08:23,"0.059","0.05","0.061","0.17"
08:28,"0.065","0.056","0.066","0.187"
...

Usage

You can simply call the script with python scraper.py, or you can specify the date you would like to download the data.

python scraper.py --date 2016-08-04

Where the format is YYYY-MM-DD (i.e. year with four digits, month with two digits, and finally day with two digits too).

The complete usage:

usage: scraper.py [-h] [--date DATE] [--from FROM_] [--to TO] --types TYPES
                  [--interval INTERVAL]

Solivia Monitoring scraper

optional arguments:
  -h, --help           show this help message and exit
  --date DATE          Date (YYYY-mm-dd)
  --from FROM_         Date (YYYY-mm-dd)
  --to TO              Date (YYYY-mm-dd)
  --types TYPES        Comma separated types e.g. Power,Energy,AcParam,DcParam
  --interval INTERVAL  Being nice to servers, and waiting for an interval in
                       milliseconds before firing more requests (defaults to
                       300)

the --date parameter is exclusive to --to and --from. If --date is used, then
the others will be ignored

Output

For every time you execute the script, you should see two files in your script directory. One CSV and one JSON file, named with the timestamp for the date used to retrieve data.

Examples:

  • 20160809000000.csv
  • 20160809000000.json

The names will match.

solivia-scraper's People

Contributors

kinow avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

niwa

solivia-scraper's Issues

Add dates in file name and within file

Having the date in the file name, as well as within the date is helpful for some scripting languages, as well as for some data processing tasks. Let's add it.

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.