SML meter scripts for Tasmota

TinyC family · read the electricity meter, chart it, hand it onTinyC-Familie · Stromzähler auslesen, aufzeichnen, weitergeben

OverviewÜberblick

Do you have a newer electricity meter with an optical interface (SML) at home, and would you like to see its values, such as power and consumption (and feed-in), as charts on a nice web page, and record them? Then you are in the right place. With a suitable meter reading head that has a small processor (ESP) built in, and the right software, you can do all of this for little money. You are not tied to any cloud or manufacturer. If you know your way around, you are welcome to adapt the software as you like. But for most people my software already offers every option they need.

On my two GitHub pages (called repositories) I offer ready-made Tasmota firmware images and the matching programs (or scripts) for the ESP32 (and ESP8266). If you have already bought a Tasmota reading head, it contains an ESP32 or an ESP8266 (ESP01s), and a Tasmota version is already installed on it. To run my programs or scripts, however, you must put my firmware on the reading head. You can do this over Wi-Fi (OTA) or with a USB cable on your PC. I recommend OTA.

This page describes my programs for the reading head. They are written in the programming language TinyC, which is why I call them TinyC programs everywhere here. I made them only recently; before, I did everything with Tasmota scripts. TinyC can do much more, so this page only covers the TinyC programs. Basically, I turned all my separate scripts into a few TinyC programs. Before, if you wanted Modbus, you had to take a separate script. Now it is simply an option.

The TinyC programs need an ESP32. For the ESP8266 there are only the scripts. Examples of suitable reading heads are on my blog.

Once my image runs on your reading head, you choose and load one of my programs directly in Tasmota on the ESP / reading head. You do not have to upload or paste anything by hand. When the program is running, you select your electricity, water or gas meter. All very easy. All data is stored on the device itself, never in a cloud.

While the program is running, you see these new buttons in the Tasmota main menu:

⚙️ SMLAll program settings. With a PV battery emulator the button is called ⚙️ SML /🔋.
☁️ MarstekOnly in the CT002 emulator programs: register the CT in your Marstek account.
💻 TinyCOpens the TinyC Console: load, start and stop programs.

The charts have their own page. You open it with the 📈 link below the values on the main page. Or you switch on the option Main Charts, and they appear directly on the main page, like before with the scripts.

Wenn du zuhause einen neueren Stromzähler mit optischer Schnittstelle hast (SML) und gerne die Werte wie Leistung und Verbrauch (und Einspeisung) grafisch auf einer schönen Webseite dargestellt (und aufgezeichnet) haben willst, dann bist du hier genau richtig. Mit einem passenden Stromzähler-Lesekopf mit eingebautem Prozessor (ESP) und der richtigen Software kannst du das alles für wenig Geld umsetzen. Du bist an keine Cloud und keinen Hersteller gebunden. Wenn du dich auskennst, kannst du die Software auch gerne nach Belieben anpassen. Aber für die meisten bietet meine Software alle Optionen an.

Auf meinen zwei GitHub-Seiten (nennt sich Repository) biete ich fertige Tasmota-Firmware-Images und die passenden Programme (oder Scripte) für den ESP32 (und ESP8266) an. Falls du dir bereits einen Tasmota-Lesekopf gekauft hast, dann sitzt in diesem ein ESP32 oder ESP8266 (ESP01s). Auf diesem ist dann bereits eine Tasmota-Version vorinstalliert. Damit du aber meine Programme/Scripte ausführen kannst, brauchst du zwingend meine Firmware auf dem Lesekopf. Das kann entweder über WLAN (OTA) oder über USB-Kabel am PC gemacht werden. Ich empfehle die Variante über OTA.

Auf dieser Seite geht es um die Beschreibung meiner Programme für den Lesekopf. Die Programme sind in der Programmiersprache TinyC geschrieben, deshalb nenne ich sie hier überall TinyC-Programme. Diese habe ich erst vor kurzem erstellt, vorher hatte ich alles mit Tasmota-Scripten gemacht. TinyC bietet nun viel mehr, deshalb gehe ich hier auch nur noch auf die TinyC-Programme ein. Im Prinzip habe ich alle meine einzelnen Scripte in ein paar TinyC-Programme umgewandelt. Wollte man vorher Modbus haben, musste man ein separates Script nehmen. Das ist nun als Option mit eingeflossen.

Die TinyC-Programme brauchen einen ESP32. Für den ESP8266 gibt es nur die Scripte. Beispiele für passende Leseköpfe findest du auf meinem Blog.

Wenn erstmal mein Image auf deinem Lesekopf läuft, kannst du ganz einfach eins meiner Programme direkt auf dem ESP/Lesekopf in Tasmota auswählen und laden. Du musst nichts manuell hochladen oder einfügen. Wenn das Programm dann läuft, wählst du deinen Strom-, Wasser- oder Gaszähler aus. Alles ganz bequem. Alle Daten werden direkt auf dem Gerät gespeichert, nirgends in der Cloud.

Wenn das Programm läuft, siehst du im Tasmota-Hauptmenü folgende neue Buttons:

⚙️ SMLAlle Programm-Einstellungen. Beim PV-Akku-Emulator heißt der Button ⚙️ SML /🔋.
☁️ MarstekNur bei den CT002-Emulator-Programmen: das CT in deinem Marstek-Konto anmelden.
💻 TinyCÖffnet die TinyC Console: Programme laden, starten und stoppen.

Die Diagramme haben eine eigene Seite. Du öffnest sie über den Link 📈 unter den Werten auf der Hauptseite. Oder du schaltest die Option Charts Hauptseite ein, dann erscheinen sie direkt auf der Hauptseite (wie früher bei den Scripten).

ProgramsProgramme

Choose one program and load it into slot 0. The programs are ready to use, you do not need to compile anything. Modbus is available in all of them.

SML (no Charts)Reads the meter. The smallest program.
SML ChartAlso shows charts and daily, monthly and yearly values. Feed-in can be switched on.
SML + Marstek CT002Also pretends to be a Marstek CT002/CT003 meter for Marstek batteries (help).
SML Chart + Marstek CT002Charts and CT002 emulator.
SML + EcoTracker / ShellyAlso pretends to be an EcoTracker or Shelly Pro 3EM for many other batteries (help).
SML Chart + EcoTracker / ShellyCharts and EcoTracker / Shelly emulator.

Install

  1. In Tasmota open Tools → TinyC Console.
  2. In the Repository box, choose SmartMeter/PV/Emulator (ottelo) in the upper list. On my images it is already selected.
  3. Choose the program in the list below, leave Slot 0 and press Download & Load.
  4. In the slot row, switch on A (start automatically after a reboot, turns green). If the program is not running yet, start it with ▶.

Updates: the slot row shows the program's version (date and time) behind its name. When the repository has a newer one, a button 🔄 with the new date appears next to it. Press it, and the new version is loaded into the same slot. Your settings and data stay. This needs an image from 18.10.2026 or newer.

If you want to change a program yourself: the source code (.tc) is in the tinyc folder. You can compile it in the TinyC IDE, or all programs at once with bytecode/build.html.

When it starts, every program sets Tasmota to WifiConfig 5: if the device does not find its Wi-Fi (router restart, power cut), it waits for it instead of restarting again and again.

The emulator programs only work in slot 0. Tasmota sends their web addresses to slot 0 only.

Meter, pins, language and most other settings are kept in a shared settings file. When you change to another program, they are still there.

Such dir ein Programm aus und lade es in Slot 0. Die Programme sind fertig, du musst nichts kompilieren. Modbus ist in allen dabei.

SML (ohne Charts)Liest den Zähler aus. Das kleinste Programm.
SML ChartZeigt zusätzlich Diagramme und Tages-, Monats- und Jahreswerte. Einspeisung lässt sich dazuschalten.
SML + Marstek CT002Gibt sich zusätzlich als Marstek-Zähler CT002/CT003 aus, für Marstek-Akkus (Hilfe).
SML Chart + Marstek CT002Diagramme und CT002-Emulator.
SML + EcoTracker / ShellyGibt sich zusätzlich als EcoTracker oder Shelly Pro 3EM aus, für viele andere Akkus (Hilfe).
SML Chart + EcoTracker / ShellyDiagramme und EcoTracker-/Shelly-Emulator.

Installation

  1. In Tasmota Tools → TinyC Console öffnen.
  2. Im Kasten Repository in der oberen Liste SmartMeter/PV/Emulator (ottelo) auswählen. Bei meinen Images ist das schon ausgewählt.
  3. In der Liste darunter das Programm auswählen, Slot 0 stehen lassen und Download & Load drücken.
  4. In der Zeile des Slots A einschalten (nach einem Neustart automatisch starten, wird grün). Läuft das Programm noch nicht, mit ▶ starten.

