Configure a Tasmota WiFi Smart Meter

Lesedauer 8 Minuten

Hichi was not idle and developed a WiFi smart meter (reading head) with an ESP32 and Tasmota. Here I show you how to configure it. It doesn’t take much to read our electricity meter. Above all, it doesn’t need expensive equipment. I have already described how to do this here: Making electricity meters smart for 25 euros. The new WiFi smart meter from Hichi, with Tasmota, no longer needs an intermediate Raspberry Pi with ioBroker or a Volkszähler, it is an AIO smart meter. But why isn’t it just shipped „working“? Plug it in and it’s good? Well, because Tasmota (and also MQTT) first have to be adapted to the electricity meter. With the multitude of electricity meters hanging in households, this is a topic that is as necessary as it is confusing for the layman. The instructions are always written by people who know Tasmota in detail for people who know Tasmota in detail. Unfortunately, that doesn’t help us ordinary people one bit. But you have me. 😀 I have struggled through the crap and now I will explain to you in detail what you have to pay attention to in order to make it work for you.

Help for self-help

As always, this is not a manual that you can follow blindly, but it only offers help for self-help. Please refrain from telling me your meter type in the comments and from asking me for a ready-made script. Although … for an expense allowance of 40 Euro per hour … 😀 No, please no requests! Help yourselves.

Haftungsausschluss

ACHTUNG! NICHT NACHMACHEN!

  1. Dies ist keine Anleitung!
  2. Der Artikel dient der persönlichen Dokumentation!
  3. Dieser Artikel soll nicht die beiliegenden Anleitungen, Einbauhinweise oder Installationsanleitungen ersetzen!
  4. Dieser Artikel soll einen groben Überblick über die anfallenden Arbeiten ermöglichen.
  5. Der Artikel erhebt keinen Anspruch auf Vollständigkeit oder gar Korrektheit.
  6. Hier beschreibe ich, wie ich diese Arbeiten als Laie erledigt habe – nicht, wie man sie korrekt oder nach handwerklichen Standards, Vorschriften oder Gesetzen erledigt.
  7. Ich lehne jede Verantwortung, Haftung und Gewährleistung ab. Jeder muss selbst wissen, was er macht.
  8. Einige Arbeiten sind durch Fachfremde nicht zulässig, respektive gesetzwidrig und bedürfen teilweise mindestens der Abnahme durch einen ausgebildeten Berechtigten.
  9. Einige Handlungen und Arbeiten sind im öffentlichen Bereich (Straßenverkehr, Stromnetz, Luftraum, Internet, etc.) verboten oder verstoßen gegen Lizenzvereinbarungen, was straf- oder zivilrechtliche Konsequenzen nach sich ziehen kann.
  10. 230 Volt sind tödlich!
  11. Kein Backup? Kein Mitleid!
  12. Meine 3D-Modelle sind nur Machbarkeitsstudien, keine geprüften, funktionsfähigen Bauteile.
  13. Die beschriebenen Tätigkeiten sind in der Folge rein akademischer Natur.
  14. Bedenke, dass durch Deine Arbeiten Dritte an Leib und Leben gefährdet werden können und Du persönlich dafür haftest.

Mit dem Weiterlesen stimmst Du diesem Haftungsausschluss zu.

Shopping list

Not a purchase, but you need the …

  • Instructions for your electricity meter

The electricity supply company should have left them in the sub-distribution board during the last exchange. If not, you can find them on the internet. I will describe the search in more detail below.

Complicated?

No, not really. At first glance, it all looks worse than it is. Just follow the instructions step by step and you’ll be done in no time.

Configuring WLAN

First of all: You should have sufficiently strong WLAN reception in the room where your electricity meter is located. Please verify that the doors of your sub-distribution do not interfere with the WLAN reception. See also my article on optimal WLAN reception. Supply the reader with power using the power supply unit. A few seconds later you will see an open WLAN with the identification „tasmota_xxxxxx-xxx“ and connect to it. Now the mobile phone display says something like „Requires registration/authorisation“. Note:If this does not happen, we have to call up http://192.168.4.1 in the browser and enter the access data for our WLAN there. The reader reboots and can now be found in the WLAN of your smart home. Look in the router for its new IP and open it. Continue with the initial setup below.
Screenshot 2022 01 24 16 41 16 036 com.android.settings resized

