Skip to main content

Tasmota Configuration

Advanced Configuration

Configure your stromleser.tasmota for optimal performance and integration into your smart home system.

Basic Configuration

Initial Setup

Access configuration interface:

  1. Open IP address of Stromleser in browser
  2. ConfigurationConfigure Module
  3. Module type: Select appropriate template
  4. GPIO configuration: Set pin assignments

Device Template

Basic Stromleser template:

{
"NAME": "stromleser.tasmota",
"GPIO": [0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"FLAG": 0,
"BASE": 18
}

Network Settings

WiFi optimization:

WiFiConfig 4        # Retry connection
WiFiRetry 300 # 5-minute retry interval
Hostname stromleser-01 # Descriptive hostname

IP configuration:

IPAddress 192.168.1.100  # Static IP (optional)
Gateway 192.168.1.1 # Router address
Netmask 255.255.255.0 # Subnet mask

SML Script Configuration

Script Installation

Enable scripting:

Script 1            # Enable script engine
>D # Define section
>B # Boot section
>S # Script section

Basic SML Script Structure

Template for most meters:

>D
>B
->sensor53 r
>S
if upsecs>22 then
smlj=0
res=sml(1)
if res and smlj>0 then
print Energy export: res M: smlj @
endif
endif

>M 1
+1,3,s,16,9600,SML
1,77070100010800ff@1000,Verbrauch,kWh,Verbrauch,4
1,77070100020800ff@1000,Einspeisung,kWh,Einspeisung,4
1,77070100100700ff@1,Leistung,W,Leistung,0
#

Meter-Specific Adaptations

Modern electronic meters (EMH, Iskra):

  • Standard SML protocol
  • PIN usually required
  • 9600 baud rate

Older Ferraris meters with D0:

  • IEC 62056-21 protocol
  • 300-9600 baud
  • Different OBIS codes

PIN Configuration

Set meter PIN:

SMLPin 1234         # Set PIN for SML access
SMLPinState 1 # Enable PIN usage

Verify PIN acceptance:

  • Check console for SML messages
  • Look for successful authentication
  • Monitor data reception

Advanced Scripting

Enhanced SML Script

With error handling and logging:

>D
cnt=0
msg=""

>B
->sensor53 r

>S
if upsecs>22 then
smlj=0
res=sml(1)
if res and smlj>0 then
cnt+=1
msg="OK: "+str(cnt)
print %msg%
else
msg="ERROR: No SML data"
print %msg%
endif
; Publish custom status
=>publish home/stromleser/status %msg%
endif

>M 1
+1,3,s,16,9600,SML
1,77070100010800ff@1000,Verbrauch,kWh,Verbrauch,4
1,77070100020800ff@1000,Einspeisung,kWh,Einspeisung,4
1,77070100100700ff@1,Leistung,W,Leistung,0
1,77070100000009ff@#,Seriennummer,,Seriennummer,0
1,7707010060320101@#,Hersteller,,Hersteller,0
#

Data Validation

Plausibility checks:

>S
if upsecs>22 then
smlj=0
res=sml(1)
if res and smlj>0 then
; Check for realistic power values
if Leistung>-50000 and Leistung<50000 then
; Valid data
=>publish home/stromleser/valid 1
else
; Invalid data - possible error
=>publish home/stromleser/error "Invalid power: "+str(Leistung)
endif
endif
endif

MQTT Configuration

Basic MQTT Setup

Configure MQTT broker:

MqttHost 192.168.1.100    # MQTT broker IP
MqttPort 1883 # Standard MQTT port
MqttUser stromleser # Username
MqttPassword secret123 # Password
Topic stromleser # Base topic

Advanced MQTT Settings

Custom topic structure:

FullTopic home/energy/%topic%/  # Custom topic hierarchy
GroupTopic energy # Group for multiple devices
TelePeriod 300 # Send telemetry every 5 minutes

MQTT Discovery for Home Assistant:

SetOption19 1             # Enable MQTT Discovery
SetOption59 1 # Send TelePeriod on state change

Rules and Automation

Basic Rules

High consumption alert:

Rule1 ON SML#Leistung>3000 DO Publish home/alerts/power "High consumption: %value%W" ENDON
Rule1 1 # Enable rule

Daily consumption report:

Rule2 ON Time#Minute=0 DO
IF Time#Hour=0 THEN
Publish home/reports/daily "Daily consumption: %var1%kWh"
var1=0
ENDIF
ENDON
Rule2 1

Advanced Automation

Load management:

Rule3 ON SML#Leistung DO
IF %value%>5000 THEN
Publish home/control/highload 1
ENDIF
IF %value%<1000 THEN
Publish home/control/lowload 1
ENDIF
ENDON
Rule3 1

PV surplus utilization:

Var1 0                    # Surplus threshold

Rule4 ON SML#Leistung DO
IF %value%<0 THEN
var1=%value%
Publish home/solar/surplus %var1%
ENDIF
ENDON
Rule4 1

Web Interface Customization

Custom Web Elements

Add custom buttons:

WebButton1 Reset Counter  # Custom button

Handle button actions:

Rule1 ON Button1#State DO
var1=0
Publish home/stromleser/reset "Counters reset"
ENDON

Status Display

Custom sensor display:

WebSensor1 Daily Consumption: %var1% kWh
WebSensor2 Monthly Total: %var2% kWh

Firmware Updates

Over-The-Air Updates

Update via web interface:

  1. FirmwareUpgrade by web server
  2. Server URL: http://ota.tasmota.com/tasmota/release-firmware/tasmota.bin.gz
  3. Start upgrade

Custom firmware builds:

  • Include SML support
  • Optimize for memory usage
  • Add specific sensors

Update Automation

Scheduled updates:

Rule1 ON Time#Minute=0 DO
IF Time#Hour=3 AND Time#Day=1 THEN
; Monthly update check
Publish home/maintenance/update_check 1
ENDIF
ENDON

Performance Optimization

Memory Management

Optimize memory usage:

SetOption56 1             # Enable JSON compression
WebLog 2 # Reduce web logging
TelePeriod 300 # Less frequent telemetry

Monitor memory:

Status 4                  # Check heap memory
Status 1 # General status

Network Optimization

WiFi power management:

Sleep 50                  # Light sleep mode
WifiPower 17 # Max WiFi power

Connection stability:

WiFiRetry 300            # 5-minute retry
WiFiConfig 4 # Retry then AP mode

Security Configuration

Access Protection

Web interface security:

WebPassword your_secure_password  # Web admin password
SetOption55 1 # mDNS control

Console protection:

SerialLog 0              # Disable serial logging
WebLog 1 # Minimal web logging

Network Security

Restrict access:

SetOption1 1             # Restrict some commands
SetOption21 1 # Energy monitoring protection

Backup and Recovery

Configuration Backup

Create backup:

  1. ConfigurationConfigure Other
  2. Configuration Backup
  3. Download .dmp file

Automated backup via MQTT:

Rule1 ON System#Boot DO
; Publish config on boot
Backlog Status 0; Status 2; Status 5
ENDON

Recovery Procedures

Factory reset:

Reset 1                  # Reset to defaults

Selective reset:

Reset 2                  # Reset parameters only
Reset 3 # Reset MQTT settings only

Troubleshooting

Common Issues

Script not working:

  1. Check script syntax
  2. Verify meter compatibility
  3. Confirm PIN settings
  4. Monitor console output

MQTT problems:

Status 6                 # MQTT status
MqttLog 4 # Enable MQTT debugging

Diagnostic Commands

System diagnostics:

Status 0                 # General information
Status 1 # System parameters
Status 2 # Firmware info
Status 3 # Logging info
Status 4 # Memory info
Status 5 # Network info

SML diagnostics:

Status 8                 # Sensor data
Status 10 # Sensor info
Script >E # Show script errors

Best Practices

Configuration Management

Document changes:

  • Keep configuration backups
  • Document custom scripts
  • Note successful settings
  • Track firmware versions

Version control:

  • Save script versions
  • Test before deploying
  • Keep rollback capability

Monitoring

Health checks:

Rule1 ON System#Boot DO
Publish home/status/boot "Stromleser rebooted"
ENDON

Rule2 ON Wifi#Connected DO
Publish home/status/wifi "Connected to %ssid%"
ENDON

Performance monitoring:

Rule3 ON Tele-SML DO
IF uptime>3600 AND heap<10000 THEN
Publish home/alerts/memory "Low memory: %heap%"
ENDIF
ENDON

After completing the basic configuration, you can proceed with script installation or explore integration options.