Coder Social home page Coder Social logo

smart-meter-service's Introduction

Smart Meter Service

(part of project Locutus, incubation stage)

Introduction

In The Netherlands most households have a 'slimme meter'. A smart meter that shows consumption of gas and electricity. Interfacing with that device requires a P1 USB smart meter cable. Search the web for the best deal, but it'll set you back around fifteen euros.

And you also need some software of course, but luckily the web is filled with solutions regarding this matter. So if you're looking for integration with your Smart Home Controller, it's probably there.

I've decided to do the heavy lifting myself because it's fun. Of course I look for solutions that fellow developers have committed and build upon that. Furthermore there's no pressure, because my energy company provides me with a monthly report about my energy consumption ;-)

Specification

Netbeheer Nederland is an association of network operators.

Here is a link to the specifications

The Code

At the moment the source code is not coherent. The idea is to have an HTTP endpoint available to get the readings and also sending them out via MQTT at a scheduled interval to allow for collection and database storage.

The entrypoint should be p1-meter.py.

Culprits

Having Python 2.x and 3.x on the same system might confuse the interpreter which library to use

$ ls -l $(which python pip python2 pip2 python3 pip3)

$ sudo apt-get install python3
$ sudo apt-get install python3-pip

$ sudo pip uninstall pyserial pyyaml
$ sudo pip3 install pyserial pyyaml

Credits

Converted the CRC16 code from JavaScript (https://github.com/jeroen13/p1-smart-meter-crc16), because pycrc16 used the wrong base table (xmodem) values. See also (https://pycrc.org/pycrc.html)

The lookup table variable is generated using pycrc =>

$ PYCRC="python pycrc.py --model crc-16 --algorithm table-driven --generate table"
$ echo "crc_arc_table = $(eval ${PYCRC} | tr "{}" "[]")"

Another source of inspiration is Nico Di Rocco's smeterd

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.