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
The Ultimate FREE Machine Learning Study Plan

The Ultimate FREE Machine Learning Study Plan

Patrick Loeber (Python Engineer) 2.5k Jan 05, 2023
Examples and code for the Practical Machine Learning workshop series

Practical Machine Learning Workshop Series Practical Machine Learning for Quantitative Finance Post conference workshop at the WBS Spring Conference D

CompatibL 21 Jun 25, 2022
Automatic extraction of relevant features from time series:

tsfresh This repository contains the TSFRESH python package. The abbreviation stands for "Time Series Feature extraction based on scalable hypothesis

Blue Yonder GmbH 7k Jan 06, 2023
MLflow App Using React, Hooks, RabbitMQ, FastAPI Server, Celery, Microservices

Katana ML Skipper This is a simple and flexible ML workflow engine. It helps to orchestrate events across a set of microservices and create executable

Tom Xu 8 Nov 17, 2022
Predicting job salaries from ads - a Kaggle competition

Predicting job salaries from ads - a Kaggle competition

Zygmunt Zając 57 Oct 23, 2020
This repository has datasets containing information of Uber pickups in NYC from April 2014 to September 2014 and January to June 2015. data Analysis , virtualization and some insights are gathered here

uber-pickups-analysis Data Source: https://www.kaggle.com/fivethirtyeight/uber-pickups-in-new-york-city Information about data set The dataset contain

B DEVA DEEKSHITH 1 Nov 03, 2021
An open source framework that provides a simple, universal API for building distributed applications. Ray is packaged with RLlib, a scalable reinforcement learning library, and Tune, a scalable hyperparameter tuning library.

Ray provides a simple, universal API for building distributed applications. Ray is packaged with the following libraries for accelerating machine lear

23.3k Dec 31, 2022
Official code for HH-VAEM

HH-VAEM This repository contains the official Pytorch implementation of the Hierarchical Hamiltonian VAE for Mixed-type Data (HH-VAEM) model and the s

Ignacio Peis 8 Nov 30, 2022
A naive Bayes model for cancer classification using a set of documents

Naivebayes text classifcation model for cancer and noncancer documents Author: Alex King Purpose Requirements/files included How to use 1. Purpose The

Alex W King 1 Nov 24, 2021
A collection of Machine Learning Models To Web Api which are built on open source technologies/frameworks like Django, Flask.

Author Ibrahim Koné From-Machine-Learning-Models-To-WebAPI A collection of Machine Learning Models To Web Api which are built on open source technolog

Ibrahim Koné 2 May 24, 2022
Implementation of K-Nearest Neighbors Algorithm Using PySpark

KNN With Spark Implementation of KNN using PySpark. The KNN was used on two separate datasets (https://archive.ics.uci.edu/ml/datasets/iris and https:

Zachary Petroff 4 Dec 30, 2022
ML-powered Loan-Marketer Customer Filtering Engine

In Loan-Marketing business employees are required to call the user's to buy loans of several fields and in several magnitudes. If employees are calling everybody in the network it is also very length

Sagnik Roy 13 Jul 02, 2022
A unified framework for machine learning with time series

Welcome to sktime A unified framework for machine learning with time series We provide specialized time series algorithms and scikit-learn compatible

The Alan Turing Institute 6k Jan 06, 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
💀mummify: a version control tool for machine learning

mummify is a version control tool for machine learning. It's simple, fast, and designed for model prototyping.

Max Humber 43 Jul 09, 2022
Python Automated Machine Learning library for tabular data.

Simple but powerful Automated Machine Learning library for tabular data. It uses efficient in-memory SAP HANA algorithms to automate routine Data Scie

Daniel Khromov 47 Dec 17, 2022
Interactive Parallel Computing in Python

Interactive Parallel Computing with IPython ipyparallel is the new home of IPython.parallel. ipyparallel is a Python package and collection of CLI scr

IPython 2.3k Dec 30, 2022
A Python package for time series classification

pyts: a Python package for time series classification pyts is a Python package for time series classification. It aims to make time series classificat

Johann Faouzi 1.4k Jan 01, 2023
Module is created to build a spam filter using Python and the multinomial Naive Bayes algorithm.

Naive-Bayes Spam Classificator Module is created to build a spam filter using Python and the multinomial Naive Bayes algorithm. Main goal is to code a

Viktoria Maksymiuk 1 Jun 27, 2022
#30DaysOfStreamlit is a 30-day social challenge for you to build and deploy Streamlit apps.

30 Days Of Streamlit 🎈 This is the official repo of #30DaysOfStreamlit — a 30-day social challenge for you to learn, build and deploy Streamlit apps.

Streamlit 53 Jan 02, 2023