Updates: In der Zeile des Slots steht hinter dem Namen die Version des Programms (Datum und Uhrzeit). Gibt es im Repository eine neuere, erscheint daneben ein Knopf 🔄 mit dem neuen Datum. Drückst du ihn, wird die neue Version in denselben Slot geladen. Deine Einstellungen und Daten bleiben erhalten. Dafür brauchst du ein Image vom 18.10.2026 oder neuer.

Wenn du ein Programm selbst ändern willst: Der Quellcode (.tc) liegt im Ordner tinyc. Kompilieren kannst du ihn in der TinyC-IDE oder alle Programme auf einmal mit bytecode/build.html.

Beim Start stellt jedes Programm Tasmota auf WifiConfig 5: Findet das Gerät sein WLAN nicht (Router-Neustart, Stromausfall), wartet es darauf, statt immer wieder neu zu starten.

Die Emulator-Programme funktionieren nur in Slot 0. Tasmota leitet ihre Webadressen nur an Slot 0 weiter.

Zähler, Pins, Sprache und die meisten anderen Einstellungen stehen in einer gemeinsamen Einstellungsdatei. Wechselst du das Programm, sind sie noch da.

Power savingEnergiesparmodus

Normally Tasmota lets the chip and the Wi-Fi rest for a moment between its tasks (Sleep 50). That saves a little power, but the device answers more slowly. With a weak Wi-Fi signal, a page or a reply can take several seconds.

OFF (default)Sleep 50. Uses less power.
ONSleep 0. The device never rests. Web page, charts and the answers to the battery come much faster.

What it made on an ESP32-C3 with weak Wi-Fi (−87 dBm), 25 page loads each:

Sleep 50Sleep 0
typical0.4 s0.14 s
slowest3.3 s0.28 s
slower than 1 second6 of 25none

The price: the device uses about 0.25 W more, around 2 kWh a year. That is well under one euro.

Which one for you

You use a battery emulatorON. The battery asks every second. A late answer makes the regulation worse.
Your Wi-Fi is weakON. Below about −80 dBm the power saving makes everything very slow.
You only read the meterOFF is fine. A few seconds of delay do not matter here.

Better Wi-Fi helps more than this switch. A repeater or access point near the meter makes the device faster and lets it save power.

Switching it off again sets Sleep 50, Tasmota's default. If you used a different value, set it again with the Sleep command. The box only acts when you change it here. A Sleep value set in the console is not touched at start-up.

Normalerweise lässt Tasmota den Chip und das WLAN zwischen seinen Aufgaben kurz ruhen (Sleep 50). Das spart etwas Strom, aber das Gerät antwortet langsamer. Bei schwachem WLAN kann eine Seite oder eine Antwort mehrere Sekunden dauern.

AUS (Standard)Sleep 50. Braucht weniger Strom.
EINSleep 0. Das Gerät ruht nie. Webseite, Diagramme und die Antworten an den Akku kommen deutlich schneller.

So sah das an einem ESP32-C3 mit schwachem WLAN aus (−87 dBm), je 25 Seitenaufrufe:

Sleep 50Sleep 0
typisch0,4 s0,14 s
am langsamsten3,3 s0,28 s
langsamer als 1 Sekunde6 von 25keiner

Der Preis: Das Gerät braucht etwa 0,25 W mehr, rund 2 kWh im Jahr. Das ist deutlich unter einem Euro.

Was passt für dich

Du nutzt einen Akku-EmulatorEIN. Der Akku fragt jede Sekunde. Eine späte Antwort verschlechtert die Regelung.
Dein WLAN ist schwachEIN. Unter etwa −80 dBm macht der Sparmodus alles sehr langsam.
Du liest nur den Zähler ausAUS reicht. Ein paar Sekunden Verzögerung stören hier nicht.

Besseres WLAN hilft mehr als dieser Schalter. Ein Repeater oder Access Point in der Nähe des Zählers macht das Gerät schneller und lässt es trotzdem Strom sparen.

Schaltest du ihn wieder aus, wird Sleep 50 gesetzt, der Tasmota-Standard. Hattest du einen anderen Wert, setze ihn mit dem Befehl Sleep neu. Das Häkchen wirkt nur, wenn du es hier änderst. Ein in der Konsole gesetzter Sleep-Wert wird beim Start nicht verändert.

Time zoneZeitzone

Out of the box Tasmota runs on +1 hour without summer time, so from March to October the clock is an hour behind - and with it the change of day of the charts. Tick Central European time (summer time) and the program sets Tasmota once to Germany, Austria, Switzerland and their neighbours, with summer time switching by itself:

Backlog0 Timezone 99; TimeStd 0,0,10,1,3,60; TimeDst 0,0,3,1,2,120

The setting is stored in Tasmota itself, so it stays when you change the program. Unticking sets Tasmota's default again (+1 hour, no summer time). For another country, get the command from tasmotatimezone.com and enter it in the Tasmota console; leave the box unticked then.

Ab Werk läuft Tasmota auf +1 Stunde ohne Sommerzeit. Von März bis Oktober geht die Uhr also eine Stunde nach, und mit ihr der Tageswechsel der Diagramme. Setz den Haken bei Zeitzone Mitteleuropa (Sommerzeit), dann stellt das Programm Tasmota einmal auf Deutschland, Österreich, Schweiz und Nachbarn ein, mit automatischer Sommerzeit:

Backlog0 Timezone 99; TimeStd 0,0,10,1,3,60; TimeDst 0,0,3,1,2,120

Die Einstellung steht in Tasmota selbst und bleibt auch nach einem Programmwechsel. Nimmst du den Haken weg, gilt wieder der Tasmota-Standard (+1 Stunde, keine Sommerzeit). Für ein anderes Land holst du dir den Befehl auf tasmotatimezone.com und gibst ihn in der Tasmota-Konsole ein. Den Haken lässt du dann weg.

MeterZähler

Descriptor

The descriptor is a small text file that tells Tasmota how to read your meter: speed, protocol and which value is which. It is stored on the device as /sml_meter.def. You normally just pick your meter from the list.

Meter activeSwitches the meter reading on or off. Off means no values at all.
3 phasesOff by default. Only switch it on if your meter really sends the power of each phase and the three phases are in the descriptor. Then the main page shows an L1 / L2 / L3 row, and the emulators pass on the real phase values instead of putting everything on L1. If the values do not fit, the program switches it off again and tells you.
MeterList of ready-made descriptors for many meters. Choose yours, and the file is downloaded and the reading restarts. Keiner/Selbstdefinierter Zähler (none / own meter) downloads nothing and keeps your current file, for a descriptor you wrote yourself. RX, TX and the filter are still filled in where the file contains the placeholders %0rxpin%, %0txpin% and %0smlf%.
DescriptorThe link opens the file in the editor, if you want to change something. Your meter is not in the list? Start with a similar one.

The first three values always have the same meaning, and everything else relies on that: 1 power [W], 2 energy bought [kWh], 3 energy fed in [kWh].

Der Descriptor ist eine kleine Textdatei. Sie sagt Tasmota, wie dein Zähler gelesen wird: Geschwindigkeit, Protokoll und welcher Wert welcher ist. Sie liegt auf dem Gerät als /sml_meter.def. Normalerweise wählst du deinen Zähler einfach aus der Liste.

Zähler aktivSchaltet das Auslesen ein oder aus. Aus heißt: gar keine Werte.
3 PhasenStandardmäßig aus. Nur einschalten, wenn dein Zähler die Leistung jeder Phase wirklich sendet und die drei Phasen im Descriptor stehen. Dann zeigt die Hauptseite eine Zeile L1 / L2 / L3, und die Emulatoren geben die echten Phasenwerte weiter, statt alles auf L1 zu legen. Passen die Werte nicht zusammen, schaltet das Programm die Option wieder aus und sagt dir Bescheid.
ZählerListe mit fertigen Descriptoren für viele Zähler. Wählst du deinen aus, wird die Datei heruntergeladen und das Auslesen neu gestartet. Keiner/Selbstdefinierter Zähler lädt nichts herunter und behält deine jetzige Datei, für einen selbst geschriebenen Descriptor. RX, TX und Filter werden trotzdem eingetragen, wo in der Datei die Platzhalter %0rxpin%, %0txpin% und %0smlf% stehen.
DescriptorDer Link öffnet die Datei im Editor, falls du etwas ändern willst. Dein Zähler fehlt in der Liste? Fang mit einem ähnlichen an.

Die ersten drei Werte haben immer dieselbe Bedeutung, darauf baut alles auf: 1 Leistung [W], 2 Bezug [kWh], 3 Einspeisung [kWh].

Pins

RX is the pin where the data wire of the reading head is connected. TX is only needed for meters that have to be woken up or asked for their data.

RX 3 · TX 1Hichi, Stromleser, LesekopfV32, Wattwächter
RX 5 · TX 4bitShake

The list only shows pins that are still free in Tasmota. A pin you already used in the module settings does not appear.

After a pin change the reading restarts by itself. You do not need to reboot.

