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
A quick reference guide to the most commonly used patterns and functions in PySpark SQL

Using PySpark we can process data from Hadoop HDFS, AWS S3, and many file systems. PySpark also is used to process real-time data using Streaming and

Sundar Ramamurthy 53 Dec 21, 2022
A python fast implementation of the famous SVD algorithm popularized by Simon Funk during Netflix Prize

⚡ funk-svd funk-svd is a Python 3 library implementing a fast version of the famous SVD algorithm popularized by Simon Funk during the Neflix Prize co

Geoffrey Bolmier 171 Dec 19, 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
BigDL: Distributed Deep Learning Framework for Apache Spark

BigDL: Distributed Deep Learning on Apache Spark What is BigDL? BigDL is a distributed deep learning library for Apache Spark; with BigDL, users can w

4.1k Jan 09, 2023
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
Reproducibility and Replicability of Web Measurement Studies

Reproducibility and Replicability of Web Measurement Studies This repository holds additional material to the paper "Reproducibility and Replicability

6 Dec 31, 2022
MCML is a toolkit for semi-supervised dimensionality reduction and quantitative analysis of Multi-Class, Multi-Label data

MCML is a toolkit for semi-supervised dimensionality reduction and quantitative analysis of Multi-Class, Multi-Label data. We demonstrate its use

Pachter Lab 26 Nov 29, 2022
GAM timeseries modeling with auto-changepoint detection. Inspired by Facebook Prophet and implemented in PyMC3

pm-prophet Pymc3-based universal time series prediction and decomposition library (inspired by Facebook Prophet). However, while Faceook prophet is a

Luca Giacomel 314 Dec 25, 2022
Distributed Computing for AI Made Simple

Project Home Blog Documents Paper Media Coverage Join Fiber users email list Uber Open Source 997 Dec 30, 2022

Evaluate on three different ML model for feature selection using Breast cancer data.

Anomaly-detection-Feature-Selection Evaluate on three different ML model for feature selection using Breast cancer data. ML models: SVM, KNN and MLP.

Tarek idrees 1 Mar 17, 2022
A high performance and generic framework for distributed DNN training

BytePS BytePS is a high performance and general distributed training framework. It supports TensorFlow, Keras, PyTorch, and MXNet, and can run on eith

Bytedance Inc. 3.3k Dec 28, 2022
We have a dataset of user performances. The project is to develop a machine learning model that will predict the salaries of baseball players.

Salary-Prediction-with-Machine-Learning 1. Business Problem Can a machine learning project be implemented to estimate the salaries of baseball players

Ayşe Nur Türkaslan 9 Oct 14, 2022
Decision Weights in Prospect Theory

Decision Weights in Prospect Theory It's clear that humans are irrational, but how irrational are they? After some research into behavourial economics

Cameron Davidson-Pilon 32 Nov 08, 2021
PLUR is a collection of source code datasets suitable for graph-based machine learning.

PLUR (Programming-Language Understanding and Repair) is a collection of source code datasets suitable for graph-based machine learning. We provide scripts for downloading, processing, and loading the

Google Research 76 Nov 25, 2022
QML: A Python Toolkit for Quantum Machine Learning

QML is a Python2/3-compatible toolkit for representation learning of properties of molecules and solids.

176 Dec 09, 2022
Data from "Datamodels: Predicting Predictions with Training Data"

Data from "Datamodels: Predicting Predictions with Training Data" Here we provid

Madry Lab 51 Dec 09, 2022
End to End toy example of MLOps

churn_model MLOps Toy Example End to End You might find below links useful Connect VSCode to Git MLFlow Port Heroku App Project Organization ├── LICEN

Ashish Tele 6 Feb 06, 2022
PROTEIN EXPRESSION ANALYSIS FOR DOWN SYNDROME

PROTEIN-EXPRESSION-ANALYSIS-FOR-DOWN-SYNDROME Down syndrome (DS) is a chromosomal disorder where organisms have an extra chromosome 21, sometimes know

1 Jan 20, 2022
Credit Card Fraud Detection, used the credit card fraud dataset from Kaggle

Credit Card Fraud Detection, used the credit card fraud dataset from Kaggle

Sean Zahller 1 Feb 04, 2022
ML Kaggle Titanic Problem using LogisticRegrission

-ML-Kaggle-Titanic-Problem-using-LogisticRegrission here you will find the solution for the titanic problem on kaggle with comments and step by step c

Mahmoud Nasser Abdulhamed 3 Oct 23, 2022