Coder Social home page Coder Social logo

sergluka / elektrum-lv-unofficial-api Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 151 KB

Unofficial API for 'elektrum.lv' for electric meters data fetching

License: Apache License 2.0

Kotlin 66.64% JavaScript 33.13% Dockerfile 0.23%
grafana influxdb monitoring electricity-consumption api docker-compose latvia

elektrum-lv-unofficial-api's Introduction

โš ๏ธ No longer supported

Library and application to get electric meters measures from 'elektrum.lv' site

Disclaimer: This library and application, have no any connection neither with 'elektrum.lv' site creators nor 'AS Latvenergo'. Also, the data you get are mirrored from a site, and just how they are. Mainly, it's just a web site parser and realization of my idea.

Precondition:

  • Registration for 'elektrum.lv'. If you are not a Latvian resident, most likely this application won't be useful for you.

Export options:

InfluxDB

Main idea of this project is to monitor electric meters data, add analytics, reports and visualize them. For this purposes very suits combination of InfluxDB and Grafana. If you wish, is possible to add alarms into Grafana for monitoring your consumption limits. But take into account that source data on a site has been refreshed with delay in one, two days.

Grafana screenshot

You can use docker-compose.yml to run InfluxDB and Grafana in containers.

CSV

Export data into CSV file in format yyyy-mm-dd;kWh

Library usage:

val period = Period.DAY 
val from = LocalDate.of(2016, 1, 1)
val to = LocalDate.now()
ElektrumFetcher().use {
    it.authorize("[email protected]", "password")
    val meters = when (period) {
        Period.YEAR -> it.fetchMonthly(from, to)
        Period.MONTH -> it.fetchDaily(from, to)
        Period.DAY -> it.fetchHourly(from, to)
    }
    println(meters)
}

Application usage:

  • Download latest 'elektrum-fetcher-xx.jar'
  • Place 'settings.yml' near the jar file.
  • Set your credential for elektrum.lv site.
  • If you plan to use export into InfluxDB, setup respective section settings. For export into CSV, it's not necessary.

Command line examples

  • java -jar elektrum-fetcher-xx.jar csv --period month -o output.csv --debug 2017-01

    Exports data summed by month into CSV file from 1 January 2017 till now

  • java -jar elektrum-fetcher-xx.jar csv --period day -o output.csv 2016 2017

    Exports data summed by day into CSV file from 1 January 2016 till 1 January 2017

  • java -jar elektrum-fetcher-xx.jar influxdb --period year 2016 2017

    Exports data into InfluxDB from 1 January 2016 till 1 January 2017

  • java -jar elektrum-fetcher-xx.jar influxdb --period day --recent

    Exports only recent data into InfluxDB. Note that --recent option works with influxdb only

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.