RX ist der Pin, an dem die Datenleitung des Lesekopfs hängt. TX braucht man nur bei Zählern, die erst geweckt oder nach ihren Daten gefragt werden müssen.

RX 3 · TX 1Hichi, Stromleser, LesekopfV32, Wattwächter
RX 5 · TX 4bitShake

Die Liste zeigt nur Pins, die in Tasmota noch frei sind. Ein Pin, den du schon in der Modulkonfiguration belegt hast, taucht nicht auf.

Nach einer Änderung startet das Auslesen von selbst neu. Einen Neustart des Geräts brauchst du nicht.

Import meterBezugszähler

Off by default. This is for meters that only count the energy you buy, not the energy you feed in. You can still tell when you feed in: the power shown is negative then.

Switched on, the program adds up the negative power itself and uses that as your feed-in meter reading. Main page, charts, /pwr, Modbus and the emulators then show this value as feed-in. To see the feed-in rows and charts, switch on PV as well.

  • The calculated reading starts at 0. It only counts while the device is running and gets values from the meter.
  • It is about as exact as the power value. Good for daily and monthly totals, but not a calibrated meter.
  • When you switch the option on or off, today's, this week's, this month's and this year's feed-in start from zero again. Bars already drawn keep their values.
  • The reading is saved once a day at midnight and survives a program change. To take over the value from the old Scripter script (sml3): stop the program, enter the value as @exp_virt= in the settings file and start again.

This replaces the old script 3_SML_Chart_PV_Bezugszaehler.tas. If your meter does count the feed-in (value 3), leave this off.

Standardmäßig aus. Das ist für Zähler, die nur den Strom zählen, den du kaufst, nicht den, den du einspeist. Dass du einspeist, sieht man trotzdem: Die Leistung ist dann negativ.

Eingeschaltet zählt das Programm die negative Leistung selbst zusammen und nimmt das als deinen Einspeise-Zählerstand. Hauptseite, Diagramme, /pwr, Modbus und die Emulatoren zeigen dann diesen Wert als Einspeisung. Damit du die Einspeise-Zeilen und -Diagramme siehst, schalte zusätzlich PV ein.

  • Der berechnete Zählerstand beginnt bei 0. Er zählt nur, solange das Gerät läuft und Werte vom Zähler bekommt.
  • Er ist ungefähr so genau wie der Leistungswert. Gut für Tages- und Monatssummen, aber kein geeichter Zähler.
  • Schaltest du die Option ein oder aus, beginnen die Einspeisung von heute, dieser Woche, diesem Monat und diesem Jahr wieder bei null. Schon gezeichnete Balken bleiben.
  • Der Zählerstand wird einmal am Tag um Mitternacht gespeichert und bleibt bei einem Programmwechsel erhalten. Den Wert aus dem alten Scripter-Script (sml3) übernehmen: Programm stoppen, den Wert als @exp_virt= in die Einstellungsdatei eintragen, wieder starten.

Das ersetzt das alte Script 3_SML_Chart_PV_Bezugszaehler.tas. Zählt dein Zähler die Einspeisung selbst (Wert 3), lass die Option aus.

Gas and water metersGas- und Wasserzähler

Only in SML (no Charts) and SML Chart. Instead of the electricity meter you can read a gas or water meter that gives pulses (for example with a reed contact). In the meter list under Allgemein you find the Gaszähler (0.01 m³ per pulse) and the Wasserzähler (1 litre per pulse). If your meter is different, change @100 or @1000 in the descriptor. That number is the number of pulses per m³.

The program sees the line ;kind=gas or ;kind=water in the descriptor and switches over by itself:

  • Main page: flow (gas in m³/h, water in l/min), the meter reading, and day, week, month and year, all in m³.
  • Charts: the flow in the line charts, the consumption in m³ in the bar charts.
  • Hidden: feed-in, 3 phases, import meter, PV switch and PwrAvg.

The flow is calculated from the change of the meter reading. If no new pulse comes, it goes down, and once twice the last pulse interval has passed without a pulse it drops to 0.

Set the meter reading once in the Tasmota console, in pulses. Example for gas: Sensor53 c1 123456 means 1234.56 m³. Your own descriptor works too: value 2 must be the reading in m³, and the line ;kind= must be in the file. After changing the descriptor by hand, press Save once.

If you used the device for electricity before, the totals still start from the old kWh reading. Press Data → 🔢 Reset and 📊 Reset once.

Nur in SML (ohne Charts) und SML Chart. Statt des Stromzählers kannst du einen Gas- oder Wasserzähler auslesen, der Impulse abgibt (zum Beispiel über einen Reedkontakt). In der Zählerliste unter Allgemein findest du den Gaszähler (0,01 m³ pro Impuls) und den Wasserzähler (1 Liter pro Impuls). Ist dein Zähler anders, ändere @100 bzw. @1000 im Descriptor. Diese Zahl ist die Anzahl der Impulse pro m³.

Das Programm erkennt die Zeile ;kind=gas oder ;kind=water im Descriptor und stellt selbst um:

  • Hauptseite: Durchfluss (Gas in m³/h, Wasser in l/min), Zählerstand sowie Tag, Woche, Monat und Jahr, alles in m³.
  • Diagramme: der Durchfluss in den Liniendiagrammen, der Verbrauch in m³ in den Balken.
  • Ausgeblendet: Einspeisung, 3 Phasen, Bezugszähler, PV-Schalter und PwrAvg.

Der Durchfluss wird aus der Änderung des Zählerstands berechnet. Kommt kein neuer Impuls, sinkt er. Ist doppelt so viel Zeit wie zwischen den letzten beiden Impulsen ohne Impuls vergangen, fällt er auf 0.

Den Zählerstand setzt du einmal in der Tasmota-Konsole, in Impulsen. Beispiel für Gas: Sensor53 c1 123456 bedeutet 1234,56 m³. Ein eigener Descriptor geht auch: Wert 2 muss der Zählerstand in m³ sein, und die Zeile ;kind= muss in der Datei stehen. Nach einer Änderung am Descriptor von Hand einmal Speichern drücken.

Hast du das Gerät vorher für Strom benutzt, zählen die Summen noch vom alten kWh-Stand. Drücke einmal unter Daten 🔢 Reset und 📊 Reset.

Filter

Smooths out single wrong values from the meter. Such spikes make the charts hard to read and confuse a battery.

Leave it on unless you need the raw values. It makes the values a little slower, which only matters for battery regulation.

Glättet einzelne falsche Werte vom Zähler weg. Solche Ausreißer machen die Diagramme unleserlich und bringen einen Akku durcheinander.

Lass ihn an, außer du brauchst die Rohwerte. Er macht die Werte etwas langsamer, was nur bei der Akkuregelung eine Rolle spielt.

SML displaySML Anzeige

Tasmota itself can also show the meter values on the main page, with the meter name in front of each value. The program already shows the important values, in your language and without that name.

OFF (default)Only the program's rows. Tidier.
ONTasmota's rows as well. Useful while you set up a descriptor, because you see every value, not only the first three.

MQTT (SENSOR) always contains all meter values, no matter what you choose here. Home Assistant is not affected.

Tasmota kann die Zählerwerte auch selbst auf der Hauptseite anzeigen, mit dem Zählernamen vor jedem Wert. Das Programm zeigt die wichtigen Werte schon an, in deiner Sprache und ohne diesen Namen.

AUS (Standard)Nur die Zeilen des Programms. Übersichtlicher.
EINZusätzlich die Zeilen von Tasmota. Praktisch beim Einrichten eines Descriptors, weil du jeden Wert siehst, nicht nur die ersten drei.

MQTT (SENSOR) enthält immer alle Zählerwerte, egal was du hier einstellst. Home Assistant merkt davon nichts.

PV

Only in the chart programs. OFF shows only what you buy. ON also shows what you feed in: the feed-in meter reading, rows for day, week, month and year, a chart of the daily feed-in, and both directions in the week and month charts.

Switch it on if your meter counts the feed-in (it has 1.8.0 and 2.8.0). If it does not, but the power goes negative when you feed in, also switch on Import meter. Without solar panels the extra charts just stay at zero.

Nur in den Diagramm-Programmen. AUS zeigt nur, was du kaufst. EIN zeigt auch, was du einspeist: den Einspeise-Zählerstand, Zeilen für Tag, Woche, Monat und Jahr, ein Diagramm der täglichen Einspeisung und beide Richtungen in den Wochen- und Monatsdiagrammen.

Schalte es ein, wenn dein Zähler die Einspeisung zählt (er hat 1.8.0 und 2.8.0). Tut er das nicht, wird die Leistung beim Einspeisen aber negativ, schalte zusätzlich Bezugszähler ein. Ohne Solaranlage bleiben die zusätzlichen Diagramme einfach auf null.

ChartsDiagramme

Short-termThe time span of the first chart: 15 min, 30 min, 1 h, 2 h or 4 h (default). The shorter the span, the more detail: at 15 minutes there is a point every 5 seconds, at 4 hours one per minute.
Main ChartsOff: the charts are on their own page, opened with the 📈 link. On: they are drawn on the Tasmota main page below the values, and the link disappears. The separate page still works at /tc_ui?p=2.

If you choose a different time span and save, the short-term chart starts empty. The 24 h chart and the bar charts are not affected.

Week chart. Shows calendar weeks 1 to 53. A week starts on Monday. The current week has a red border. The weeks still to come this year are drawn pale: they still show last year's values until it is their turn again. So the chart always covers the last twelve months.

The ↻ Auto button above the charts reloads the page every 10 seconds. Without it the charts stay as they were when you opened the page. Your browser remembers this setting. While you are typing in a field, the page is not reloaded.

KurzzeitDie Zeitspanne des ersten Diagramms: 15 min, 30 min, 1 h, 2 h oder 4 h (Standard). Je kürzer die Spanne, desto genauer: bei 15 Minuten gibt es alle 5 Sekunden einen Punkt, bei 4 Stunden einen pro Minute.
Charts HauptseiteAus: Die Diagramme liegen auf einer eigenen Seite, die du über den Link 📈 öffnest. Ein: Sie werden auf der Tasmota-Hauptseite unter den Werten gezeichnet, und der Link fällt weg. Die eigene Seite geht trotzdem weiter unter /tc_ui?p=2.

Wählst du eine andere Zeitspanne und speicherst, beginnt das Kurzzeit-Diagramm leer. Das 24-h-Diagramm und die Balkendiagramme bleiben, wie sie sind.

Wochendiagramm. Zeigt die Kalenderwochen 1 bis 53. Eine Woche beginnt am Montag. Die aktuelle Woche ist rot umrandet. Die Wochen, die dieses Jahr noch kommen, sind blass: Sie zeigen noch die Werte vom letzten Jahr, bis sie wieder dran sind. So zeigt das Diagramm immer die letzten zwölf Monate.

Der Knopf ↻ Auto über den Diagrammen lädt die Seite alle 10 Sekunden neu. Ohne ihn bleiben die Diagramme so, wie sie beim Öffnen der Seite waren. Dein Browser merkt sich die Einstellung. Während du in einem Feld tippst, wird nicht neu geladen.

Chart dataDiagrammdaten

🔢 ResetStarts the values for today, this week, month and year again from the current meter reading. Do this once after installing, and whenever the values look wrong. If you see the whole meter reading instead of today's consumption, this is what you need. The charts keep their history.
📈 ResetEmpties the short-term chart and the 24 h chart. The values and the bar charts stay.
📊 ResetDeletes the bars for days, weeks and months. The counting goes on.

All three buttons ask before they delete anything.

The 💾 CSV button at the bottom of the settings page saves the chart data as a table: /sml_chart.csv, and with feed-in also /sml_chart_pv.csv. You can download the files in Tasmota's file manager and open them in a spreadsheet. This also works when the meter delivers no values.

The program itself keeps its data in its own .pvs file. For a backup, copy this one file away. To restore it, copy it back and restart the program. The file /sml_chart.bin is only used once, to take over data from an older version.

If the device was off over midnight (power cut, update), the program does the change of day when it starts again: today then counts from the start, and the days in between stay empty. What was used while the device was off cannot be split into days.

The charts need the correct time. Until the device has fetched the time from the internet, nothing is recorded.

🔢 ResetLässt die Werte für heute, diese Woche, diesen Monat und dieses Jahr wieder beim aktuellen Zählerstand beginnen. Mach das einmal nach der Installation und immer dann, wenn die Werte falsch aussehen. Siehst du den ganzen Zählerstand statt des heutigen Verbrauchs, ist das die Lösung. Die Diagramme behalten ihren Verlauf.
📈 ResetLeert das Kurzzeit- und das 24-h-Diagramm. Die Werte und die Balkendiagramme bleiben.
📊 ResetLöscht die Balken für Tage, Wochen und Monate. Gezählt wird weiter.

Alle drei Knöpfe fragen nach, bevor sie etwas löschen.

Der Knopf 💾 CSV ganz unten auf der Einstellungsseite speichert die Diagrammdaten als Tabelle: /sml_chart.csv, mit Einspeisung zusätzlich /sml_chart_pv.csv. Herunterladen kannst du sie im Dateimanager von Tasmota und in einer Tabellenkalkulation öffnen. Das geht auch, wenn der Zähler gerade keine Werte liefert.

Das Programm selbst speichert seine Daten in seiner eigenen .pvs-Datei. Für eine Sicherung kopierst du diese eine Datei weg. Zum Zurückholen kopierst du sie zurück und startest das Programm neu. Die Datei /sml_chart.bin wird nur einmal gelesen, um Daten aus einer älteren Version zu übernehmen.

War das Gerät über Mitternacht aus (Stromausfall, Update), holt das Programm den Tageswechsel beim Start nach: Heute zählt dann ab dem Start, die Tage dazwischen bleiben leer. Was in der Zeit verbraucht wurde, lässt sich keinem Tag zuordnen.

Die Diagramme brauchen die richtige Uhrzeit. Solange das Gerät die Zeit noch nicht aus dem Internet geholt hat, wird nichts aufgezeichnet.

⚠️ Totals corrected⚠️ Summen korrigiert

Today, this week, month and year are counted from a starting value each: the meter reading at midnight, on Monday, on the 1st and on 1 January. When the program starts, it checks these starting values. If one of them cannot be right, for example because it is higher than the meter reading, or because today would already be more than 1000 kWh, the program works them out again from the bars: today from today's bar, the month from the day bars since the 1st, the week from the days since Monday, the year from the month bars. Then the note Totals corrected appears on the main page until midnight. Before it changes anything, the program copies its data file and the settings file as they were: /sml_chart.bak (or sml_chart_ct002.bak, sml_chart_eco_shelly.bak) and /tc_options.bak. To go back, rename them to .pvs / .cfg, stop the program, upload them and start it again.

This happens after a meter change, or when a .pvs or tc_options.cfg from another device or an older state was copied back. Before, one huge bar for today made all the other bars look empty. If the corrected totals still look wrong, press 🔢 Reset (chart data). A reset you did yourself is never undone by this check.

Heute, diese Woche, dieser Monat und dieses Jahr zählen jeweils ab einem Startwert: dem Zählerstand um Mitternacht, am Montag, am 1. und am 1. Januar. Beim Start prüft das Programm diese Startwerte. Kann einer davon nicht stimmen, weil er z. B. über dem Zählerstand liegt oder heute schon mehr als 1000 kWh wären, rechnet das Programm sie aus den Balken neu aus: heute aus dem heutigen Balken, den Monat aus den Tagesbalken seit dem 1., die Woche aus den Tagen seit Montag, das Jahr aus den Monatsbalken. Dann steht auf der Hauptseite bis Mitternacht der Hinweis Summen korrigiert. Bevor es etwas ändert, kopiert das Programm seine Datendatei und die Einstellungsdatei so, wie sie waren: /sml_chart.bak (bzw. sml_chart_ct002.bak, sml_chart_eco_shelly.bak) und /tc_options.bak. Willst du zurück, benenn sie in .pvs bzw. .cfg um, stopp das Programm, lade sie hoch und starte es wieder.

Das passiert nach einem Zählertausch, oder wenn eine .pvs oder tc_options.cfg von einem anderen Gerät oder einem älteren Stand zurückkopiert wurde. Vorher hat ein riesiger Balken für heute alle anderen Balken leer aussehen lassen. Sehen die korrigierten Summen trotzdem falsch aus, drück 🔢 Reset (Diagrammdaten). Einen Reset, den du selbst gemacht hast, macht diese Prüfung nie rückgängig.

TelemetryTelemetrie

PwrAvg (MQTT) (with an emulator: PwrAvg / PwrSP (MQTT)) is off by default. Switched on, the program sends a strongly smoothed power value every 5 seconds over MQTT. With an emulator it also sends PwrSP, the value the battery gets. The switch is only for MQTT. The web address /pwr always works. Below the switch you see the current values and links to /pwr and /pwr?v=. Until 21.10.2026 the two values were called power2 and cpwr.

MQTT

stat/<topic>/script/PwrAvgSmoothed power [W]. Reacts slowly on purpose.
stat/<topic>/script/PwrSPOnly with an emulator: the value the battery gets, including the offset.

In MQTT Explorer or Home Assistant you find the values under stat → <topic> → script, for example stat/tasmota_31F8D4/script/PwrAvg. <topic> is the MQTT topic of your device (Tasmota: Configuration → MQTT → Topic).

HTTP /pwr

{"sml1":-440,"sml2":26714.950,"sml3":659.775,"sml4":-440,"sml5":0,"sml6":0,"PwrAvg":-217,"PwrSP":-180}

Useful for a second battery or control system that asks for the values over the network, for example the dynamic power limiter of opendtu-onbattery. It always works and needs no password.

