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
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
Multiple Linear Regression using the LinearRegression class from sklearn.linear_model library

Multiple-Linear-Regression-master - A python program to implement Multiple Linear Regression using the LinearRegression class from sklearn.linear model library

Kushal Shingote 1 Feb 06, 2022
Combines Bayesian analyses from many datasets.

PosteriorStacker Combines Bayesian analyses from many datasets. Introduction Method Tutorial Output plot and files Introduction Fitting a model to a d

Johannes Buchner 19 Feb 13, 2022
Stacked Generalization (Ensemble Learning)

Stacking (stacked generalization) Overview ikki407/stacking - Simple and useful stacking library, written in Python. User can use models of scikit-lea

Ikki Tanaka 192 Dec 23, 2022
A simple guide to MLOps through ZenML and its various integrations.

ZenBytes Join our Slack Community and become part of the ZenML family Give the main ZenML repo a GitHub star to show your love ZenBytes is a series of

ZenML 127 Dec 27, 2022
The project's goal is to show a real world application of image segmentation using k means algorithm

The project's goal is to show a real world application of image segmentation using k means algorithm

2 Jan 22, 2022
Data Version Control or DVC is an open-source tool for data science and machine learning projects

Continuous Machine Learning project integration with DVC Data Version Control or DVC is an open-source tool for data science and machine learning proj

Azaria Gebremichael 2 Jul 29, 2021
Breast-Cancer-Classification - Using SKLearn breast cancer dataset which contains 569 examples and 32 features classifying has been made with 6 different algorithms

Breast-Cancer-Classification - Using SKLearn breast cancer dataset which contains 569 examples and 32 features classifying has been made with 6 different algorithms

Mert Sezer Ardal 1 Jan 31, 2022
Apache Liminal is an end-to-end platform for data engineers & scientists, allowing them to build, train and deploy machine learning models in a robust and agile way

Apache Liminals goal is to operationalise the machine learning process, allowing data scientists to quickly transition from a successful experiment to an automated pipeline of model training, validat

The Apache Software Foundation 121 Dec 28, 2022
A python library for Bayesian time series modeling

PyDLM Welcome to pydlm, a flexible time series modeling library for python. This library is based on the Bayesian dynamic linear model (Harrison and W

Sam 438 Dec 17, 2022
A collection of neat and practical data science and machine learning projects

Data Science A collection of neat and practical data science and machine learning projects Explore the docs » Report Bug · Request Feature Table of Co

Will Fong 2 Dec 10, 2021
A machine learning toolkit dedicated to time-series data

tslearn The machine learning toolkit for time series analysis in Python Section Description Installation Installing the dependencies and tslearn Getti

2.3k Dec 29, 2022
A Time Series Library for Apache Spark

Flint: A Time Series Library for Apache Spark The ability to analyze time series data at scale is critical for the success of finance and IoT applicat

Two Sigma 970 Jan 04, 2023
DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning.

DirectML is a high-performance, hardware-accelerated DirectX 12 library for machine learning. DirectML provides GPU acceleration for common machine learning tasks across a broad range of supported ha

Microsoft 1.1k Jan 04, 2023
CobraML: Completely Customizable A python ML library designed to give the end user full control

CobraML: Completely Customizable What is it? CobraML is a python library built on both numpy and numba. Unlike other ML libraries CobraML gives the us

Sriram Govindan 14 Dec 19, 2021
Causal Inference and Machine Learning in Practice with EconML and CausalML: Industrial Use Cases at Microsoft, TripAdvisor, Uber

Causal Inference and Machine Learning in Practice with EconML and CausalML: Industrial Use Cases at Microsoft, TripAdvisor, Uber

EconML/CausalML KDD 2021 Tutorial 124 Dec 28, 2022
Adaptive: parallel active learning of mathematical functions

adaptive Adaptive: parallel active learning of mathematical functions. adaptive is an open-source Python library designed to make adaptive parallel fu

741 Dec 27, 2022
Kalman filter library

The kalman filter framework described here is an incredibly powerful tool for any optimization problem, but particularly for visual odometry, sensor fusion localization or SLAM.

comma.ai 276 Jan 01, 2023
Penguins species predictor app is used to classify penguins species created using python's scikit-learn, fastapi, numpy and joblib packages.

Penguins Classification App Penguins species predictor app is used to classify penguins species using their island, sex, bill length (mm), bill depth

Siva Prakash 3 Apr 05, 2022
dirty_cat is a Python module for machine-learning on dirty categorical variables.

dirty_cat dirty_cat is a Python module for machine-learning on dirty categorical variables.

637 Dec 29, 2022