Integracja Modbus i licznik energii SDM630

Dajesz część konfiguracji a nie całość dotyczą modbusa (zaczyna sie od - type) , nie wiem co jest w 29 linii konfiguracji (tu zaczyna sie błąd) a szklanej kuli nie mam więc rozwiązania nie wyczaruję :grin:. Popraw, zacznij od najprostszej konfigurachi (bez include) i zobacz czy działa.

tak wygląda cały plik


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Example configuration.yaml entry


automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
climate: !include climate.yaml
#modbus: !include modbus.yaml

sensor:
  - platform: solarman
    name: Solarman
    inverter_host: 192.168.3.21
    inverter_port: 8899
    inverter_serial: 2103688716
    inverter_mb_slaveid: 1
    lookup_file: sofar_lsw3.yaml

modbus:
  - name: sdm630
    retries: 10
    delay: 10
    message_wait_milliseconds: 1000
    timeout: 10
    type: tcp
    host: 192.168.3.254
    sensors: !include sdm630_addresses.yaml

a yaml wyglada tak

sensors:
  - address: 0
    count: 2
    data_type: float32
    input_type: input
    name: Phase 1 line to neutral volts
    precision: 2
    slave: 1
    unit_of_measurement: Volts
  - address: 2
    count: 2
    data_type: float32
    input_type: input
    name: Phase 2 line to neutral volts
    precision: 2
    slave: 1
    unit_of_measurement: Volts
  - address: 4
    count: 2
    data_type: float32
    input_type: input
    name: Phase 3 line to neutral volts
    precision: 2
    slave: 1
    unit_of_measurement: Volts
  - address: 6
    count: 2
    data_type: float32
    input_type: input
    name: Phase 1 current
    precision: 2
    slave: 1
    unit_of_measurement: Amps

błędy są takie

Ostrzeżenia konfiguracji
Invalid config for 'modbus' at configuration.yaml, line 28: required key 'port' not provided
Invalid config for 'modbus' at configuration.yaml, line 35: 'sensors' is an invalid option for 'modbus', check: modbus->0->sensors->0->sensors
Invalid config for 'modbus' at configuration.yaml, line 35: required key 'address' not provided
Invalid config for 'modbus' at configuration.yaml, line 35: required key 'name' not provided

Gdybyś tego posłuchał!!!
Po include w efekcie masz dwa razy po sobie wpis sensors:sensors:


automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
climate: !include climate.yaml
#modbus: !include modbus.yaml

sensor:
  - platform: solarman
    name: Solarman
    inverter_host: 192.168.3.21
    inverter_port: 8899
    inverter_serial: 2103688716
    inverter_mb_slaveid: 1
    lookup_file: sofar_lsw3.yaml

modbus:
  - name: sdm630
    retries: 10
    delay: 10
    message_wait_milliseconds: 1000
    timeout: 10
    type: tcp
    host: 192.168.3.254
    sensors: 
      - address: 0
        count: 2
        data_type: float32
         input_type: input
         name: Phase 1 line to neutral volts
         precision: 2
         slave: 1
         unit_of_measurement: Volts

…albo zakomentuj w yamlu drugi

# sensors:
1 polubienie

Po zmianie


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Example configuration.yaml entry


automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
climate: !include climate.yaml
#modbus: !include modbus.yaml

sensor:
  - platform: solarman
    name: Solarman
    inverter_host: 192.168.3.21
    inverter_port: 8899
    inverter_serial: 2103688716
    inverter_mb_slaveid: 1
    lookup_file: sofar_lsw3.yaml

modbus:
  - name: sdm630
    retries: 10
    delay: 10
    message_wait_milliseconds: 1000
    timeout: 10
    type: tcp
    host: 192.168.3.254
    sensors:
      - address: 0
        count: 2
        data_type: float32
        input_type: input
        name: Phase 1 line to neutral volts
        precision: 2
        slave: 1
        unit_of_measurement: Volts
      - address: 2
        count: 2
        data_type: float32
        input_type: input
        name: Phase 2 line to neutral volts
        precision: 2
        slave: 1
        unit_of_measurement: Volts
      - address: 4
        count: 2
        data_type: float32
        input_type: input
        name: Phase 3 line to neutral volts
        precision: 2
        slave: 1
        unit_of_measurement: Volts
      - address: 6
        count: 2
        data_type: float32
        input_type: input
        name: Phase 1 current
        precision: 2
        slave: 1
        unit_of_measurement: Amps

takie uwagi

Ostrzeżenia konfiguracji
Invalid config for 'modbus' at configuration.yaml, line 28: required key 'port' not provided
Invalid config for 'modbus' at configuration.yaml, line 36: Phase 1 line to neutral volts: `count` illegal with `data_type: float32` 'modbus->0->sensors->0', got {'address': 0, 'count': 2, 'data_type': 'float32', 'input_type': 'input', 'name': 'Phase 1 line to neutral volts', 'precision': 2, 'slave': 1, 'unit_of_measurement': 'Volts'}
Invalid config for 'modbus' at configuration.yaml, line 44: Phase 2 line to neutral volts: `count` illegal with `data_type: float32` 'modbus->0->sensors->1', got {'address': 2, 'count': 2, 'data_type': 'float32', 'input_type': 'input', 'name': 'Phase 2 line to neutral volts', 'precision': 2, 'slave': 1, 'unit_of_measurement': 'Volts'}
Invalid config for 'modbus' at configuration.yaml, line 52: Phase 3 line to neutral volts: `count` illegal with `data_type: float32` 'modbus->0->sensors->2', got {'address': 4, 'count': 2, 'data_type': 'float32', 'input_type': 'input', 'name': 'Phase 3 line to neutral volts', 'precision': 2, 'slave': 1, 'unit_of_measurement': 'Volts'}
Invalid config for 'modbus' at configuration.yaml, line 60: Phase 1 current: `count` illegal with `data_type: float32` 'modbus->0->sensors->3', got {'address': 6, 'count': 2, 'data_type': 'float32', 'input_type': 'input', 'name': 'Phase 1 current', 'precision': 2, 'slave': 1, 'unit_of_measurement': 'Amps'}

To je uwzględnij i popraw

Hint 1
count wyklucza się z data_type

Hint 2
i tak najpierw musisz prawidłowo skonfigurować huba modbus

Brakuje także wymaganego parametru port w konfiguracji modbus.

To już poprawiłem bo przy modyfikacjach przez przypadek usunąłem.

W zasadzie wszystko ruszyło.

Mam tylko jedno pytanie jak utworzyć dla tej integracji unikalny identyfikator aby można było edytować encje?

@RobinI30 bo Ty Modbusa ogarniesz najlepiej:
licznik SDM630 Modbus V2, taka definicja rejestru:


//---------------------------------------------------------------------------------------------------------------------------------------------------------------------
//      REGISTER NAME                                 REGISTER ADDRESS              UNIT        | SDM630  | SDM230  | SDM220  | SDM120CT| SDM120  | SDM72D  | SDM72 V2|
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------
#define SDM_TOTAL_ACTIVE_ENERGY                       0x0156                    //  kWh         |    1    |    1    |    1    |    1    |    1    |    1    |    1    |

próbuję odczytać w HA za pomocą takiej definicji encji:

#   SDM_TOTAL_ACTIVE_ENERGY:
      - name: sdm_total_active_energy
        unit_of_measurement: kWh
        device_class: energy
        slave: 1
        address: 342
        input_type: input
        data_type: float32

ale pobierana wartość jest błędna, co robię źle?

Adres 342 to to jest total import + export (czyli bilans) - czytaj z adresu 72
sdm

1 polubienie