sml1 to sml6 are the meter values. Without 3 phases, sml4 is the total power and sml5/sml6 are 0. PwrSP only appears with an emulator.

Why smoothed? A battery that follows every short spike starts to swing. sml1 is the raw value, PwrAvg the calm one.

The MQTT messages only show up in the console from weblog 3 on, so the console stays readable. If sending fails, this is logged once. -2 means MQTT is switched off on the device.

PwrAvg (MQTT) (mit Emulator: PwrAvg / PwrSP (MQTT)) ist standardmäßig aus. Eingeschaltet schickt das Programm alle 5 Sekunden einen stark geglätteten Leistungswert per MQTT. Mit Emulator schickt es zusätzlich PwrSP, den Wert, den der Akku bekommt. Der Schalter gilt nur für MQTT. Die Webadresse /pwr funktioniert immer. Unter dem Schalter siehst du die aktuellen Werte und Links zu /pwr und /pwr?v=. Bis 21.10.2026 hießen die beiden Werte power2 und cpwr.

MQTT

stat/<topic>/script/PwrAvgGeglättete Leistung [W]. Reagiert absichtlich langsam.
stat/<topic>/script/PwrSPNur mit Emulator: der Wert, den der Akku bekommt, mit Offset.

Im MQTT Explorer oder in Home Assistant findest du die Werte unter stat → <topic> → script, zum Beispiel stat/tasmota_31F8D4/script/PwrAvg. <topic> ist das MQTT-Topic deines Geräts (Tasmota: Configuration → MQTT → Topic).

HTTP /pwr

{"sml1":-440,"sml2":26714.950,"sml3":659.775,"sml4":-440,"sml5":0,"sml6":0,"PwrAvg":-217,"PwrSP":-180}

Praktisch für einen zweiten Akku oder eine Steuerung, die die Werte übers Netzwerk abfragt, zum Beispiel den Dynamic Power Limiter von opendtu-onbattery. Das geht immer und ohne Passwort.

sml1 bis sml6 sind die Zählerwerte. Ohne 3 Phasen ist sml4 die Gesamtleistung, sml5/sml6 sind 0. PwrSP gibt es nur mit Emulator.

Warum geglättet? Ein Akku, der jeder kurzen Spitze folgt, fängt an zu schwingen. sml1 ist der Rohwert, PwrAvg der ruhige.

Die MQTT-Nachrichten erscheinen in der Konsole erst ab weblog 3, damit die Konsole lesbar bleibt. Klappt das Senden nicht, steht das einmal im Log. -2 heißt, MQTT ist auf dem Gerät ausgeschaltet.

HTTP /pwr?v=

All programs. Gets single values as JSON, with the same names as in the old Scripter scripts (cm?cmnd=script?dval;dcon). It always works and needs no password.

http://<ip>/pwr?v=sml[1];yval;dcon
{"sml[1]":-3.000,"yval":2140.315,"dcon":[12.410,9.800, ...]}

Separate several names with ;. ?v=all gives you all values except the chart data. A name the program does not know gives null.

sml[n] / smlnMeter value number n. sml[3] is the feed-in reading (calculated with Import meter). Without 3 phases, sml4 is the total power and sml5/sml6 are 0.
smlShort for sml1;sml2;sml3;sml4;sml5;sml6
PwrAvgSmoothed power [W]
PwrSPOnly with an emulator: the value the battery gets [W]
dval wval mval yvalOnly in chart programs, like everything below. Energy bought today, this week, month and year [kWh], as on the main page
dval2 wval2 mval2 yval2Energy fed in, same periods [kWh]
dcon wcon mconBars for energy bought: 31 days, 53 weeks, 12 months
dprod wprod mprodBars for energy fed in

Differences to the Scripter: dval to yval2 give the consumption of the period, not the meter reading at its start. mcon has 12 values; the feed-in months are in mprod. With curl, use -g for the square brackets, or simply write sml1.

Alle Programme. Holt einzelne Werte als JSON, mit denselben Namen wie in den alten Scripter-Scripten (cm?cmnd=script?dval;dcon). Das geht immer und ohne Passwort.

http://<ip>/pwr?v=sml[1];yval;dcon
{"sml[1]":-3.000,"yval":2140.315,"dcon":[12.410,9.800, ...]}

Mehrere Namen trennst du mit ;. ?v=all liefert alle Werte außer den Diagrammdaten. Ein Name, den das Programm nicht kennt, liefert null.

sml[n] / smlnZählerwert Nummer n. sml[3] ist der Einspeise-Zählerstand (beim Bezugszähler der berechnete). Ohne 3 Phasen ist sml4 die Gesamtleistung, sml5/sml6 sind 0.
smlKurz für sml1;sml2;sml3;sml4;sml5;sml6
PwrAvgGeglättete Leistung [W]
PwrSPNur mit Emulator: der Wert, den der Akku bekommt [W]
dval wval mval yvalNur in Diagramm-Programmen, wie alles darunter. Bezug heute, diese Woche, diesen Monat, dieses Jahr [kWh], wie auf der Hauptseite
dval2 wval2 mval2 yval2Einspeisung, dieselben Zeiträume [kWh]
dcon wcon mconBalken für den Bezug: 31 Tage, 53 Wochen, 12 Monate
dprod wprod mprodBalken für die Einspeisung

Unterschiede zum Scripter: dval bis yval2 liefern den Verbrauch im Zeitraum, nicht den Zählerstand an seinem Anfang. mcon hat 12 Werte, die Einspeise-Monate stehen in mprod. Bei curl brauchst du für die eckigen Klammern -g, oder du schreibst einfach sml1.

Modbus-TCP

Off by default. Switched on, other devices can read the meter values over Modbus-TCP, for example an inverter or a home automation system.

Addressor written asValueUnit
040001PowerW
240003Energy boughtkWh
440005Energy fed inkWh

There are two ways of counting the same addresses. Some programs start at 0, others at 40001. If you get the error illegal data address, try the other column.

Settings for the client: function code 03 (Read Holding Registers), 2 registers per value, format 32-bit float, big-endian. To read all three values at once, read 6 registers starting at address 0.

Testing with Modbus Poll

Address 0 (or 40001 if PLC addresses (base 1) is ticked), Quantity 2 for one value or 6 for all three. Then select the two registers of one value and choose Format → 32-bit Float Big-Endian to see the real number.

Port 502 is the standard. Only change it if something else on the device already uses it. A change works within a second, without a reboot.

Standardmäßig aus. Eingeschaltet können andere Geräte die Zählerwerte über Modbus-TCP lesen, zum Beispiel ein Wechselrichter oder eine Hausautomation.

Adresseoder geschrieben alsWertEinheit
040001LeistungW
240003BezugkWh
440005EinspeisungkWh

Für dieselben Adressen gibt es zwei Zählweisen. Manche Programme beginnen bei 0, andere bei 40001. Bekommst du den Fehler illegal data address, probier die andere Spalte.

Einstellungen für die Gegenseite: Funktionscode 03 (Read Holding Registers), 2 Register pro Wert, Format 32-Bit-Float, Big-Endian. Alle drei Werte auf einmal: 6 Register ab Adresse 0 lesen.

Testen mit Modbus Poll

Adresse 0 (oder 40001, wenn PLC addresses (base 1) angehakt ist), Quantity 2 für einen Wert oder 6 für alle drei. Dann die zwei Register eines Werts markieren und Format → 32-Bit Float Big-Endian wählen, damit die richtige Zahl erscheint.

Port 502 ist der Standard. Ändere ihn nur, wenn ihn auf dem Gerät schon etwas anderes benutzt. Eine Änderung wirkt innerhalb einer Sekunde, ohne Neustart.

PV switchPV-Schalter

All programs, off by default. When you have solar power to spare, it switches on a second Tasmota device, for example a smart plug with a pool pump. When the surplus is gone, it switches the device off again. This is the same as option (Op1) of the old scripts. In the chart programs you find it under PV, as soon as Feed-in is switched on.

IPIP address of the other device.
On [W]Switches on when the power drops below this value. Negative means feed-in. Default −300: on from 300 W feed-in.
Off [W]Switches off when the power rises above this value. Default 100: off from 100 W bought. It can not be lower than On; Save corrects it if needed.

The switch uses the smoothed power (PwrAvg), so a passing cloud does not switch the device. A command is only sent when the state changes. The main page shows whether the device is on or off. If you untick the option or enter another IP, the old device is switched off first.

The Toggle button switches the other device by hand, for a quick test. It also works before you save. It does not show whether the device is on or off.

The other device

  • It runs Tasmota and can be reached from this device. Give it a fixed IP address (in your router).
  • It must not have a web password, otherwise it refuses the command.
  • The appliance is connected to relay 1.
  • Tip: set PowerOnState 0 on it. Then it stays off after a power cut until there is surplus again.