We tap on the network and the following screen appears:

Screenshot 2022 01 24 16 41 31 943 com.android.htmlviewer resized

Here we type in the access data to our Smarthome WLAN. tap „Save“ and …

Screenshot 2022 01 24 16 41 44 837 com.android.htmlviewer resized

„Almost there…“

Screenshot 2022 01 24 16 41 49 659 com.android.htmlviewer resized

Success! The reading head is in your network and we can click on the IP address displayed!

Initial setup

The sensor must now be set up very roughly so that we can install it on the electricity meter in the sub-distribution.

Screenshot 2022 01 24 16 56 48

Attention! Only http and not https! In the main menu we click –> „Consoles

Screenshot 2022 01 24 17 19 26

–> „Edit Script“. The following screen is normal. On this screen we have to activate the sensor on the ESP.

Screenshot 2022 01 24 17 00 34

Delete this script and enter the following script:

>D
>B
=>sensor53 r
>M 1
+1,3,s,0,9600,house

Screenshot 2022 01 24 17 02 23

Just accept this for now. This script should run with the usual household electricity meters in Germany. Should. I explain it in more detail below, but here the sensor is activated and set to port 3. It communicates with the SML protocol at 9600 baud. –> „Save Once this has all worked, we go down to the basement with the phone in hand and stick the reader head on the electricity meter.

Aligning the WiFi smart meter

The reading head has a strong magnet inside, so it will be centred fairly precisely over the IR diodes on the electricity meter. On our electricity meter, it fits exactly into the (square) recess on the meter. Great. wifi-smartmeter

The old USB reading head used to sit there. The new one is not significantly bigger. I stood in front of the counter with my mobile phone and entered …

tasmota 001

–> „Console“ ..

tasmota 002

enter the following command:

sensor53 d1

Now you should actually see the data stream of the counter. But nothing happened!

tasmota 007

Yes, the lid with the sticker is not horizontal with the LEDs, but when the plug is facing down, the LEDs are in the „water“ Strange … wait a minute ..

wifi-smartmeter

Could it be that … I turned the read head 180 degrees and the data stream appeared on the mobile phone display!

Screenshot 2022 01 23 14 59 38

The thing is upside-down! With the corded reading head, the USB cable was still pointing downwards. It was probably hanging over the display for some users. I turned the cover so that the writing on the reading head could be read, because order is a must! 🙂 Great. So far, the head is running, quickly back to the computer! Note:If you have no success here, please consult the manual of your electricity meter and check which transmission protocol it uses.

Analysing the data stream

If you enter „sensor53 d1“ in the console of Tasmota, a jumble of data will now appear. Reminiscent of the matrix. 🙂

tasmota 010

Bad, isn’t it? 🙂 We look closer and see a pattern:

77 07 81 c7 82 03 ff
77 07 01 00 00 09 ff
77 07 01 00 01 08 00 ff
77 07 01 00 01 08 01 ff
77 07 01 00 01 08 02 ff
77 07 01 00 10 07 00 ff
77 07 81 c7 82 05 ff
77 01 0b 09 01 45 4d 48

All lines start with this again and again! But the data behind it changes. These are the meter readings.

Consult the instructions!

You must now look for the instructions for your meter on the net. I googled for the type number of our meter:

neuerzaehler

„eHZ-KW8e2a …“ that will have to do. Bingo! There is an EMH product page for the meter! Under Downloads, I found the instructions with the parameters for data transmission. We are interested in the setup counter values here, because there is only a unidirectional D0 interface at the front of the unit.

tasmota 008

Perfect!

Get an overview!

In a text editor, I copied the above-mentioned number blocks from the Tasmota console so that I knew which data package had which task. Then I looked at the manual and wrote it down:

