Dieses Projekt ermöglicht es den Smartmeter der EVN (Netz Niederösterreich) über die Kundenschnittstelle auszulesen.

Overview

SmartMeterEVN

Dieses Projekt ermöglicht es den Smartmeter der EVN (Netz Niederösterreich) über die Kundenschnittstelle auszulesen. Smart Meter werden von der Netz NÖ GmbH eingebaut, auf Basis der gesetzlichen Forderungen.

Getting Started

Voraussetzungen Hardware

Zähler Hersteller

  • Sagemcom Drehstromzähler T210-D

Die folgende Beschreibung bzw. das durchgeführte Projekt bezieht sich nur auf den angegebenen Zählertyp. Für weitere Zählertypen, welche vom Netzbetreiber eingebaut werden kann hier keine Garantie gegeben werde. Aufgrund der Angaben seitens dem Netzbetreiber, sollte die Anwendung möglich sein. Sollte es dazu Erfahrungen geben, können diese gerne an mich übermittelt werden.

Voraussetzungen Software

  • Raspbian
  • Python3
  • Libraries
    • gurux_dlms
    • beautifulsoup4
    • paho-mqtt
Produkt wird benötigt Amazon Aliexpress
Raspberry Pi 4 Ja https://amzn.to/3mpunAZ --
Raspberry Pi 4 Starter Set Ja https://amzn.to/3FoYX5q --
Raspberry Pi 4 Hutschienen Gehäuse Nein https://amzn.to/3mnCcqG --
USB-zu-MBUS-Slave-Modul Ja https://amzn.to/33BnnKH https://s.click.aliexpress.com/e/_9yVpxq
RJ-12 Kabel Ja https://amzn.to/3FdCMyO
Schaltschrank Steckdose Nein https://amzn.to/3Eh1Kfi

Verkabelung des Mbus Adapter

Die beiden mittleren Kabel des RJ-12 Kabel müssen in die MBus Klemmen eingeklemmt werden. Dann muss der USB an den Raspberry angeschlossen werden.

Installation der Libararies

sudo pip3 install gurux-dlms
sudo pip3 install beautifulsoup4
sudo pip3 install paho-mqtt
sudo pip3 install lxml

Für die Version EVNSmartmeterMQTT_V01.py wird eine weitere Libarariy benötogt.

sudo apt install python3-pycryptodome

Anpassen des Pythonprogrammes & Einstellungen

Öffne die Python Datei (EvnSmartmeterMQTT.py) mit einem beliebigen Editor. Die Betreffenden Zeilen sind 12, 15, 18, 21 und 24. In Zeile 12 muss der Schlüssel eingetragen werden zwischen den "dein EVN Schlüssel". Ein Beispiel ist im Programm angeführt. In Zeile 15 kann man die Ausgabe über MQTT auswählen wenn diese auf True ist dann muss man eine gültige MQTT IP Adresse in Zeile eingeben.Es reicht nur die IP Adresse zb: "192.168.1.99". Die Datei speichern. In Zeile 24 kann noch der Comport eingestellt werden.

Starten des Pythonprogrammes

Wenn das Programm am Desktop liegt kann es mit dem nächsten Befehl gestartet werden, sonst muss der Pfad geändert werden.

sudo python3 /home/pi/Desktop/EvnSmartmeterMQTT.py

Fehlermeldungen des Pythonprogrammes

Es sind bis jetzt nur zwei Fehlermeldungen implementiert!

  • Wenn keine Verbindung zum Broker aufgebaut werden kann dann wird der Fehler "Die Ip Adresse des Brokers ist falsch!" ausgegeben. Zur Fehlerbehebung muss die richtige IP Adresse angegeben werden.
  • Wenn der Fehler "Fehler beim Synchronisieren. Programm bitte ein weiteres Mal Starten." Kommt, muss man ca. drei Sekunden warten. Nach ein paar Versuchen sollte es problemlos starten.

MQTT Topics

