Coder Social home page Coder Social logo

linkypy's Introduction

LinkyPy

PEP8 Docker

LinkyPy is intended to grab Linky (french dedicated energy meter) information through RaspberryPi USB port.

Default behaviour is to store data in an InfluxDB database, but it can be used as a standalone library as you can implement your own callback function.

Retrieved data is computed accordingly to the Enedis specifications (packets, checksums...) available here.

Have a look to my other Github project for an all-in-one RaspberryPi Kubernetes installer: rsaikali/linkypy_k3s. (this includes an easy to install LinkyPy, InfluxDB database and Grafana stack on your RaspberryPi).

Hardware needed

  1. A RaspberryPi, of course.

  2. A Linky energy meter with Teleinfo pins.

  1. A µTeleInfo dongle. It is plugged in the RaspberryPi through USB port and connected to the Teleinfo Linky pins. The USB dongle is available on Tindie.

Make your own plugin

This is a sample plugin class, here we will print Linky information:

class MyPlugin(object):

    def compute(self, data, timestamp):
        print(timestamp)
        for key, value in data.items():
            print(f"{key} = {value}")

Then add your plugin declaration in the configuration file /etc/linkypy/linkypy.yaml:

linkypy:

    (...)

    callbacks:
        - linkypy.callbacks.influxdb_plugin.InfluxDBPlugin
        - your_package.MyPlugin

    (...)

You can now launch linkypy:

linkypy run
(...)
2020-11-21 12:45:11,823
ADCO     = 012345678901
OPTARIF  = HC..
ISOUSC   = 45
HCHC     = 005602128
HCHP     = 007923975
PTEC     = HP..
IINST    = 001
IMAX     = 090
PAPP     = 00460
HHPHC    = A
MOTDETAT = 000000
(...)

Detailed description of fields is available in the Enedis documentation.

Default InfluxDB behaviour

Default callback will store data into an InfluxDB database.

Once installed, simply run the following command to launch the daemon:

linkypy run

Connection information is configured through environment variables:

export INFLUXDB_SERVICE_HOST=influxdb.local
export INFLUXDB_SERVICE_PORT=8086
export INFLUXDB_DATABASE=linky
export INFLUXDB_USERNAME=admin
export INFLUXDB_PASSWORD=password

Only valuable information is stored:

  • HCHP: High price hours (heures pleines) values (in kWh).
  • HCHC: Low price hours (heures creuses) values (in kWh).
  • PAPP: Instant power delivered (in VA, but I personnaly assume it's watts, yes, even if it's not true that's enough for my understanding).

Price calculation and estimation for current month will also be stored.

Prices are now extracted from energy providers websites (PDF).

In my scenario, I use Grafana next to InfluxDB to visualize stored data. Have a look to my other Github project for an all-in-one RaspberryPi Kubernetes installer: rsaikali/linkypy_k3s. This includes LinkyPy, InfluxDB database and Grafana:

Docker build

Current project is available as a Docker image in rsaikali/linkypy

To build your own linux/arm/v7 docker image from another architecture, you'll need a special (experimental) Docker multi-architecture build functionality detailled here: Building Multi-Arch Images for Arm and x86 with Docker Desktop

You'll basically need to activate experimental features and use buildx.

export DOCKER_CLI_EXPERIMENTAL=enabled
docker buildx create --use --name build --node build --driver-opt network=host
docker buildx build --platform linux/arm/v7 -t <your-repo>/linkypy --push .

Credits

Thank you to Charles (https://github.com/hallard) for the µTeleInfo USB dongle and documentation.

linkypy's People

Contributors

rsaikali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.