Marstek Battery plugin Topic is solved

Python and python framework

Moderator: leecollings

RNEE
Posts: 30
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Eindhoven area
Contact:

Re: Marstek Battery plugin

Post by RNEE »

It Works !!!!

:shock: :shock: :shock: :shock:

But not exactly how i want it :
Image

Image

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 :
Image
Domoticz on Docker on Raspberry PI 5 with 500 Gb NvME|Milight|RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya|deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus |MQTTMapper|
FlyingDomotic
Posts: 384
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Marstek Battery plugin

Post 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.
RNEE
Posts: 30
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Eindhoven area
Contact:

Re: Marstek Battery plugin

Post 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)!

Image

SOC works great , but flow is the problem now
Domoticz on Docker on Raspberry PI 5 with 500 Gb NvME|Milight|RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya|deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus |MQTTMapper|
User avatar
waltervl
Posts: 5881
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Marstek Battery plugin

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
RNEE
Posts: 30
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Eindhoven area
Contact:

Re: Marstek Battery plugin

Post 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 !
Domoticz on Docker on Raspberry PI 5 with 500 Gb NvME|Milight|RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya|deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus |MQTTMapper|
RNEE
Posts: 30
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Eindhoven area
Contact:

Re: Marstek Battery plugin

Post 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 MQTTWrapper 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!
Domoticz on Docker on Raspberry PI 5 with 500 Gb NvME|Milight|RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya|deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus |MQTTMapper|
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest