User Tools

Site Tools


technik:pow-hvm6.2m_with_tasmota

This is an old revision of the document!


PowMr POW-HVM6.2M with Tasmota

To connect my PowMr solar inverter to Home Assistant, I needed some kind of adapter in between. I decided for ESP32C3 with Tasmota firmware.

Tasmota was comparatively easy to download and translate on my PC. Tasmota comes with a universal interface for ModBus devices such as PowMr. However, the ModBus register names and formats must be given in a kind of script. Register and HW interface of my PowMr inverter was nicely analysed by

Tasmota Compiler Settings

Recommended IDE for Tasmota is VS code. You need to install PlatformIO framework before opening Tasmota GIT repository. These settings in file platformio_override.ini were needed to translate Tasmota for my ESP32C3 on my Windows PC.

platformio_override.ini
[platformio]
; For best Gitpod performance remove the ";" in the next line. Needed Platformio files are cached and installed at 
  first run
core_dir = .platformio

All other changes I could concentrate in file ..\tasmota\user_config_override.h without really touching the Tasmota code.

user_config_override.h
#ifndef USE_SCRIPT
#define USE_SCRIPT
#endif
#define USE_SCRIPT_JSON_EXPORT
#ifndef USE_SML_M
#define USE_SML_M
#endif
#ifdef USE_RULES
#undef USE_RULES
#endif
 
#define USE_DISPLAY                          // Add Display Support (+2k code) display ON/OFF button
#define USE_UNIVERSAL_DISPLAY                // new driver with display.ini file 

Many FW upload tools failed for my ESP32C3, but the direct USB upload from VS Code worked well.

OLED display

In the code base I also found the display driver SH1106_display.ini which I renamed to display.ini and uploaded it to the file area of my tasmotized ESP32C3. There is another magic setting you have to apply to any unused GPIO:

The display has another ON/OFF buttom on Tasmotas main screen. Now I started the display with the following commands on the console.

console commands
I2Cscan
displayaddress 0x3c
DisplayModel 17       (new driver with display.ini file and OptionA3)

Tasmota ModBus Script

I needed the script to access my Modbus based solar inverter PowMr. PowMr inverter are all very similar. Luckily

investigated already on the registers for these PowMr inverters.

This Tasmota Scripting was the most ugly part of the project.

  1. Section >M needs to define Tx and Rx-Mask at different lines and locations which makes the code unreadable
  2. Values from section >M can only be used in section >T, not in section >S or elsewhere
  3. If values received from section >M are real values(e.g. 0.1), they cannot be used in section >T - only integer allowed
  4. calculations in section >T are ignored by the script. Calculations must go into section >S
  5. spaces in calculations and some other places are not allowed
  6. once section >M is working, the defined units are missing in Home Assistance (due to missing key unit_of_measurement)

However, if you copy the following script, you will be able to - at least see all values in Home Assistant as Tasmota Integration. This script is copied directly into the HTML-script page of the Tasmota device.

Tasmota Script.txt
; GPIO's auf NONE stellen!
 
>D           ;defines
temp=0
AC_Voltage=0
PV_Voltage=0
Batt_Volt=0
Batt_Volt10=0
Chg_current=0
DChg_current=0
Batt_current=0
Batt_Asec=0
Batt_Ah=0
Chg_power=0
DChg_power=0
Batt_power=0
AC_freq=0
val2=0
val3=0
 
>B                 ; at boot
->DisplayText [zs1l1c1]Temperatur innen[s1l3c12]o[s2l2c7]C
->sensor53 r       ; d1 for debug, !!OR!! r for normal operation of ModBus driver
->sensor53 l3      ; LED3 blinken lassen
 
>T                 ; on Tele message
temp=DS18B20#Temperature    ; read temperature
->DisplayText [s2l2c2]%1temp%
;print %temp%
 
Batt_Volt10 = PowMr#Batt_Volt10 ; read values from section >M
Chg_current = PowMr#Chg_current
DChg_current= PowMr#DChg_current
 
>S                 ; 1sec
Batt_Volt=Batt_Volt10/10
Batt_current=(Chg_current-DChg_current)
Batt_power=(Batt_current*Batt_Volt)
Chg_power=Chg_current*Batt_Volt 
DChg_power=DChg_current*Batt_Volt
Batt_Asec+=Batt_current                   ; each second!
Batt_Asec=mp(Batt_Asec <0 0 >(250*3600) (250*3600))  ; 250Ah Battery limit
Batt_Ah=Batt_Asec/3600
print %Batt_Volt%V, %Chg_current%A, %DChg_current%A, %Batt_current%A, %Batt_power%W, %Batt_Ah%Ah
 