Alle Programme, standardmäßig aus. Hast du Solarstrom übrig, schaltet er ein zweites Tasmota-Gerät ein, zum Beispiel eine Steckdose mit Poolpumpe. Ist der Überschuss weg, schaltet er es wieder aus. Das ist dasselbe wie die Option (Op1) der alten Scripte. In den Diagramm-Programmen findest du ihn unter PV, sobald Einspeisung eingeschaltet ist.

IPIP-Adresse des anderen Geräts.
Ein [W]Schaltet ein, wenn die Leistung unter diesen Wert fällt. Negativ heißt Einspeisung. Standard −300: ein ab 300 W Einspeisung.
Aus [W]Schaltet aus, wenn die Leistung über diesen Wert steigt. Standard 100: aus ab 100 W Bezug. Der Wert kann nicht kleiner als Ein sein, Speichern korrigiert ihn sonst.

Der Schalter nutzt die geglättete Leistung (PwrAvg). Eine vorbeiziehende Wolke schaltet also nicht. Gesendet wird nur, wenn sich der Zustand ändert. Die Hauptseite zeigt, ob das Gerät ein- oder ausgeschaltet ist. Nimmst du das Häkchen weg oder trägst eine andere IP ein, wird das alte Gerät vorher ausgeschaltet.

Der Knopf Umschalten schaltet das andere Gerät von Hand um, für einen schnellen Test. Das geht auch schon vor dem Speichern. Ob das Gerät gerade ein oder aus ist, zeigt der Knopf nicht.

Das andere Gerät

  • Es läuft mit Tasmota und ist von diesem Gerät aus erreichbar. Gib ihm eine feste IP-Adresse (im Router).
  • Es darf kein Web-Passwort haben, sonst lehnt es den Befehl ab.
  • Der Verbraucher hängt an Relais 1.
  • Tipp: Stelle dort PowerOnState 0 ein. Dann bleibt es nach einem Stromausfall aus, bis wieder Überschuss da ist.

FTP-Backup

Your counters and chart data live only on the device. If its flash dies, they are gone. The small extra program FTP-Backup copies them to a FRITZ!Box (or any other FTP server, a Synology for example) every night at 00:10, a few minutes after the SML program has written its data. It runs in a second slot next to your SML program, so it only costs RAM on devices that use it. It needs a Tasmota image from 12.10.2026 or newer.

Setting it up (FRITZ!Box)

  1. FRITZ!Box: Home Network → Storage (NAS): switch on storage and access via FTP.
  2. FRITZ!Box: System → FRITZ!Box Users: create a user, for example fritzuser, with access to NAS contents and write permission.
  3. Create a folder for the backups on the FRITZ!Box, for example Tasmota.
  4. On the device, create the file /ftp.cfg (Tools → Manage File system, or the ftp.cfg link on the main page once the program runs). Like this (example):
    HOST=192.168.178.1
    USER=fritzuser
    PW=fritzpassword
    DIR=/Tasmota
    HOST is the IP of the FRITZ!Box. Use the number, not fritz.box. USER and PW are user and password, DIR is the folder, as an FTP program (FileZilla, for example) shows it after logging in to the FRITZ!Box. Lines starting with // are comments. Two optional lines: NAME= gives the device's subfolder a name of your own (the host name, for example), empty = the MQTT topic. Umlauts become ae, oe, ue and ss. ALL=1 saves ftp.cfg too, see below.
  5. Tools → TinyC Console: load FTP-Backup from the repository into a free slot (slot 1, for example), switch on autostart and start it.
  6. Press Backup on the main page to test it.

The password is stored in plain text in /ftp.cfg on the device. Better give the FRITZ!Box user access to this folder only. Then ALL=1 is safe as well: whoever reads the password in the backup only gets to the backups. Handy if someone else has to restore the device one day.

On the main page

The dot shows how the last backup went: ● worked, ● failed (the number in brackets says why, see below), ● running, grey = never run. Next to it are the date and time of the last backup. Backup saves right now, ftp.cfg opens the file in the editor.

What is saved

Every .pvs (the data of the SML programs), every .cfg (settings, among them tinyc.cfg with the programs in the slots and their autostart, but ftp.cfg with the password only with ALL=1) and every .def (meter descriptor). They go into a subfolder named after the device's MQTT topic (or NAME=), so several devices can share one folder. Give each device its own NAME, or they overwrite each other. In there is one folder per weekday, 1 (Monday) to 7 (Sunday). So you always have the last seven days, and a broken file does not overwrite the good copy of the day before. The night from Monday to Tuesday lands in 2, and holds Monday's data. The Backup button saves into its own folder 0, so it never replaces a nightly copy.

Restoring

  1. Download the files from the FRITZ!Box.
  2. Stop the SML program in the TinyC Console. (On stop it writes its own .pvs, which would otherwise overwrite yours.)
  3. Upload the files under Tools → Manage File system.
  4. Start the SML program again.

Error numbers

-1The FTP server does not answer. Wrong IP, or FTP is switched off.
-2No network.
-3Login refused by ftp-server. Check user, password or write permission to directory on ftp-server.
-6Wrong folder, or the user may not write there.
-11/ftp.cfg is missing, or has no HOST= line.
-12Not enough free RAM to start the backup.
-13The backup stopped with an error. The Tasmota log says more (TCC: workerVM). With Bounds error and ctx=bkWork in the log, the image is too old (before 12.10.2026): install a newer one.

The exact answer of the server is in the Tasmota log (TCC: ftp …).

Deine Zählerstände und Diagrammdaten liegen nur auf dem Gerät. Geht dessen Flash kaputt, sind sie weg. Das kleine Zusatzprogramm FTP-Backup kopiert sie jede Nacht um 00:10 auf eine FRITZ!Box (oder einen anderen FTP-Server, z. B. eine Synology), ein paar Minuten nachdem das SML-Programm seine Daten geschrieben hat. Es läuft in einem zweiten Slot neben deinem SML-Programm und kostet daher nur auf Geräten RAM, die es nutzen. Es braucht ein Tasmota-Image vom 12.10.2026 oder neuer.

Einrichten (FRITZ!Box)

  1. FRITZ!Box: Heimnetz → Speicher (NAS): Speicher und Zugriff über FTP einschalten.
  2. FRITZ!Box: System → FRITZ!Box-Benutzer: einen Benutzer anlegen, z. B. fritzuser, mit Zugang zu NAS-Inhalten und Schreibrecht.
  3. Auf der FRITZ!Box einen Ordner für die Sicherungen anlegen, z. B. Tasmota .
  4. Auf dem Gerät die Datei /ftp.cfg anlegen (Tools → Manage File system, oder über den Link ftp.cfg auf der Hauptseite, sobald das Programm läuft). So (Beispiel):
    HOST=192.168.178.1
    USER=fritzuser
    PW=fritzpassword
    DIR=/Tasmota
    HOST ist die IP der FRITZ!Box. Nimm die Zahl, nicht fritz.box. USER und PW sind Benutzer und Passwort, DIR ist der Ordner, so wie ihn ein FTP-Programm (z. B. FileZilla) nach der Anmeldung an der FRITZ!Box zeigt. Zeilen mit // am Anfang sind Kommentare. Zwei Zeilen sind freiwillig: NAME= gibt dem Unterordner des Geräts einen eigenen Namen (z. B. den Hostnamen), leer = das MQTT-Topic. Aus Umlauten wird ae, oe, ue und ss. ALL=1 sichert auch die ftp.cfg, siehe unten.
  5. Tools → TinyC Console: FTP-Backup aus dem Repository in einen freien Slot laden (z. B. Slot 1), Autostart einschalten und starten.
  6. Zum Testen auf der Hauptseite Backup drücken.

Das Passwort steht im Klartext in /ftp.cfg auf dem Gerät. Gib dem FRITZ!Box-Benutzer deshalb am besten nur Zugriff auf diesen Ordner. Dann ist auch ALL=1 unbedenklich: Wer das Passwort im Backup liest, kommt damit nur an die Backups. Praktisch, wenn mal jemand anderes das Gerät wiederherstellen muss.

Auf der Hauptseite

Der Punkt zeigt, wie die letzte Sicherung lief: ● hat geklappt, ● fehlgeschlagen (die Zahl in Klammern sagt warum, siehe unten), ● läuft gerade, grau = noch nie gelaufen. Daneben stehen Datum und Uhrzeit der letzten Sicherung. Backup sichert sofort, ftp.cfg öffnet die Datei im Editor.

Was gesichert wird

Jede .pvs (die Daten der SML-Programme), jede .cfg (Einstellungen, darunter tinyc.cfg mit den Programmen in den Slots und ihrem Autostart, die ftp.cfg mit dem Passwort aber nur mit ALL=1) und jede .def (Zählerbeschreibung). Sie landen in einem Unterordner, der so heißt wie das MQTT-Topic des Geräts (oder wie NAME=). So können sich mehrere Geräte einen Ordner teilen. Gib dann jedem Gerät seinen eigenen NAME, sonst überschreiben sie sich gegenseitig. Darin gibt es je Wochentag einen Ordner, 1 (Montag) bis 7 (Sonntag). So hast du immer die letzten sieben Tage, und eine kaputte Datei überschreibt nicht die gute Kopie vom Vortag. Die Nacht von Montag auf Dienstag landet in 2 und enthält die Daten vom Montag. Der Knopf Backup sichert in einen eigenen Ordner 0 und ersetzt so nie eine nächtliche Kopie.

Zurückspielen

  1. Die Dateien von der FRITZ!Box herunterladen.
  2. Das SML-Programm in der TinyC Console stoppen. (Beim Stoppen schreibt es seine eigene .pvs, die sonst deine überschreiben würde.)
  3. Die Dateien unter Tools → Manage File system hochladen.
  4. Das SML-Programm wieder starten.

Fehlernummern

-1Der FTP-Server antwortet nicht. IP falsch oder FTP ausgeschaltet.
-2Kein Netz.
-3Anmeldung vom ftp server abgelehnt. Benutzer, Passwort oder Schreibberechtigung auf ftp-server Verzeichnis prüfen.
-6Ordner falsch, oder der Benutzer darf dort nicht schreiben.
-11/ftp.cfg fehlt, oder es fehlt die Zeile HOST=.
-12Zu wenig freier RAM, um die Sicherung zu starten.
-13Die Sicherung ist mit einem Fehler abgebrochen. Mehr steht im Tasmota-Log (TCC: workerVM). Steht dort Bounds error und ctx=bkWork, ist das Image zu alt (vor dem 12.10.2026). Spiel ein neueres auf.

Die genaue Antwort des Servers steht im Tasmota-Log (TCC: ftp …).

MQTT-Push

The small extra program MQTT-Push sends meter values to an MQTT topic you choose, in a message you write yourself. The idea came from a go-e charger (Go E Charger for the EV): it charges the car with PV surplus when it gets the grid power by MQTT every few seconds. It works for anything else that wants the values in its own format, too. Like FTP-Backup it runs in a second slot next to your SML program and reads the meter directly, so your SML program stays as it is.

Setting it up

  1. Tasmota must be connected to the same MQTT broker as the receiver (for the go-e: the charger too).
  2. On the device, create the file /mqtt_push.cfg (Tools → Manage File system, or the mqtt_push.cfg link on the main page once the program runs). Like this (example):
    TOPIC=go-eCharger/123456/ids/set
    JSON={"pGrid":%sml1%,"pPv":0,"pAkku":0}
    EVERY=5
    SMOOTH=0
  3. Tools → TinyC Console: load MQTT-Push from the repository into a free slot (slot 2, for example), switch on autostart and start it.
TOPICWhere the message goes. For the go-e: go-eCharger/<serial number>/ids/set.
JSONThe message. %sml1% to %sml6% are replaced by values 1 to 6 of your meter, in the order of the meter descriptor. With my descriptors %sml1% is the power in W (+ = from the grid, − = feed-in), %sml2% the import, %sml3% the export. %-sml1% gives the same value with the sign turned.
EVERYSeconds between two messages. Default 5.
SMOOTHSmoothing in seconds. 0 = the current values. 30 = roughly the average of the last 30 seconds, so a kettle does not make the charger jump. 50 is about as calm as PwrAvg of the SML programs.

The file is read again every minute, so a change needs no restart. For the go-e, check in its documentation which sign it expects for pGrid. If it is the other way round, write %-sml1%. Do not turn the sign in the meter descriptor: the SML programs need it as it is.

On the main page

The dot shows the last message: ● sent, ● failed (number in brackets, see below), grey = nothing sent yet. Next to it is the time of the last message. mqtt_push.cfg opens the file in the editor.

-1Topic or message not accepted (too long, or empty after reading).
-2MQTT is switched off on the device.
-3No meter values: no SML program running, or no meter descriptor.
-11/mqtt_push.cfg is missing, or has no TOPIC= or JSON= line.

Das kleine Zusatzprogramm MQTT-Push schickt Zählerwerte an ein MQTT-Topic deiner Wahl, in einer Nachricht, die du selbst schreibst. Die Idee kam von einer go-e-Wallbox (Go E Charger fürs E Auto): Sie lädt das Auto mit PV-Überschuss, wenn sie alle paar Sekunden die Netzleistung per MQTT bekommt. Es passt aber auch für alles andere, das die Werte in einem eigenen Format haben will. Wie FTP-Backup läuft es in einem zweiten Slot neben deinem SML-Programm und liest den Zähler direkt aus. Dein SML-Programm bleibt so, wie es ist.

Einrichten

  1. Tasmota muss mit demselben MQTT-Broker verbunden sein wie der Empfänger (beim go-e also auch die Wallbox).
  2. Auf dem Gerät die Datei /mqtt_push.cfg anlegen (Tools → Manage File system, oder über den Link mqtt_push.cfg auf der Hauptseite, sobald das Programm läuft). So (Beispiel):
    TOPIC=go-eCharger/123456/ids/set
    JSON={"pGrid":%sml1%,"pPv":0,"pAkku":0}
    EVERY=5
    SMOOTH=0
  3. Tools → TinyC Console: MQTT-Push aus dem Repository in einen freien Slot laden (z. B. Slot 2), Autostart einschalten und starten.
TOPICWohin die Nachricht geht. Beim go-e: go-eCharger/<Seriennummer>/ids/set.
JSONDie Nachricht. %sml1% bis %sml6% werden durch die Werte 1 bis 6 deines Zählers ersetzt, in der Reihenfolge der Zählerbeschreibung. Bei meinen Zählerbeschreibungen ist %sml1% die Leistung in W (+ = Bezug, − = Einspeisung), %sml2% der Bezug, %sml3% die Einspeisung. %-sml1% liefert denselben Wert mit umgedrehtem Vorzeichen.
EVERYSekunden zwischen zwei Nachrichten. Standard 5.
SMOOTHGlättung in Sekunden. 0 = die aktuellen Werte. 30 = ungefähr der Durchschnitt der letzten 30 Sekunden, damit ein Wasserkocher die Wallbox nicht springen lässt. 50 ist etwa so ruhig wie PwrAvg der SML-Programme.

Die Datei wird jede Minute neu gelesen, eine Änderung braucht also keinen Neustart. Schau beim go-e in seiner Dokumentation nach, welches Vorzeichen er bei pGrid erwartet. Ist es andersherum, schreib %-sml1%. Dreh das Vorzeichen nicht in der Zählerbeschreibung um, die SML-Programme brauchen es so, wie es ist.

Auf der Hauptseite

Der Punkt zeigt die letzte Nachricht: ● gesendet, ● fehlgeschlagen (Zahl in Klammern, siehe unten), grau = noch nichts gesendet. Daneben steht die Uhrzeit der letzten Nachricht. mqtt_push.cfg öffnet die Datei im Editor.

-1Topic oder Nachricht nicht angenommen (zu lang, oder nach dem Lesen leer).
-2MQTT ist auf dem Gerät ausgeschaltet.
-3Keine Zählerwerte: kein SML-Programm läuft, oder es gibt keine Zählerbeschreibung.
-11/mqtt_push.cfg fehlt, oder es fehlt die Zeile TOPIC= oder JSON=.

Meter PINZähler-PIN

Most electronic meters in Germany only show the total until you enter a PIN. Only then they also send the power and the phases - which the charts and the battery emulators need. You get the PIN from your grid operator. The meter forgets it after every power cut.

The small extra program Zähler-PIN enters the PIN for you, with the IR LED of your reading head - no torch needed. After a power cut it does it by itself: if the meter sends its counter but no power for three minutes after the start, it sends the PIN once. It runs in a second slot next to your SML program.