Diese können ab der Zeile 144 bis 155 verändert werden. Standardmäßig sind folgende eingestellt.

Topic Kommentar Einheit
Smartmeter/WirkenergieP bezogene Energie Wh (keine kWh)
Smartmeter/WirkenergieN gelieferte Energie Wh (keine kWh)
Smartmeter/MomentanleistungP Momentanleistung Bezug W
Smartmeter/MomentanleistungN Momentanleistung Lieferung W
Smartmeter/Momentanleistung Momentanleistung Summe aus Bezug und Lieferung W
Smartmeter/SpannungL1 Spannung an L1 V
Smartmeter/SpannungL2 Spannung an L2 V
Smartmeter/SpannungL3 Spannung an L3 V
Smartmeter/StromL1 Strom an L1 A
Smartmeter/StromL2 Strom an L2 A
Smartmeter/StromL3 Strom an L3 A
Smartmeter/Leistungsfaktor Leistungsfaktor

Die Einheiten sind auf die Grundeinheit bezogen worden nicht wie im Folder des Netzbetreiber!

Bugs

  • Wenn eine PV-Anlage vorhanden ist und diese mehr produziert als unmittelbar verbraucht wird, erhählt man einen cos phi von ca. 60. Dieser hat physikalisch keine Bedeutung für mich. Im Normalfall ist dieser zwischen 0 - 1.

Versionsunterschied

Es sind 2 Python Programme beide machen grundsätzlich dasselbe nur die Synchronisierung ist unterschiedlich. Es funktionieren beide aber sie wurden noch nicht im Dauereinsatz getestet. Jenes Programm, welches sich als stabiler herausstellt wird auf Dauer bleiben und das andere entfernt.

EvnSmartmeterMQTT.py

  • Wenn es startet sollte es alle 5 Sekunden ohne Unterbrechung Werte senden.
  • Der längste Dauertest war 14 Tage und dann ist es abgestürzt. (Fehler muss nicht im Skript sein kann ein Absturz vom Broker oder Pi selber gewesen sein)

EVNSmartmeterMQTT_V01.py

  • Bei diesem Programm ist mir selber schon aufgefallen dass nicht alle 5 Sekunden Werte kommen aber dafür Syncronisiert es sich selber und stürtz nicht ab.
  • Testzeitraum war ca. 24 Stunden.

Roadmap (Updates)

Es soll eine Version mit einem ESP32 kommen, dieser liest die Daten ein und schickt sie auf einen bestehenden Server weiter. Um sich den Kabelweg zu sparen oder den Raspberry. Wenn ich es schaffe will ich ein eigenes Modul auf den Markt bringen, dass Plug and Play funktioniert und nur einen Bruchteil eines Raspberry´s kostet.

Hinweis

Alle Links zu Produkten sind Affiliate Links. Somit unterstützt ihr diese und weitere Projekte von mir.

License

This project is licensed under the GNU General Public License v3.0 License - see the LICENSE.md file for details

