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
Titanic Traveller Survivability Prediction

The aim of the mini project is predict whether or not a passenger survived based on attributes such as their age, sex, passenger class, where they embarked and more.

John Phillip 0 Jan 20, 2022
A chain of stores, 10 different stores and 50 different requests a 3-month demand forecast for its product.

Demand-Forecasting Business Problem A chain of stores, 10 different stores and 50 different requests a 3-month demand forecast for its product.

Ayşe Nur Türkaslan 3 Mar 06, 2022
PyPOTS - A Python Toolbox for Data Mining on Partially-Observed Time Series

A python toolbox/library for data mining on partially-observed time series, supporting tasks of forecasting/imputation/classification/clustering on incomplete multivariate time series with missing va

Wenjie Du 179 Dec 31, 2022
Reggy - Regressions with arbitrarily complex regularization terms

reggy Regressions with arbitrarily complex regularization terms. Currently suppo

Kim 1 Jan 20, 2022
XGBoost-Ray is a distributed backend for XGBoost, built on top of distributed computing framework Ray.

XGBoost-Ray is a distributed backend for XGBoost, built on top of distributed computing framework Ray.

92 Dec 14, 2022
Metric learning algorithms in Python

metric-learn: Metric Learning in Python metric-learn contains efficient Python implementations of several popular supervised and weakly-supervised met

1.3k Dec 28, 2022
Extreme Learning Machine implementation in Python

Python-ELM v0.3 --- ARCHIVED March 2021 --- This is an implementation of the Extreme Learning Machine [1][2] in Python, based on scikit-learn. From

David C. Lambert 511 Dec 20, 2022
GroundSeg Clustering Optimized Kdtree

ground seg and clustering based on kitti velodyne data, and a additional optimized kdtree for knn and radius nn search

2 Dec 02, 2021
Bayesian Modeling and Computation in Python

Bayesian Modeling and Computation in Python Open access and Code This repository contains the open access version of the text and the code examples in

Bayesian Modeling and Computation in Python 339 Jan 02, 2023
nn-Meter is a novel and efficient system to accurately predict the inference latency of DNN models on diverse edge devices

A DNN inference latency prediction toolkit for accurately modeling and predicting the latency on diverse edge devices.

Microsoft 241 Dec 26, 2022
Python ML pipeline that showcases mltrace functionality.

mltrace tutorial Date: October 2021 This tutorial builds a training and testing pipeline for a toy ML prediction problem: to predict whether a passeng

Log Labs 28 Nov 09, 2022
LILLIE: Information Extraction and Database Integration Using Linguistics and Learning-Based Algorithms

LILLIE: Information Extraction and Database Integration Using Linguistics and Learning-Based Algorithms Based on the work by Smith et al. (2021) Query

5 Aug 06, 2022
Tools for diffing and merging of Jupyter notebooks.

nbdime provides tools for diffing and merging of Jupyter Notebooks.

Project Jupyter 2.3k Jan 03, 2023
Lightweight Machine Learning Experiment Logging 📖

Simple logging of statistics, model checkpoints, plots and other objects for your Machine Learning Experiments (MLE). Furthermore, the MLELogger comes with smooth multi-seed result aggregation and co

Robert Lange 65 Dec 08, 2022
A library of sklearn compatible categorical variable encoders

Categorical Encoding Methods A set of scikit-learn-style transformers for encoding categorical variables into numeric by means of different techniques

2.1k Jan 07, 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
Turns your machine learning code into microservices with web API, interactive GUI, and more.

Turns your machine learning code into microservices with web API, interactive GUI, and more.

Machine Learning Tooling 2.8k Jan 02, 2023
A simple and lightweight genetic algorithm for optimization of any machine learning model

geneticml This package contains a simple and lightweight genetic algorithm for optimization of any machine learning model. Installation Use pip to ins

Allan Barcelos 8 Aug 10, 2022
NCVX (NonConVeX): A User-Friendly and Scalable Package for Nonconvex Optimization in Machine Learning.

NCVX (NonConVeX): A User-Friendly and Scalable Package for Nonconvex Optimization in Machine Learning.

SUN Group @ UMN 28 Aug 03, 2022