question

pirx avatar image
pirx asked

ModbusTCP. Cannot read majority of registers.

I'm not new to ModbusTCP, but a newbe using it with Victron. I'v got a ESS config consisting of a MultiPlus II, CCGX, EM24 and BYD B-box Pro.

I'm using Modbus out of OpenHAB installation. The purpose is to visualize some ESS data and change the charge and discharge behavior of the storage in some rare situation. I.e. I don't want to charge my electric car from my house batteries.

However, I was able to read only very few registers. The device class com.victronenergy.system seems to work corectly. I can as well access com.victronenergy.settings, but the results have no meaning and the system is not reacting on changes. I.e. I've set "ESS max discharge current" to 0 (to stop discharging) without any effects. The question is why?

What really hits me is that I get error 0x0A (GatewayPathUnavailable - no device found)) when reading com.victronenergy.vebus or com.victronenergy.battery.

What's wrong here?



Multiplus-IICCGX Color ControlModbus TCP
1578495650940.png (1.4 KiB)
1578495783862.png (1.4 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
pirx avatar image
pirx answered ·

I'sorry but I already found my mistake. It was the wrong device ID.

The question can be closed.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

Thanks for confirming; thats what I was about to suggest ;o)

0 Likes 0 ·
matt1309 avatar image
matt1309 answered ·
@Pirx Hey I'm aiming to do the same as what you have accomplished. However I'm miles behind. Would yuou mind sharing your openhab.thing for the modbus binding.
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

pirx avatar image
pirx answered ·

@matt1309, here is part of my modbus.thing:

//-----
//
// Victron CCGX
//
//
Bridge modbus:tcp:ccgx [ host="192.168.178.13", port=502, id=0 ] {

    Bridge poller holding1 [ start=842, length=2, refresh=5000, type="holding" ] {
        Thing data BAT_ChargeLevel  [ readStart="842", readValueType="int16", writeStart="842", writeValueType="int16", writeType="holding" ]
        Thing data BAT_SoC          [ readStart="843", readValueType="uint16", writeStart="843", writeValueType="int16", writeType="holding" ] 
    }

    Bridge poller holding2 [ start=817, length=6, refresh=5000, type="holding" ] {
        Thing data AC_consumption_L1 [ readStart="817", readValueType="uint16" ]
        Thing data AC_consumption_L2 [ readStart="818", readValueType="uint16" ]
        Thing data AC_consumption_L3 [ readStart="819", readValueType="uint16" ]
        Thing data Grid_L1 [ readStart="820", readValueType="int16" ]
        Thing data Grid_L2 [ readStart="821", readValueType="int16" ]
        Thing data Grid_L3 [ readStart="822", readValueType="int16" ]
    }

    Bridge poller holding3 [ start=2702, length=3, refresh=50000, type="holding" ] {
        Thing data MaxDischargePrct [ readStart="2702", readValueType="uint16", writeStart="2702", writeValueType="int16", writeType="holding" ]
        Thing data ControlLoopSetpoint [ readStart="2703", readValueType="int16", writeStart="2703", writeValueType="int16", writeType="holding" ]
        Thing data MaxDischargeCurrent [ readStart="2704", readValueType="uint16", writeStart="2704", writeValueType="int16", writeType="holding" ] 
    }

    Bridge poller holding4 [ start=2901, length=1, refresh=50000, type="holding" ] {
        Thing data BAT_MinimumSoC [ readStart="2901", readValueType="uint16", readTransform="JS(divide_by_10.js)", 
                    writeStart="2901", writeValueType="int16", writeType="holding", writeTransform="JS(multiply_by_10.js)" ] 
    }
} 

//-----
//
// Victron Grid Meter
//
//
Bridge modbus:tcp:grid [ host="192.168.178.13", port=502, id=30 ] {

    Bridge poller holding30 [ start=2622, length=12, refresh=60000, type="holding" ] {
        Thing data EnergyFromGrid_L1 [ readStart="2622", readValueType="uint32", readTransform="JS(divide_by_100.js)"]
        Thing data EnergyFromGrid_L2 [ readStart="2624", readValueType="uint32", readTransform="JS(divide_by_100.js)"]
        Thing data EnergyFromGrid_L3 [ readStart="2626", readValueType="uint32", readTransform="JS(divide_by_100.js)"]
        Thing data EnergyToGrid_L1 [ readStart="2628", readValueType="uint32", readTransform="JS(divide_by_100.js)"]
        Thing data EnergyToGrid_L2 [ readStart="2630", readValueType="uint32", readTransform="JS(divide_by_100.js)"]
        Thing data EnergyToGrid_L3 [ readStart="2632", readValueType="uint32", readTransform="JS(divide_by_100.js)"]
    }
}

Do you need more?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·
You absolute hero! Unfortunately/fortunately I managed to work it out before seeing this post but thank you so much, very useful, couldn't find an example anywhere else online!!


Random one but dont suppose you've ever tried spoofing tank level results. From what I've seen the modbus for tank measurements is read only but I would like to integrate a DIY tank monitor and wondered if modbus was my route?

0 Likes 0 ·