Modbus TCP

Great! It does look like some problems internally but I suggest you try to read the register in HA and see what that generates in the log as well?

OR…is that while you are reading the register?

I dont see any reference to register: 843 in the log though?

This is what I found:

  1. BMV

  2. Quattro

I had a crach of the sd card and no recent backup (stupid me) so I had to reinstall HASSIO.

This is a part of the new config:

modbus:
    name: victron
    host: 192.168.93.101
    type: tcp
    port: 502
  - platform: modbus
    registers:
      - name: "test"
        hub: victron
        unit_of_measurement: "W"
        slave: 100
        register: 843

The last lines of the logfile are:

2019-09-04 15:04:57.940582500 ERROR 2019-09-04T15:04:57.940 Unkown modbus address:  843
2019-09-04 15:04:57.943542500 ERROR 2019-09-04T15:04:57.942 "Error processing function code 3, unit id 100, src 192.168.93.158, start address 843, quantity 1 :" "Unit id is available, but start address does not exist"
2019-09-04 15:05:10.690460500 ERROR 2019-09-04T15:05:10.689 Unkown modbus address:  843
2019-09-04 15:05:10.693359500 ERROR 2019-09-04T15:05:10.692 "Error processing function code 3, unit id 100, src 192.168.93.158, start address 843, quantity 1 :" "Unit id is available, but start address does not exist"
1 Like

I think you want to pull SOC from the BMV not the system (slave 100)
It should be.


        unit_of_measurement: "%"
        slave: 245
        register: 266
        data_type: uint
        scale: ??

I figured out why I personally can’t get SOC to pull into HA. I don’t have a BMV therefore don’t even get SOC on the battery icon of the main UI screen. This further supports my suggestion above. If one could pull SOC from the 100/800 range, my GX would show it. It doesn’t. SOC must be pulled directly from the BMV.
image

2 Likes

@emence So it appears to me that the communications from HA is working fine but there is an issue within your device…maybe as @butter_fry has said you need to be reading from a different slave address?

But I really can’t help much more with this as I don’t have access to your devices.
Keep checking your logs to get this problem sorted as they seem to give good feedback.

Thank you, I will.

1 Like

If/as you make progress please post here so others can benefit from your solution or comment as you progress.

1 Like

Thank you very mutch. It is working now.

Can you explain me how you get the number of the slave : 245 ?

Here is the config that works now:

modbus:
    name: victron
    host: 192.168.93.101
    type: tcp
    port: 502
  - platform: modbus
    registers:
      - name: "Soc"
        hub: victron
        data_type: uint
        unit_of_measurement: "%"
        slave: 245
        register: 266
        scale: 0.1
      - name: "Voltage"
        hub: victron
        unit_of_measurement: "V"
        slave: 245
        register: 259        
        scale: 0.01
2 Likes

@emence There are tabs on the excel document (CCGX-Modbus-TCP-register-list.xlsx) that you have. On the Unit ID mapping tab you can find the map from the DeviceInstance (the question I asked you above where you posted the screenshot with the Apparaatnummer of BMV and Quattro.

258 = UnitID 245
257 = UnitID 246

Each device type has its own Address/Register range. See column A in Field List. Notie the service name. The top register set is ‘system’. The one you’re interested in is labeled battery, or BMV range from address 259 - 326.

Think of the UnitID/slave number as the way a device communicates. Since there are multiple ways that Victron devices can hook into (wireless/LAN/VE.Can/VE.Direct) a CCGX sometimes the slave/Unitid will be different depending on the way it’s connected. That’s why I asked you, and that is also why it isn’t just hard coded into the device. The UnitID can change depending on the communication method AND how many other devices share that connection method and what gets plugged in first. All quite confusing I know. Also, you might hook two totally different device types up to a CCGX in two different systems. On one system a UnitID for the solar charger might be swapped with the BMV.

At least that is how I understand it all after a few days of trial and error.

Now i’m looking for someone who’s built a good interface. Here’s what I’ve got so far:

I need a way to translate the Battery Charge State (not SOC) from numerical to 3.Bulk/4.Absorb/5.float/0.off

1 Like

Great result! Well explained by you @butter_fry

Thanks for the great explanation.

In a few days I will return to the boat and continue experimenting with the interface and the config.
I will keep on publishing all positive results

2 Likes

Glad you guys found it useful. If you notice anyone with a good UI config I’m interested!

1 Like

You need a template sensor to do that see here and checkout the " MULTILINE EXAMPLE WITH AN IF TEST" I believe that will give you what you need?

1 Like

@wellsy Yup, that’s it here it is for posterity. All the Victron chargers appear to be the same.

Modbus sensor for Battery Charger State. Named bcs for brevity.

  - platform: modbus
    scan_interval: 2
    registers:
    - name: bcs
      hub: victronsolar
      slave: 239
      data_type: uint
      register: 775           

Template Sensor configuration for Victron Solar charger

  - platform: template
    sensors:
      charger:
        friendly_name: "Charger State"
        value_template: >-
          {% if is_state('sensor.bcs', '0') %}
            Off
          {% elif is_state('sensor.bcs', '2') %}
            Fault 
          {% elif is_state('sensor.bcs', '3') %}
            Bulk
          {% elif is_state('sensor.bcs', '4') %}
            Absorbtion
          {% elif is_state('sensor.bcs', '5') %}
            Float
          {% elif is_state('sensor.bcs', '6') %}
            Storage
          {% elif is_state('sensor.bcs', '7') %}
            Equalize
          {% elif is_state('sensor.bcs', '11') %}
            Other (Hub-1)
          {% elif is_state('sensor.bcs', '252') %}
            External Control   
          {% else %}
            failed
          {% endif %}
2 Likes

That ties it all up nicely!

I need help, I can’t get decimals in my modbus temperature sensor, I have it configured with scale: 0.1 and no decimals appear

Could you post your sensor config please?

com.victronenergy.vebus_Battery temperature_61_int16_10 -3266.8 to 3266.8_/Dc/0/Temperature_no_Degrees celsius

  • platform: modbus
    scan_interval: 1
    registers:
    • name: “Temperatura batería modbus”
      hub: victron
      data_type: uint
      device_class: temperature
      unit_of_measurement: “°C”
      slave: 239
      register: 61
      scale: 0.1

Edit.
I have already found the solution

precision: 1

Well done!
If you want to make this post more useful to others who follow add your updated config and mark it as the solution.

Could really use some help here.
I have an Eastron modbus kwh-meter for my Tesla-charger.
Connected an Elfin EW11 rs485 to tcpip adapter to it.

Figured it would just be a matter of setting a hub to the right ip, port and protocol, add a sensor and be done with it. After 3 hours still nothing.
Even with logging enabled I have no idea if the hub is receiving data, nor can I check it on the Elfin itself.

Does anyone have an Elfin EW11 running in hassio and care to share both the config in hassio as well as on the device itself?

Greatly appreciated!

1 Like