Skip to content
Allowing for easier access to Luxembourgish smart meter data
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd Add MQTT specific startup flags Jan 21, 2019
share Rename NewConnection to NewMqttConnection Jan 9, 2019
smarty Add test to check the tokenization of a telegram Dec 18, 2018
.gitignore
CONTRIBUTING.md
Gopkg.lock
Gopkg.toml
LICENSE
README.md

README.md

Go Smarty Reader

The smart meter (called Smarty) deployed in Luxembourg allows the user to access a predefined set of data over the P1 port, a serial read-only interface, like its counterpart in the Netherlands. However the data stream in Luxembourg is encrypted using the AES128-GCM algorithm (see the specification), which raises the barrier for anyone interested in their own energy consumption. This is where Go Smarty Reader comes into play: handling the serial connection, decrypting the Smarty telegrams, optionally publishing the measurements via MQTT, and with Golang as basis it easily compiles for different platforms.

For additional information please visit our blog post at NEXXTLAB.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. If the explanations here are insufficient to your needs, please take a look at our blog post, where you will find additional details.

Prerequisites

Have Go installed and properly set up.

In order to connect Smarty to your machine you will need a P1 Cable (Dutch name: Slimme Meter Kabel P1), or build it yourself as seen on weigu.lu. Furthermore ask your electricity grid operator for your P1 decryption key.

Installing

Run the following command to get a local copy of the project

go get github.com/NEXXTLAB/go-smarty-reader

After this you need to get the project dependencies. Either you 'go get' all four of the third party libraries listed at the bottom, or you use dep with your console pointing to the project directory.

dep ensure

Running the examples

Please find all prepared examples inside of cmd/. In order to run any example you should take note of following command-line arguments:

  • key: your device specific decryption key
  • device: the interface on which the smart meter is connected to your target platform

Additional arguments and details may be found on the wiki page.

The key should be, as mentioned earlier, requested from your electricity grid operator. To set the device argument, you will need to find the correct interface. Here a quick How-To:

  • Windows: open your Device Manager, expand the Ports section, find the correct device and write down the COM port (eg. COM8)
  • Linux: open your terminal and run dmesg. Plug in your P1 cable and write down the device name (eg. /dev/ttyUSB2)

Navigate to the project main directory, then run:

go run ./cmd/OnlineDecryption/main.go -key yourKey -device yourInterface -stderrthreshold=INFO

Now you should see every 10 seconds the result of a decrypted Smarty telegram in your console. Please find the meaning of the OBIS codes in the specification

You may swap the OnlineDecryption part of the path to any other example found in the cmd/ folder. Not every example requires all arguments.

Running the tests

Currently there are only two simple tests, additions welcome! The first tests the decryption of a pre-recorded telegram, while the second takes a telegram and splits it into the initial value and cipher components.

go test github.com/NEXXTLAB/go-smarty-reader/smarty/

Build

In order to build the project simply run the go build command inside the project directory. The Go Cookbook offers a short overview on how to cross compile for a target platform different from yours. After you get your platform specific binary, you may run it in your console using the arguments found in the Running the examples section.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Sébastien Thill - Initial work - Netskeh

See also the list of contributors who participated in this project.

License

This project is licensed under the GPLv3 License - see the LICENSE file for details.

Acknowledgments

Third Party Libraries

Other Smarty Projects

Additional Resources

You can’t perform that action at this time.