Giter VIP home page Giter VIP logo

enedigo's Introduction

Enedigo

Enedigo is a Golang "SDK" for the Enedis "API" It's just a wrapper for the Enedis customer portal.

The project follows the awesome work of :

Create Enedis Client

You can simply create a Client with username, password, and optionaly off-peak periods, if you are concerned with peak/offpeak subcription :

enedisClient, err := enedis.New(&enedis.Config{
    Login: "[email protected]",
    Password: "",
    OffpeakPeriods: []*enedis.OffPeakPeriod{
	    &enedis.OffPeakPeriod{From: "01:00", To: "07:00"},
	    &enedis.OffPeakPeriod{From: "12:30", To: "14:30"},
    }
})    


if err !=  nil {
    log.Fatalf("Fail to instantiate enedis : %s", err)
}

Get power measurements

To get power measurements from your linky, you have GetDataPerHour(from time.Time, to time.Time)

measures, err := enedisClient.GetDataPerHour(time.Now().AddDate(0, 0, -5), time.Now())
if err !=  nil {
    log.Fatalf("Fail to get measures from enedis : %s", err)
}

You'll get an []*enedis.PowerMeasure :

type  PowerMeasure  struct {
    Date time.Time
    Power float64
    IsOffpeak bool
}

Where :

  • Date is the time of the measure
  • Power is the amount of kWH of the measure
  • IsOffpeak will tell you whether or not the mesure is off-peak (If you have configured off-peak periods obviously)

Pushing to InfluxDB

I have created a little tool which mimic @beufanet python script in cmd/enedis2influx.go You just have to tune enedigo.yml file, and run it :

 $ ./enedis2influx --days 3
2019/02/17 17:38:16 Will get last 3 days from Enedis
2019/02/17 17:38:16 Creating enedis client....
2019/02/17 17:38:18 Getting data from enedis...
2019/02/17 17:38:20 Got measure of 2019-02-12T00:00:00+01:00 : 1.634 | HC:0 | HP:1
2019/02/17 17:38:20 Got measure of 2019-02-12T00:30:00+01:00 : 1.658 | HC:0 | HP:1
2019/02/17 17:38:20 Got measure of 2019-02-12T01:00:00+01:00 : 2.828 | HC:0 | HP:1
2019/02/17 17:38:20 Got measure of 2019-02-12T01:30:00+01:00 : 2.329 | HC:1 | HP:0
2019/02/17 17:38:20 Got measure of 2019-02-12T02:00:00+01:00 : 1.621 | HC:1 | HP:0
2019/02/17 17:38:20 Got measure of 2019-02-12T02:30:00+01:00 : 1.639 | HC:1 | HP:0
2019/02/17 17:38:20 Got measure of 2019-02-12T03:00:00+01:00 : 1.617 | HC:1 | HP:0
2019/02/17 17:38:20 Got measure of 2019-02-12T03:30:00+01:00 : 1.622 | HC:1 | HP:0
.....
2019/02/17 17:38:20 Pushing 240 points to InfluxDB...

enedigo's People

Contributors

bodji avatar

Stargazers

Christophe Baillon avatar  avatar Alexis Camilleri avatar Greg avatar Raphael Westphal avatar

Watchers

James Cloos avatar  avatar

Forkers

cbuctok

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.