Setting it up

  1. In the SML settings the TX pin must be set (the GPIO of the reading head's IR LED). The program uses that pin.
  2. Create the file /sml_pin.cfg on the device (Tools → Manage File system, or the sml_pin.cfg link on the main page once the program runs) and put your PIN in. Example: sml_pin.cfg.
  3. Tools → TinyC Console: load Zähler-PIN from the repository into a free slot, switch on autostart and start it.
  4. Press 🔓 PIN on the main page and watch the meter display: the digits count up, after the last one the extended values appear.
PINThe PIN digits.
AUTO1 = send by itself after a power cut (default), 0 = only with the button.
ON / OFF / GAPLight on, light off per pulse, pause after each digit, in ms. Default 200 / 200 / 1500. Does not work: try 300 / 300 / 2000 or 150 / 150 / 1000.
WAKESingle pulses before the first digit. Some meters need one or two to switch the display on and show the PIN entry. Default 0.
ZEROPulses for the digit 0: 10 (default, counts once round) or 0 (just wait).
INV1 = the LED lights at LOW (most reading heads, default), 0 = at HIGH. If the LED stays lit or nothing happens, try the other one.
GPIO-1 = the TX pin from the SML settings (default), or another GPIO.

While the PIN is sent (10 to 30 seconds) the reading head is busy; the program then restarts the SML reading. On the main page the dot shows the last attempt: green = sent, red = failed (number in brackets): -1 no PIN in the file, -2 no TX pin set, -3 the GPIO is used by Tasmota, -12/-13 the sending could not start or stopped.

Die meisten elektronischen Zähler in Deutschland zeigen nur den Zählerstand, bis man eine PIN eingibt. Erst dann senden sie auch die Leistung und die Phasen, und die brauchen die Diagramme und die Akku-Emulatoren. Die PIN bekommst du von deinem Netzbetreiber. Nach jedem Stromausfall vergisst der Zähler sie wieder.

Das kleine Zusatzprogramm Zähler-PIN gibt die PIN für dich ein, mit der IR-LED deines Lesekopfs, ganz ohne Taschenlampe. Nach einem Stromausfall macht es das von selbst: Schickt der Zähler nach dem Start drei Minuten lang seinen Zählerstand, aber keine Leistung, sendet es die PIN einmal. Es läuft in einem zweiten Slot neben deinem SML-Programm.

Einrichten

  1. In den SML-Einstellungen muss der TX-Pin eingetragen sein (der GPIO der IR-LED im Lesekopf). Diesen Pin nimmt das Programm.
  2. Auf dem Gerät die Datei /sml_pin.cfg anlegen (Tools → Manage File system, oder über den Link sml_pin.cfg auf der Hauptseite, sobald das Programm läuft) und deine PIN eintragen. Beispiel: sml_pin.cfg.
  3. Tools → TinyC Console: Zähler-PIN aus dem Repository in einen freien Slot laden, Autostart einschalten und starten.
  4. Auf der Hauptseite 🔓 PIN drücken und aufs Zählerdisplay schauen: Die Ziffern zählen hoch, nach der letzten erscheinen die erweiterten Werte.
PINDie Ziffern der PIN.
AUTO1 = nach einem Stromausfall von selbst senden (Standard), 0 = nur mit dem Knopf.
ON / OFF / GAPLicht an, Licht aus je Puls, Pause nach jeder Ziffer, in ms. Standard 200 / 200 / 1500. Klappt es nicht, probier 300 / 300 / 2000 oder 150 / 150 / 1000.
WAKEEinzelne Pulse vor der ersten Ziffer. Manche Zähler brauchen einen oder zwei, um das Display einzuschalten und die PIN-Eingabe zu zeigen. Standard 0.
ZEROPulse für die Ziffer 0: 10 (Standard, einmal rundherum gezählt) oder 0 (nur warten).
INV1 = die LED leuchtet bei LOW (die meisten Leseköpfe, Standard), 0 = bei HIGH. Leuchtet die LED dauernd oder passiert nichts, probier das andere.
GPIO-1 = der TX-Pin aus den SML-Einstellungen (Standard), oder ein anderer GPIO.

Während die PIN gesendet wird (10 bis 30 Sekunden), ist der Lesekopf belegt. Danach startet das Programm das SML-Lesen neu. Auf der Hauptseite zeigt der Punkt den letzten Versuch: grün = gesendet, rot = fehlgeschlagen (Zahl in Klammern): -1 keine PIN in der Datei, -2 kein TX-Pin eingestellt, -3 der GPIO ist in Tasmota belegt, -12/-13 das Senden konnte nicht starten oder brach ab.

Settings fileEinstellungsdatei

Each program keeps its data in its own file. So that you do not have to set everything up again after changing the program, the shared settings are also kept in /tc_options.cfg. All programs use this file.

# tc_options - shared by all programs
@ui_de=1
@sml_meter_sel=89
@sml_rx_pin=3
@sml_tx_pin=1
@sml_ph3=1
@es_mode=2
@sml_da=3
@chart_short=240
@imp_day=26714.950
@exp_day=659.775

Each line is @name=value. A program reads the lines it knows and keeps all others as they are. If you run sml_simple for a while, the emulator settings are still there when you change back.

ui_*Language, power saving.
sml_*Meter, RX/TX pin, filter, phases, display.
es_* / ct_* / mb_*Emulators and Modbus.
chart_*chart_short is the time span of the short-term chart in minutes (15, 30, 60, 120, 240). chart_onmain puts the charts on the Tasmota main page.
imp_* / exp_*The meter readings at the start of the day, week, month and year, in kWh. The program uses them to work out your consumption. sml_da belongs to them.
sml_bezug / exp_virtThe Import meter option and its calculated feed-in reading in kWh.
sw_*The PV switch: on/off, On [W], Off [W], IP.

Changing it by hand

Download the file, change it, upload it, then restart the program. Keep this order. A running program would otherwise write its own values back over yours.

Usually you would only correct the start readings. Set imp_day to the meter reading at midnight, and today's consumption is right again.

Do not delete the file to reset something. It is written again from the data of the running program, and after a program change that can be zeros.

The file is only written when something has changed: when you save a setting, and once at midnight. That is about once a day, which is gentle on the flash memory.

Jedes Programm speichert seine Daten in einer eigenen Datei. Damit du nach einem Programmwechsel nicht alles neu einstellen musst, stehen die gemeinsamen Einstellungen zusätzlich in /tc_options.cfg. Diese Datei nutzen alle Programme.

# tc_options - shared by all programs
@ui_de=1
@sml_meter_sel=89
@sml_rx_pin=3
@sml_tx_pin=1
@sml_ph3=1
@es_mode=2
@sml_da=3
@chart_short=240
@imp_day=26714.950
@exp_day=659.775

Jede Zeile hat die Form @name=wert. Ein Programm liest die Zeilen, die es kennt, und lässt alle anderen stehen. Läuft eine Weile sml_simple, sind die Emulator-Einstellungen beim Zurückwechseln noch da.

ui_*Sprache, Energiesparmodus.
sml_*Zähler, RX-/TX-Pin, Filter, Phasen, Anzeige.
es_* / ct_* / mb_*Emulatoren und Modbus.
chart_*chart_short ist die Zeitspanne des Kurzzeit-Diagramms in Minuten (15, 30, 60, 120, 240). chart_onmain legt die Diagramme auf die Tasmota-Hauptseite.
imp_* / exp_*Die Zählerstände am Anfang von Tag, Woche, Monat und Jahr, in kWh. Daraus rechnet das Programm deinen Verbrauch aus. sml_da gehört dazu.
sml_bezug / exp_virtDie Option Bezugszähler und ihr berechneter Einspeise-Zählerstand in kWh.
sw_*Der PV-Schalter: an/aus, Ein [W], Aus [W], IP.

Von Hand ändern

Datei herunterladen, ändern, hochladen, dann das Programm neu starten. Halte diese Reihenfolge ein. Ein laufendes Programm würde sonst seine eigenen Werte über deine schreiben.

Meistens korrigiert man nur die Anfangsstände. Setzt du imp_day auf den Zählerstand um Mitternacht, stimmt der heutige Verbrauch wieder.

Lösche die Datei nicht, um etwas zurückzusetzen. Sie wird aus den Daten des laufenden Programms neu geschrieben, und das können nach einem Programmwechsel Nullen sein.

Die Datei wird nur geschrieben, wenn sich etwas geändert hat: wenn du eine Einstellung speicherst, und einmal um Mitternacht. Also etwa einmal am Tag, das schont den Flash-Speicher.

TroubleshootingFehlersuche

All values 0Check Meter active first, then the pins, then the descriptor. Switch on SML display: if Tasmota shows no values either, the meter is not being read at all.
Power has the wrong signBought and fed-in are swapped in the descriptor. Feed-in must be negative.
Values jump aroundSwitch on the filter. If it stays restless, the reading head does not sit straight on the meter's light window.
Charts stay emptyThe device has no time from the internet yet, or the start readings were never set. See chart data.
Settings gone after a rebootSettings are saved when you press Save and when the program stops. A power cut right after a change can lose that change.
Modbus does not answerCheck the port, and whether the Wi-Fi was already connected when the program started.
Alle Werte 0Zuerst Zähler aktiv prüfen, dann die Pins, dann den Descriptor. Schalte SML Anzeige ein: Zeigt auch Tasmota keine Werte, wird der Zähler gar nicht gelesen.
Leistung hat das falsche VorzeichenBezug und Einspeisung sind im Descriptor vertauscht. Einspeisung muss negativ sein.
Werte springenFilter einschalten. Bleibt es unruhig, sitzt der Lesekopf nicht gerade auf dem Lichtfenster des Zählers.
Diagramme bleiben leerDas Gerät hat noch keine Uhrzeit aus dem Internet, oder die Anfangsstände wurden nie gesetzt. Siehe Diagrammdaten.
Einstellungen nach Neustart wegGespeichert wird beim Drücken auf Speichern und wenn das Programm stoppt. Ein Stromausfall direkt nach einer Änderung kann diese Änderung kosten.
Modbus antwortet nichtPort prüfen, und ob das WLAN beim Programmstart schon verbunden war.