Comments
  • Invalid Start Bytes... waiting

    Invalid Start Bytes... waiting

    Hallo,

    erstmal Danke für dieses hervorragende Projekt. Ich habe versucht alles nachzubauen. Verbindung zum MQTT Broker funktioniert.

    Jedoch bekomme ich beim Ausführen immer wieder "Invalid Start Bytes... waiting".

    Ich verwende folgendes Kabel: https://www.amazon.de/gp/product/B08GWZTNM3/ref=ppx_yo_dt_b_asin_title_o06_s01?ie=UTF8&th=1

    @greenMikeEU Hättest du eventuell einen Tipp für mich?

    SG Michael

    opened by michaelhenningersrb 15
  •  Improve EVNSmartmeterMQTT_V01.py script

    Improve EVNSmartmeterMQTT_V01.py script

    Hi,

    while adapting your script for my needs I found these little glitches, which do not change the logic but might help others better understand what is going on.

    Meanwhile I did some more fixes to your script to improve readabilty.

    opened by pkolmann 1
  • Leistungsfaktor cos(phi)

    Leistungsfaktor cos(phi)

    Hat hier zufällig jemand eine PV, speist ins Netz ein und hat auch das Problem, dass der cos(phi) manchmal Werte jenseits des möglichen anzeigt? z.B. 0,1

    Bei mir passiert das immer, wenn ich z.B. L1 vom Netz beziehe und L2+L3 ins Netz einspeise. Da der cos(phi) ein signed int16 ist, kann er auch negative Werte und ich vermute, dass die EVN den cos(phi) der einzelnen Phasen misst und den Gesamten dann falsch berechnet. z.B. cos(phi) = ((+0.928) + (-0.928) + (-0.928) / 3 = -0.309

    opened by SebTrax 0
  • Automatischer MQTT Reconnect, Logging, Timestamp in den Nutzdaten

    Automatischer MQTT Reconnect, Logging, Timestamp in den Nutzdaten

    1. Sollte der MQTT Client die Verbindung zum MQTT Broker verlieren so erfolgt automatisch ein Reconnect (die Verbindung "überlebt" so auch z.B. einen MQTT Broker restart). Verbindungsabbrüche & -aufbauten werden per Callback ins Logfile geschrieben.

    2. Logging der Events (nicht der Messdaten) erfolgt per logging Modul in ein Logfile. Das Script sollte als Systemservice laufen. Kommt es dabei zu Exceptions so sind diese im Logfile sichtbar.

    3. Der im Smartmeter Datenstrom enthaltene Zeitstempel der Messung wird mit an den MQTT übertragen (bzw. per print ausgegeben). Format: "YYYY.MM.DD HH:MM:SS".

    opened by WolfMoestl 0
  • Stream buffer

    Stream buffer

    As I had the issues that the script couldn't synchronize itself if started while the smartmeter was sending data or lost sync (on my Raspberry Pi Zero W), thus I added a stream buffer. Reconnect if connection to MQTT broker is lost.

    opened by FischC 0
  • Added synchronization for EvnSmartmeterMQTT.py

    Added synchronization for EvnSmartmeterMQTT.py

    Since the "EvnSmartmeterMQTT.py" script couldn't synchronize itself if it started while the smartmeter is sending data, I wrote a fix so that it is no longer necessary to restart the script to ensure the function.

    I also added a hint for BeautifulSoup, since some people (including me), had problems with the lxml library.

    opened by sidious38 0
  • Stop Working after couple of Hours

    Stop Working after couple of Hours

    Hi is there any new relaise ? Because it run couple hour´s an than it stop. I run it around 4 month now . After a new start of the py it works again. On the Rasp4 i have only this Program running. Maybe you have a solution. THX Daniel

    opened by Leilei0106 6
  • lxml error: Couldn't find a tree builder with the features you requested

    lxml error: Couldn't find a tree builder with the features you requested

    thank you for your great work!

    it works if I replace
    soup = BeautifulSoup(xml, 'lxml') with soup = BeautifulSoup(xml, "html5lib")

    otherwise I get the following error: Couldn't find a tree builder with the features you requested: lxml (despite having lxml installed)

    opened by ratio91 0
Releases(EvnSmartmeter)
Owner
greenMike
greenMike
An open-source library of algorithms to analyse time series in GPU and CPU.

An open-source library of algorithms to analyse time series in GPU and CPU.

Shapelets 216 Dec 30, 2022
Turning images into '9-pan' palettes using KMeans clustering from sklearn.

img2palette Turning images into '9-pan' palettes using KMeans clustering from sklearn. Requirements We require: Pillow, for opening and processing ima

Samuel Vidovich 2 Jan 01, 2022
UpliftML: A Python Package for Scalable Uplift Modeling

UpliftML is a Python package for scalable unconstrained and constrained uplift modeling from experimental data. To accommodate working with big data, the package uses PySpark and H2O models as base l

Booking.com 254 Dec 31, 2022
Cohort Intelligence used to solve various mathematical functions

Cohort-Intelligence-for-Mathematical-Functions About Cohort Intelligence : Cohort Intelligence ( CI ) is an optimization technique. It attempts to mod

Aayush Khandekar 2 Oct 25, 2021
Automated Machine Learning Pipeline with Feature Engineering and Hyper-Parameters Tuning

The mljar-supervised is an Automated Machine Learning Python package that works with tabular data. I

MLJAR 2.4k Jan 02, 2023
Gaussian Process Optimization using GPy

End of maintenance for GPyOpt Dear GPyOpt community! We would like to acknowledge the obvious. The core team of GPyOpt has moved on, and over the past

Sheffield Machine Learning Software 847 Dec 19, 2022
Test symmetries with sklearn decision tree models

Test symmetries with sklearn decision tree models Setup Begin from an environment with a recent version of python 3. source setup.sh Leave the enviro

Rupert Tombs 2 Jul 19, 2022
Simplify stop motion animation with machine learning.

Simplify stop motion animation with machine learning.

Nick Bild 25 Sep 15, 2022
A collection of interactive machine-learning experiments: 🏋️models training + 🎨models demo

🤖 Interactive Machine Learning experiments: 🏋️models training + 🎨models demo

Oleksii Trekhleb 1.4k Jan 06, 2023
Apache (Py)Spark type annotations (stub files).

PySpark Stubs A collection of the Apache Spark stub files. These files were generated by stubgen and manually edited to include accurate type hints. T

Maciej 114 Nov 22, 2022
Machine Learning toolbox for Humans

Reproducible Experiment Platform (REP) REP is ipython-based environment for conducting data-driven research in a consistent and reproducible way. Main

Yandex 663 Dec 31, 2022
Built on python (Mathematical straight fit line coordinates error predictor machine learning foundational model)

Sum-Square_Error-Business-Analytical-Tool- Built on python (Mathematical straight fit line coordinates error predictor machine learning foundational m

om Podey 1 Dec 03, 2021
A linear equation solver using gaussian elimination. Implemented for fun and learning/teaching.

A linear equation solver using gaussian elimination. Implemented for fun and learning/teaching. The solver will solve equations of the type: A can be

Sanjeet N. Dasharath 3 Feb 15, 2022
cuML - RAPIDS Machine Learning Library

cuML - GPU Machine Learning Algorithms cuML is a suite of libraries that implement machine learning algorithms and mathematical primitives functions t

RAPIDS 3.1k Dec 28, 2022
Tutorial for Decision Threshold In Machine Learning.

Decision-Threshold-ML Tutorial for improve skills: 'Decision Threshold In Machine Learning' (from GeeksforGeeks) by Marcus Mariano For more informatio

0 Jan 20, 2022
STUMPY is a powerful and scalable Python library for computing a Matrix Profile, which can be used for a variety of time series data mining tasks

STUMPY STUMPY is a powerful and scalable library that efficiently computes something called the matrix profile, which can be used for a variety of tim

TD Ameritrade 2.5k Jan 06, 2023
Azure MLOps (v2) solution accelerators.

Azure MLOps (v2) solution accelerator Welcome to the MLOps (v2) solution accelerator repository! This project is intended to serve as the starting poi

Microsoft Azure 233 Jan 01, 2023
using Machine Learning Algorithm to classification AppleStore application

AppleStore-classification-with-Machine-learning-Algo- using Machine Learning Algorithm to classification AppleStore application. the first step : 1: p

Mohammed Hussien 2 May 02, 2022
Fit interpretable models. Explain blackbox machine learning.

InterpretML - Alpha Release In the beginning machines learned in darkness, and data scientists struggled in the void to explain them. Let there be lig

InterpretML 5.2k Jan 09, 2023
Python implementation of the rulefit algorithm

RuleFit Implementation of a rule based prediction algorithm based on the rulefit algorithm from Friedman and Popescu (PDF) The algorithm can be used f

Christoph Molnar 326 Jan 02, 2023