-
Notifications
You must be signed in to change notification settings - Fork 24
Home
Here you can read how to use a Tasmota flashed device to act as pv-inverter.
This example will show you a cheap and flexible alternative to EM24 or ET340 meter device(s). If you for example have several module inverters in different locations it will be hard the feed all in a single device. With multiple Tasmota devices it's simple to measure every inverter independently.
- dbus-mqtt-devices installed and running
- Tasmota flashed and configured device. Preferably an ESP32. I will use a Sonoff DUAL R3 as main example. A ESP8266 is with small limitations also possible.
- We have to get an "numeric device instance" from Victron DBus by publishing to
device/<client id>/DBus
- Read assigned "numeric device instance"
- publish into the newly created pv-inverter
All that is done by Rules in Tasmota.
- Right now there is no solution to send a "testament" to the dbus-mqtt-devices driver. So if you loose connection, the Victron system won't realize it.
- Connect Tasmota to Victron Broker
- Configuration > Configure MQTT
- Host:
<Victron IP>
- Host:
- Configuration > Configure MQTT
- Set Rule
- Consoles > Console
- minimal example where the solar modules are connected to Lout1 on an Sonoff DUAL R3. Copy the whole rule and paste it to the console, change and <phase[1,2,3]> to your needs, than press
Enter
. Activate Rule1 by typingrule1 1
.
Rule1 ON System#Init DO Backlog mem1 <VRMdeviceID>; mem3 <phase[1,2,3]>; SetOption129 1 ENDON ON mqtt#connected DO Backlog Subscribe DBusInfo, device/%deviceid%/DBus; Publish device/%deviceid%/Status {"clientId":"%deviceid%","connected":1,"version":"v1.0 ALPHA","services":{"wr":"pvinverter"}} ENDON ON Event#DBusInfo#deviceInstance#wr DO mem2 %value% ENDON ON Energy#Power[1] DO Backlog Publish W/%mem1%/pvinverter/%mem2%/Ac/Power {"value": %value%}; Publish W/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Power {"value": %value%} ENDON
- What happens:
- Line 1, after system init
- mem1 will be set to your VRM device ID, for example
7687sadiusad7
- mem3 will be set to the phase where the solar pannels are installed on, for example
2
- SetOption129 tells Tasmota to calculate the totalEnergy for
Lout<x>
separately.
- mem1 will be set to your VRM device ID, for example
- Line 2, after the MQTT connection is established
- Tasmota subscribes to
device/%deviceid%/DBus
, where%deviceid%
is the automatically generated unique Tasmota deviceID - Tasmota publishes to the topic
device/%deviceid%/Status
with the payload{"clientId":"%deviceid%","connected":1,"version":"v1.0 ALPHA","services":{"wr":"pvinverter"}}
- Tasmota subscribes to
- Line 3, after topic
device/%deviceid%/DBus
has updated- the Victron system has generated a instance ID for the new pv-inverter. Tasmota will read it and write it to
mem2
- the Victron system has generated a instance ID for the new pv-inverter. Tasmota will read it and write it to
- Line 4, after every update of
Power[1]
(Lout1) This will be several time per second!- Tasmota will publish the new value of
Power[1]
to the topicsW/%mem1%/pvinverter/%mem2%/Ac/Power
andW/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Power
With this example you will have added a working pv-inverter to your Victron system. There is one small downside: Because it updates so often, it will produce some traffic.
- Tasmota will publish the new value of
- Line 1, after system init
- minimal example where the solar modules are connected to Lout1 on an Sonoff DUAL R3. Copy the whole rule and paste it to the console, change and <phase[1,2,3]> to your needs, than press
- Consoles > Console
Here is a list of some Rules for different purposes with just a little explanation.
Transmit a lot more information:
Rule1
ON System#Init DO Backlog mem1 <VRM deviceID>; mem3 <phase[1,2,3]>; mem4 <kWpMax>; PowerDelta 101; TelePeriod 0 ENDON
ON mqtt#connected DO Backlog Subscribe DBusInfo, device/%deviceid%/DBus; Publish device/%deviceid%/Status {"clientId":"%deviceid%","connected":1,"version":"v1.0 ALPHA","services":{"wr":"pvinverter"}} ENDON
ON Event#DBusInfo#deviceInstance#wr DO mem2 %value% ENDON
ON System#Boot DO Publish W/%mem1%/pvinverter/%mem2%/Ac/MaxPower {"value": %mem4%} ENDON
ON Energy#Power[1] DO Backlog Publish W/%mem1%/pvinverter/%mem2%/Ac/Power {"value": %value%}; Publish W/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Power {"value": %value%} ENDON
ON Energy#Current[1] DO Publish W/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Current {"value": %value%} ENDON
ON Energy#Voltage DO Publish W/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Voltage {"value": %value%} ENDON
ON Energy#Total DO Backlog Publish W/%mem1%/pvinverter/%mem2%/Ac/Energy/Forward {"value": %value%}; Publish W/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Energy/Forward {"value": %value%} ENDON
mem4: max pv-inverter power. Example: mem4 1.2
Current, Voltage and totalEnergy will be transmitted.
Transmit in an interval (10 and 3600 seconds):
Rule1
ON System#Init DO Backlog mem1 <VRMdeviceID>; mem3 <phase[1,2,3]>; SetOption129 1, TelePeriod 10 ENDON
ON mqtt#connected DO Backlog Subscribe DBusInfo, device/%deviceid%/DBus; Publish device/%deviceid%/Status {"clientId":"%deviceid%","connected":1,"version":"v1.0 ALPHA","services":{"wr":"pvinverter"}} ENDON
ON Event#DBusInfo#deviceInstance#wr DO mem2 %value% ENDON
ON Tele-Energy#Power[1] DO Backlog Publish W/%mem1%/pvinverter/%mem2%/Ac/Power {"value": %value%}; Publish W/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Power {"value": %value%} ENDON
With TelePeriod 10
data will be send every 10 seconds.
Notice the leading Tele-
Transmit in an interval < 10 seconds:
Rule1
ON System#Init DO Backlog mem1 <VRMdeviceID>; mem3 <phase[1,2,3]>; mem5 <intervall> ENDON
ON mqtt#connected DO Backlog Subscribe DBusInfo, device/%deviceid%/DBus; Publish device/%deviceid%/Status {"clientId":"%deviceid%","connected":1,"version":"v1.0 ALPHA","services":{"wr":"pvinverter"}} ENDON
ON Event#DBusInfo#deviceInstance#wr DO mem2 %value% ENDON
ON Rules#Timer=1 DO Backlog Publish W/%mem1%/pvinverter/%mem2%/Ac/Power {"value": %var1%}; Publish W/%mem1%/pvinverter/%mem2%/Ac/L%mem3%/Power {"value": %var1%}; RuleTimer1 %mem5% ENDON
ON Energy#Power DO var1 %value% ENDON