Skip to content

Instantly share code, notes, and snippets.

@gitfvb
Last active March 15, 2024 08:51
Show Gist options
  • Save gitfvb/b57f9dfeb26a606a3b438a42503a6028 to your computer and use it in GitHub Desktop.
Save gitfvb/b57f9dfeb26a606a3b438a42503a6028 to your computer and use it in GitHub Desktop.
Just a small note of how I configured my Wemos D1 Mini ESP32 to read a smartmeter (eBZ) and control my door bell

Compilation of Tasmota

Done via vscode and PlatformIO

Changes to compile in platform.ini

platform                    = espressif32
board                       = wemos_d1_mini32

Changes to `tasmota/user_config_override.h' before the end


#define USE_BERRY_DEBUG
/*
#define USE_RULES
*/

#define USE_SCRIPT_JSON_EXPORT
#define SCRIPT_POWER_SECTION
#define USE_BUTTON_EVENT

#ifndef USE_SCRIPT
#define USE_SCRIPT
#endif
#ifndef USE_SML_M
#define USE_SML_M
#endif
#ifdef USE_RULES
#undef USE_RULES
#endif

Then uploaded via vscode and setup my tasmota. Luckily with a new compilation the Tasmota remembers previous settings.

Configure Tasmota

This is how the modules are configured, mainly for the bell control

grafik

MQTT is also activated and connected with iobroker to inform me via telegram and to be able change some relays via telegram or iobroker UI.

This script is used to control the bell and measure the length (so it could only be activated with a long press). But this is only preparation. And this script also parses the IR input of the Hichi IR reading device connected to an eBZ DD3 2R06 DTA - SMZ1

>D
tmp=0
timer=0
onoff=1
>B
;disable publishing at MQTT teleperiod, on boot
smlj=0
=>TelePeriod 30
;tper=30
=>SerialConfig 8N1
->sensor53 r
=>power1 0 ; Bell Relay
=>power2 1 ; LED Ring Relay
=>power3 onoff ; Virtual OnOff for Bell
>F
; 100 ms timer
if tmp==1
then
timer+=1
endif
>b
; Button change event
tmp=bt[1]
onoff=pwr[3]
if onoff==1
then
if tmp==0
then
print RELEASE AFTER %timer%
timer=0
=>power1 0
=>power2 1
else
print PRESS %tmp%
=>power1 1
=>power2 0
endif
endif
>S
;re-enable publishing at MQTT teleperiod, after 10 seconds of uptime
if upsecs>10
then
smlj|=1
endif
>M 1
+1,3,s,0,9600,SML
1,77070100010800FF@100000000,Energie Bezug,kWh,1_8_0,8
1,77070100010801FF@1000,Energie Bezug NT,kWh,1_8_1,3
1,77070100010802FF@1000,Energie Bezug HT,kWh,1_8_2,3
1,77070100020800FF@100000000,Energie Export,kWh,2_8_0,8
1,77070100100700FF@1,Leistung,W,16_7_0,2
1,77070100240700FF@1,Leistung L1,W,36_7_0,2
1,77070100380700FF@1,Leistung L2,W,56_7_0,2
1,770701004C0700FF@1,Leistung L3,W,76_7_0,2
1,77070100200700FF@1,Spannung L1,V,32_7_0,1
1,77070100340700FF@1,Spannung L2,V,52_7_0,1
1,77070100480700FF@1,Spannung L3,V,72_7_0,1
#
@gitfvb
Copy link
Author

gitfvb commented Mar 15, 2024

I have had a real problem that iobroker was flooded with mqtt messages of current usage data. But in the end that was the last number (precision) of the parsed rows because there was 18 in the default script. Means every change in the value will be send via mqtt. Putting that up to 2 reduced that problem so only TelePeriod sends all of the data via mqtt to iobroker instead of single changed values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment