Modbus E3/DC photovoltaic system Uint8+Uint8

Tags: #<Tag:0x00007f2fbe098338> #<Tag:0x00007f2fbe093d60>

Hi guys

I’m tying to integrate the values of an E3/DC photoviltaic system. There are some uint32 and uint16 figures I can integrate without problem.

Manual in German:
http://www.loxwiki.eu/download/attachments/9339566/ModuBus-Dokumentation_2016-08-05.pdf?version=1&modificationDate=1471507657000&api=v2

Nevertheless there are challenging concatenated figures based on type uint8+uint8:

Name: autarky and self-consumption (“Autarkie und Eigenverbrauch in Prozent”)
Register: 40082
Length: 1
Type: Uint8+Uint8

I use the following configuration:

modbus.cfg

tcp.e3dc04.connection=192.168.86.45:502:60:0:0:3:500
tcp.e3dc04.id=1
tcp.e3dc04.type=holding
tcp.e3dc04.start=40081
tcp.e3dc04.length=1
tcp.e3dc04.valuetype=uint16

modbus.items

Number num_modb_autarky_selfcons_int 		"Autarky Self-Consumption (int) [%d]"	  { modbus="e3dc04:0" }
Number num_modb_autarky					"Autarky [%d]"
Number num_modb_selfconsumption			"Self-Consumption[%d]"

modbus.rules

rule "Convert num_modb_autarky_selfcons_int"
    when
        Item  num_modb_autarky_selfcons_int received update
    then
	postUpdate(num_modb_autarky, ???)
    end

rule "Convert num_modb_autarky_selfcons_int"
    when
        Item  num_modb_autarky_selfcons_int received update
    then
	postUpdate(num_modb_selfconsumption, ???)
    end

How do I need to transform the initial value ("???") ?

Right know autoraky should be 100% and the value for num_modb_autarky_selfcons_int shows “25620”. So how do I get from 25620 to 100?

Thank you!

Not all the usual tools to do this are easily available in Rules, simplest to use arithmetic perhaps. Divide by 256 and get integer result for “top byte”. Multiply that by 256 and subtract from original (16bit) value for “lower byte” ?

thanks for your input. I think this approach does not work, does it? If both values are 100% the initial value would look like 256256, right? So dividing this value by 256 does not work to get the first value.

Yes it does, so long as you use the integer part of the result and discard the decimal point part.

Hi !
I am just working on this too - as I own the e3dc too.
Question: The doc says 40082 but you are writing 40081 … Is this a typo or done with a good reason??

Michael

Modbus registers are officially numbered starting from 1 (one).
Modbus protocol addresses the same registers starting from 0 (zero).
Some care is needed to work out which scheme is being referred to in any given documents.

The OH Modbus binding uses addresses start-from-zero
Sometimes you will have to take a N-1 approach to translate a given register number into register address.

1 Like

Hi,
I am still working on this.

Could you share some of your results ??
I am struggeling with the display of the values — a negative is shown as a large value, so the datatypes do not match

Michael

Hallo zusammen, ich habe erstmal mit folgenden Werten ein brauchbares Ergebnis.

modbus.cfg:

tcp.e3dc01.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc01.id=1
tcp.e3dc01.type=holding
tcp.e3dc01.start=40067
tcp.e3dc01.length=1
tcp.e3dc01.valuetype=int16

tcp.e3dc02.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc02.id=1
tcp.e3dc02.type=holding
tcp.e3dc02.start=40069
tcp.e3dc02.length=2
tcp.e3dc02.valuetype=int16

tcp.e3dc03.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc03.id=1
tcp.e3dc03.type=holding
tcp.e3dc03.start=40071
tcp.e3dc03.length=2
tcp.e3dc03.valuetype=int16

tcp.e3dc04.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc04.id=1
tcp.e3dc04.type=holding
tcp.e3dc04.start=40073
tcp.e3dc04.length=2
tcp.e3dc04.valuetype=int16

tcp.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc05.id=1
tcp.e3dc05.type=holding
tcp.e3dc05.start=40081
tcp.e3dc05.length=2
tcp.e3dc05.valuetype=uint8

tcp.e3dc06.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc06.id=1
tcp.e3dc06.type=holding
tcp.e3dc06.start=40082
tcp.e3dc06.length=1
tcp.e3dc06.valuetype=uint16

tcp.e3dc05a.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc05a.id=1
tcp.e3dc05a.type=holding
tcp.e3dc05a.start=40081
tcp.e3dc05a.length=1
tcp.e3dc05a.valuetype=uint8

tcp.e3dc05b.connection=10.0.0.128:502:60:0:0:3:500
tcp.e3dc05b.id=1
tcp.e3dc05b.type=holding
tcp.e3dc05b.start=40081
tcp.e3dc05b.length=1
tcp.e3dc05b.valuetype=uint8

modbus.items:

Number num_modb_solar_power_int                 "Produktion (int) [%s]"   { modbus="e3dc01:0" }
Number num_modb_battery_power_int               "Laden (int) [%s]"        { modbus="e3dc02:0" }
Number num_modb_home_power_int          "Hausverbrauch (int) [%s]"        { modbus="e3dc03:0" }
Number num_modb_net_power_int           "Netz (int) [%s]"         { modbus="e3dc04:0" }
Number num_modb_autarky                                 "Autarky [%d]"    { modbus="e3dc05b:1" }
Number num_modb_selfconsumption                 "Self-Consumption[%d]"    { modbus="e3dc05:0" }
Number num_modb_battery_int             "SOC (int) [%s]"          { modbus="e3dc06:0" }
2 Likes

@MvF solution works for me.

I asked E3DC for an updated version of the modbus doc -> http://s000.tinyupload.com/index.php?file_id=00971933583596947262 . No major changes just more details.

I added the emergency power state there as well (replace “192.168.178.45” with your E2DC ip)

modbus.cfg

// Inverter in Watt
tcp.e3dc01.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc01.id=1
tcp.e3dc01.type=holding
tcp.e3dc01.start=40067
tcp.e3dc01.length=1
tcp.e3dc01.valuetype=int16

// Battery in Watt (negative=discharge)
tcp.e3dc02.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc02.id=1
tcp.e3dc02.type=holding
tcp.e3dc02.start=40069
tcp.e3dc02.length=2
tcp.e3dc02.valuetype=int16

// Domestic Consumption in Watt
tcp.e3dc03.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc03.id=1
tcp.e3dc03.type=holding
tcp.e3dc03.start=40071
tcp.e3dc03.length=2
tcp.e3dc03.valuetype=int16

// Grid in Watt (negative=NetIn)
tcp.e3dc04.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc04.id=1
tcp.e3dc04.type=holding
tcp.e3dc04.start=40073
tcp.e3dc04.length=2
tcp.e3dc04.valuetype=int16

// Autarky and Self-Consumption in %
tcp.e3dc05.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc05.id=1
tcp.e3dc05.type=holding
tcp.e3dc05.start=40081
tcp.e3dc05.length=2
tcp.e3dc05.valuetype=uint8

// Autarky in %
tcp.e3dc05a.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc05a.id=1
tcp.e3dc05a.type=holding
tcp.e3dc05a.start=40081
tcp.e3dc05a.length=1
tcp.e3dc05a.valuetype=uint8

// Self-Consuption in %
tcp.e3dc05b.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc05b.id=1
tcp.e3dc05b.type=holding
tcp.e3dc05b.start=40081
tcp.e3dc05b.length=1
tcp.e3dc05b.valuetype=uint8

// Battery SOC in %
tcp.e3dc06.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc06.id=1
tcp.e3dc06.type=holding
tcp.e3dc06.start=40082
tcp.e3dc06.length=1
tcp.e3dc06.valuetype=uint16

// Emergency-Power Status
tcp.e3dc07.connection=192.168.178.45:502:60:0:0:3:500
tcp.e3dc07.id=1
tcp.e3dc07.type=holding
tcp.e3dc07.start=40083
tcp.e3dc07.length=1
tcp.e3dc07.valuetype=uint16

modbus.items

Number E3DC_solar_power_int "Solarproduction [%s Watt]" <batterylevel> { modbus="e3dc01:0" }
Number E3DC_battery_power_int "Battery (Charge) [%s kWh]" <batterylevel> { modbus="e3dc02:0" }
Number E3DC_home_power_int "Consumption [%s Watt]" <batterylevel> { modbus="e3dc03:0" }
Number E3DC_net_power_int "NetIn [%s kWh]" <batterylevel> { modbus="e3dc04:0" }
Number E3DC_autarky "Autarky [%d %%]" <batterylevel> { modbus="e3dc05b:1" }
Number E3DC_selfconsumption "Self-Consumption [%d %%]" <batterylevel> { modbus="e3dc05:0" }
Number E3DC_battery_int  "Battery [%s %%]" <batterylevel> { modbus="e3dc06:0" }
Number E3DC_emergency_power_state  "Emergency power [MAP(e3dc-eps.map):%s]" { modbus="e3dc07:0" }

e3dc-eps.map

0=Not supported
1=Active
2=Inactive
3=n/a
4=Motor switch misaligned
1 Like