Page 3 of 3
Re: Marstek Battery plugin
Posted: Saturday 12 July 2025 21:50
by RNEE
It Works !!!!
But not exactly how i want it :
I tried to create an entry in MqttmMapper.Json for the Battery_SOC but it results in a duplicate key ??
Code: Select all
{
"MPWR": {
"topic": "Marstek",
"type": "243", "subtype": "29", "switchtype": "0",
"mapping": {"item": "params/r_data/2/value", "multiplier": 0.001, "digits": 3}
},
"MSOC": {
"topic": "Marstek",
"type": "243", "subtype": "6", "switchtype": "0",
"mapping": {"item": "params/r_data/1/value", "multiplier": 1, "digits": 1}
}
}
These devices :

Re: Marstek Battery plugin
Posted: Saturday 12 July 2025 23:21
by FlyingDomotic
MqttMapper uses topic as key for each created device, which is a constant (while device name can easily be changed).
Drawback is that when you create two (or more) devices with the same topic, you get duplicate values.
There's a way to fix this: using the "key" item. For example:
Code: Select all
{
"MPWR": {
"topic": "Marstek",
"key": "Marstek/2",
"type": "243", "subtype": "29", "switchtype": "0",
"mapping": {"item": "params/r_data/2/value", "multiplier": 0.001, "digits": 3}
},
"MSOC": {
"topic": "Marstek",
"key": "Marstek/6",
"type": "243", "subtype": "6", "switchtype": "0",
"mapping": {"item": "params/r_data/1/value", "multiplier": 1, "digits": 1}
}
}
Key can be absolutely anything, it must just be unique in the configuration file, and is linked to the device (if you change it, a new device will be created). Here, I choose to name them after topic and r_data index.
Re: Marstek Battery plugin
Posted: Sunday 13 July 2025 10:43
by RNEE
Oke this works and the data are flowing in.
Problem is the way the enery flow to/from the battery :
Code: Select all
{
"MPWR": {
"topic": "Marstek",
"key":"MPWR",
"type": "248", "subtype": "1", "switchtype": "0",
"mapping": {"item": "params/r_data/2/value", "multiplier": 1, "digits": 1}
},
"MSOC": {
"topic": "Marstek",
"key":"MSOC",
"type": "243", "subtype": "6", "switchtype": "0",
"mapping": {"item": "params/r_data/1/value", "multiplier": 1, "digits": 1}
}
}
In this case the battery is loading ( - minus sign)!
SOC works great , but flow is the problem now
Re: Marstek Battery plugin
Posted: Sunday 13 July 2025 10:53
by waltervl
What is the Watt value in MQTT in this case? Also minus? Perhaps you have to change the Domoticz kWh device to generating?
Re: Marstek Battery plugin
Posted: Sunday 13 July 2025 11:23
by RNEE
The value in Mqtt message is -negative (minus)
This can't be changed.
I used device type : 248/1/0
i cant change any device setting
When changing to type : 243/29/0 i get 2 values , both negative.
I can change the setting to usage/return and from device /calculated.
But changing these values has no effect.
Edit :
Maybe we need a battery device in Domoticz ?
Editje :
There isn't even a Battery icon..
Edit 2 : SOLVED
I set the mapping / multiplier to -1
now it works !
Re: Marstek Battery plugin
Posted: Sunday 13 July 2025 12:05
by RNEE
Wrapping up
Many thankx to Waltervl and the author of the MQTTMapper plugin : FlyingDomotic
I used the PUSR-DR134 , a € 15,-- device witch polls on a RS485 connection the Modbusdevice (in this case the Marstek Venus E battery) and sends (over Lan) the requested registerdata to a MQTT Broker, in my case Mosquito.
It is easy and fast to setup. You need a suitable cable (this is easy but tricky) and the modbus registeradresses of the device!
The Domoticz plugin MQTTMapper reads the message on the broker (Mosquito) and creates , feeds the Domoticz devices from a json device description file.
I had NO knowlegde of Modbus, MQTT messaging, Mosquito etc before.
My knowledge of Domoticz is very basic and i use my knowledge once a year...
Had i know things before i should have been able to setup this up in less than an hour.
Some things still have to be done (like the Wifi device , sending commands, using more registers etc ).
I think the combination of the PUSR-DR134 and MQTTMapper are a great enhancement for the simple use of Modbus devices in Domoticz (Solarconvertors , Battery and other machinery)
With this combination you can have live data from your own device and don't need an API from a venders website or a dedicated plugin for your device anymore!