77078181c78203ff Herstellerkennung
770701000009ff Device identification
77070100010800ff Counter, positive active energy, tariffless
77070100010801ff Totalizer, positive active energy, tariff 1
77070100010802ff Totalizer, positive active energy, tariff 2
77070100100700ff Actual positive active energy
77078181c78205ff Public key
77010b0901454d48 not documented?

All this is transmitted. Manufacturer ID, device ID, different tariffs? I don’t need all that. I want to see the meter reading and the current consumption!

Sift it out!

The following packages remain:

77070100010800ff 
77070100100700ff

The first is the meter reading, the second the current consumption.

Format correctly!

This must now be formatted sensibly. You can find more details on this topic on GitHub in the documentation. Here is my line for the counter reading:

1,77070100010800FF@1000,Zaehlerstand,kWh,total_in,2

Explanation

1 (first counter) 77070100010800FF (data packet involved) @1000 (I have no idea at all. All scripts use @1000 for the meter reading and @1 for the instantaneous consumption) Zaehlerstand (the name for MQTT and for the display in the webend) kWh (name for the definition of the read value) total_in (common name for the incoming current) 2 (transmit two decimal places of the value) Here comes the script, it will become clearer to you:

Script

For the meter EMH, eHZ Generation K I created this Tasmota script:

>D
>B
=>sensor53 r
>M 1
+1,3,s,0,9600,house 
1,77070100010800FF@1000,Zaehlerstand,kWh,total_in,2 
1,77070100100700FF@1,Aktueller Verbrauch,W,Power_curr,0
#

Explanation of the script

Definition as Smarmeter

>D (Script) >B (Boot) =>sensor53 r (Smartmeter, reset) M 1 (Meter, counter number, e.g. for additional feed)

Parameter meter 1

+1 (counter 1) 3 (GPIO number of the ESP in the Hichi read head, here must always be „3“!) s (type of interface, here: SML binary smart message coding) 0 (counter without pull-up) 9600 (baud rate) House (prefix for WebUI and MTTQ, maximum seven digits, freely assignable) A heat flow meter would be called „Waerme“ or „Heizung“, for example.

MQTT

Here you define the data as they should be displayed in ioBroker. The first packet that the electricity meter „house“ sends is the variable „total_in“, which is displayed in the unit „kWh“.

Almost done!

Now the script under —> Consoles —> Edit Script.

tasmota 004

Do not forget! Check be:

Script enable

Save and return to the main menu. Do the meter reading and the current consumption already appear there?

tasmota 009

Great, otherwise we now finally click on „Restart“.

Configure MQTT

We enter the IP and the access data of our host under –> Configuration –> MQTT Configuration. This is the SmartHome centre, for example your ioBroker. There you can now receive, save and process the data of the electricity meter with the Sonoff adapter (or the MQTT adapter). You have already configured the MQTT data in the script: Watt, kilowatt, sources, name. Then the data should come in automatically. This works like with the water meter: Integration in ioBroker (MQTT) – or as with the window contacts: Install Sonoff adapter, pp (Sonoff adapter).

And what about the water meter?

No problem either: make the water meter smart for 20 euros.

Further links

MSX-FAQ (Basics about the hardware of a reading head) MSX-FAQ (Smart Message Language protocol explained) BSI (Technical Guideline of the SML of the BSI)

Hinweise
  1. advertising[][]

2 Gedanken zu „Configure a Tasmota WiFi Smart Meter“

  1. Hallo, den beitrag finde ich interessant .. aber der Link zum „Hichi WiFi reading head“ auf amazon geht nicht mehr. Gibt es den noch irgendwo zum kaufen?

    viele Grüße

    Hermann

    Antworten
    • Wie kamst Du auf den englischen Artikel? Habe es im deutschen geändert, der hie folgt, wenn die automatische Link-Prüfung den Link meldet. 🙂

      Antworten

Schreibe einen Kommentar

Ich bin mit der Datenschutzerklärung und der Speicherung meiner eingegebenen Daten einverstanden.