=>Publish tele/%topic%/SENSOR {"Batt":{"Chg_power":%0Chg_power%,"DChg_power":%0DChg_power%,"power":%0Batt_power%,"current":%0Batt_current%}}
=>publish stat/%topic%/RESULT {"Batt":{"Chg_power":%0Chg_power%,"DChg_power":%0DChg_power%,"power":%0Batt_power%,"current":%0Batt_current%,"level_Ah":%0Batt_Ah%}}
 
>M 1               ; using 1 meter
; +<No>,<rxGPIO>,<type>,<flag>,<parameter>,<jsonPrefix>,<txGPIO>,<n x 100msec>,i x <hex Telegrams>
+1,20,m,0,2400,PowMr,21,3,05031196,05031198,0503119A,0503119C,0503119E,050311A0,050311A2,050311A4,050311A6,05031195,050311B6,050311B8,050311C8,050311CA,050311CC
1,050304uuUUxxxx@i0:10,AC Voltage,V,AC_Voltage,1
1,050304xxxxuuUU@i0:10,AC Frequenz,Hz,AC_Freq,1
1,050304uuUUxxxx@i1:10,PV Voltage,V,PV_Voltage,1
1,050304xxxxuuUU@i1:1,PV Power,W,PV_Power,0
1,050304uuUUxxxx@i2:10,Battery Voltage,V,Batt_Voltage,1
1,050304uuUUxxxx@i2:1,Battery Voltage10,V,Batt_Volt10,0
1,050304xxxxuuUU@i2:1,Batt Percent,%%,Batt_Percent,0
1,050304uuUUxxxx@i3:1,Batt Charge Current,A,Chg_current,0
1,050304xxxxuuUU@i3:1,Batt DisCharge Current,A,DChg_current,0
1,050304uuUUxxxx@i4:10,Load Voltage,V,Out_Volt,1
1,050304xxxxuuUU@i4:10,Load Frequ,Hz,Out_Freq,1
1,050304uuUUxxxx@i5:1,Load Power VA,VA,Out_PowerVA,0
1,050304xxxxuuUU@i5:1,Load Power,W,Out_Power,0
1,050304uuUUxxxx@i6:1,Efficiency1,%%,Eff1,0
1,050304xxxxuuUU@i6:1,Efficiency2,%%,Eff2,0
1,050304uuUUxxxx@i7:1,Stat4516,dec,Stat4516,0
1,050304xxxxuuUU@i7:1,Stat4517,dec,Stat4517,0
1,050304uuUUxxxx@i8:1,Stat4518,dec,Stat4518,0
1,050304xxxxuuUU@i8:1,Stat4519,dec,Stat4519,0
1,050304uuUUxxxx@i9:1,Stat4501 SBU,dec,Stat4501,0
1,050304uuUUxxxx@i10:1,Stat4534,dec,Stat4534,0
1,050304xxxxuuUU@i10:1,Stat4535,dec,Stat4535,0
1,050304uuUUxxxx@i11:1,Stat4536,dec,Stat4536,0
1,050304xxxxuuUU@i11:1,Stat4537,dec,Stat4537,0
1,050304uuUUxxxx@i12:1,Stat4552,dec,Stat4552,0
1,050304xxxxuuUU@i12:1,Stat4553,dec,Stat4553,0
1,050304uuUUxxxx@i13:1,Stat4554,dec,Stat4554,0
1,050304xxxxuuUU@i13:1,Stat4555,dec,Stat4555,0
1,050304uuUUxxxx@i14:1,Stat4556,dec,Stat4556,0
1,050304xxxxuuUU@i14:1,Temperatur,°C,Stat4557,0
#

PowMr inverter lacks the AC input power measurement. For this reason I added a PZEM004 module for power measurement, which is already fully supported by Tasmota - simply by selecting Rx and Tx-PZEM004 in the Tasmota pin configuration menue.

technik/pow-hvm6.2m_with_tasmota.1731751308.txt.gz · Last modified: 2024/11/16 11:01 by ich