Example configuration: Smart energy meter integration via Modbus RTU

I had a pretty hard time figuring out a working configuration for my Carlo Gavazzi 540 smart meter that I use with my Wallbox Commander (using Modbus RTU). So here is the working config that I ended up with:

modbus:
  - name: hub1
    type: serial
    port: /dev/ttyACM0
    parity: N
    method: rtu
    close_comm_on_error: false
    retry_on_empty: true
    baudrate: 9600
    bytesize: 8
    stopbits: 1
    delay: 0
    timeout: 10
    retries: 4
    sensors:
      - name: CGV-W-Sys
        input_type: input
        slave: 1
        address: 40
        data_type: int32
        scan_interval: 2
        unit_of_measurement: W
        device_class: power
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-Hz-Sys
        input_type: input
        slave: 1
        address: 51
        data_type: int16
        scan_interval: 5
        unit_of_measurement: Hz
        device_class: frequency
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-PF-Sys
        input_type: input
        slave: 1
        address: 49
        data_type: int16
        scan_interval: 5
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-Load-Sys
        input_type: input
        slave: 1
        address: 121
        data_type: int16
        scan_interval: 5
        lazy_error_count: 5
        scale: 0.001
        precision: 2
        swap: word
      - name: CGV-V-L1
        input_type: input
        slave: 1
        address: 0
        data_type: int32
        scan_interval: 15
        unit_of_measurement: V
        device_class: voltage
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-V-L2
        input_type: input
        slave: 1
        address: 2
        data_type: int32
        scan_interval: 15
        unit_of_measurement: V
        device_class: voltage
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-V-L3
        input_type: input
        slave: 1
        address: 4
        data_type: int32
        scan_interval: 15
        unit_of_measurement: V
        device_class: voltage
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-A-L1
        input_type: input
        slave: 1
        address: 12
        data_type: int32
        scan_interval: 15
        unit_of_measurement: A
        device_class: current
        lazy_error_count: 5
        scale: 0.001
        precision: 2
        swap: word
      - name: CGV-A-L2
        input_type: input
        slave: 1
        address: 14
        data_type: int32
        scan_interval: 15
        unit_of_measurement: A
        device_class: current
        lazy_error_count: 5
        scale: 0.001
        precision: 2
        swap: word
      - name: CGV-A-L3
        input_type: input
        slave: 1
        address: 16
        data_type: int32
        scan_interval: 15
        unit_of_measurement: A
        device_class: current
        lazy_error_count: 5
        scale: 0.001
        precision: 2
        swap: word
      - name: CGV-W-L1
        input_type: input
        slave: 1
        address: 18
        data_type: int32
        scan_interval: 15
        unit_of_measurement: W
        device_class: power
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-W-L2
        input_type: input
        slave: 1
        address: 20
        data_type: int32
        scan_interval: 15
        unit_of_measurement: W
        device_class: power
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-W-L3
        input_type: input
        slave: 1
        address: 22
        data_type: int32
        scan_interval: 15
        unit_of_measurement: W
        device_class: power
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - name: CGV-PF-L1
        input_type: input
        slave: 1
        address: 46
        data_type: int16
        scan_interval: 15
        lazy_error_count: 5
        scale: 0.001
        precision: 2
        swap: word
      - name: CGV-PF-L2
        input_type: input
        slave: 1
        address: 47
        data_type: int16
        scan_interval: 15
        lazy_error_count: 5
        scale: 0.001
        precision: 2
        swap: word
      - name: CGV-PF-L3
        input_type: input
        slave: 1
        address: 48
        data_type: int16
        scan_interval: 15
        lazy_error_count: 5
        scale: 0.001
        precision: 2
        swap: word
      - unique_id: CGV-kWh-Pos-Tot
        name: CGV-kWh-Pos-Tot
        input_type: input
        slave: 1
        address: 52
        data_type: int32
        scan_interval: 15
        unit_of_measurement: kWh
        state_class: total_increasing
        device_class: energy
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
      - unique_id: CGV-kWh-Neg-Tot
        name: CGV-kWh-Neg-Tot
        input_type: input
        slave: 1
        address: 78
        data_type: int32
        scan_interval: 15
        unit_of_measurement: kWh
        state_class: total_increasing
        device_class: energy
        lazy_error_count: 5
        scale: 0.1
        precision: 2
        swap: word
1 Like

Hi. Its been ages since you posted this but hopefully you are still active user at the forum.

Could you confirm that you have a wallbox EV-charger with power boost option activated and controlled by the EM540 & you are able to listen to the same traffic with this configuration of yours?

If so, how did you connect the meter to the homeassistant?