Adding New meter to Home Assistant via Modbus/TCP Fail

I have a new Three phase meter and want to add into my Home Assistant via custom component(HACS) -modbus/tcp. 

The first on has been running ok so far by this link 

https://imeter.club/topic/352

but the second add in has always fail with "Unknow error occurred" 

Please suggest


Thread Status
21
271
3
0
0

Sort replies by:



1. Please check if the version of iammeter_modbus you installed through hacs is v1.0.14
2. Please make sure your device is online when adding a device.
3. Also check if the firmware version of your meter is greater than 2.75.92
4. This is a screenshot of my successful addition


I have a new Three phase meter and want to add into my Home Assistant via custom component(HACS) -modbus/tcp. The first on has been running ok so far by this link https://imeter.club/topic/352but the second add in has always fail with "Unknow error occurred" Please suggest

I had try again follow your suggestion but problem still same.

Attached pics for your reference.

Hello, please send me the version number and error log of homeassistant

I guess you want HA version number since meter software and add-on versions all given. 

For Home assistant log, how to sent it to you?


Hello, I have applied for permission to access this log. Please go through the following

Ok here is my home assistant full log.https://drive.google.com/file/d/1gm0mBBcvBojAh7WIS2mTk1b0yZ2RUwWW/view?usp=drive_link

Tonight, After back from work. I try it over again with no error. Everything is working fine. Still doubt what is going on.

Thanks you very much for your support.

Hello.

I have the same problem :( . From the gui:



The version looks recent:

If I try to write the config yaml manulay, there is the same resoult. So, not working. The FW is the latest i.76.058.8, the working mode is iammeter-cloud. MQTT will be an option, but not working with cloud :( . So I need Modbus tcp, because 1 min refresh isn't enoug me from webapi.

HA

  • Core2025.2.5
  • Supervisor2025.06.2
  • Operating System14.2

Log:

Napló: homeassistant
Forrás: custom_components/iammeter_modbus/config_flow.py:49
integráció: IamMeter Modbus (dokumentációproblémák)
Először fordult elő: 2025. július 5. 11:13:00 (47 Események)
Utoljára naplózva: 11:13:01

Error doing job: Task exception was never retrieved (None)

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1309, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1344, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 490, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 84, in async_step_ssdp
    if self._host_in_configuration_exists(friendly_name + "_MB"):
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 62, in _host_in_configuration_exists
    if host in iammeter_modbus_entries(self.hass):
               ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 48, in iammeter_modbus_entries
    return set(
        entry.data[CONF_NAME] for entry in hass.config_entries.async_entries(DOMAIN)
    )
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 49, in <genexpr>
    entry.data[CONF_NAME] for entry in hass.config_entries.async_entries(DOMAIN)
    ~~~~~~~~~~^^^^^^^^^^^
KeyError: 'name'

Thanks

  • Installation methodHome Assistant OS
  • Core2025.6.1
  • Supervisor2025.06.2
  • Operating System15.2
  • Frontend20250531.3

IamMeter Modbus  v1.0.17






I tested it and it is normal. Upgrading your core can solve the problem.

Ok, I'll try to update all, and let you know!

Installation methodHome Assistant OSCore2025.6.1Supervisor2025.06.2Operating System15.2Frontend20250531.3IamMeter Modbus  v1.0.17I tested it and it is normal. Upgrading your core can solve the problem.

Well, Now I have:

  • Core2025.7.1
  • Supervisor2025.06.2
  • Operating System15.2

But the problem is same :O :(

Installation methodHome Assistant OSCore2025.6.1Supervisor2025.06.2Operating System15.2Frontend20250531.3IamMeter Modbus  v1.0.17I tested it and it is normal. Upgrading your core can solve the problem.

With yaml, I have this error when I check the config:


Component error: modbus - cannot import name 'FramerType' from 'pymodbus.framer' (/usr/local/lib/python3.13/site-packages/pymodbus/framer/__init__.py)

This is in my log:

Napló: aiohttp.server
Forrás: /usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py:481
Először fordult elő: 13:05:55 (9 előfordulás)
Utoljára naplózva: 13:06:05

Error handling request from 192.168.1.99

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 83, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 227, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 121, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 336, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 383, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        flow, cur_step["step_id"], user_input
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 487, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 108, in async_step_user
    if self._host_in_configuration_exists(name):
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 62, in _host_in_configuration_exists
    if host in iammeter_modbus_entries(self.hass):
               ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 48, in iammeter_modbus_entries
    return set(
        entry.data[CONF_NAME] for entry in hass.config_entries.async_entries(DOMAIN)
    )
  File "/config/custom_components/iammeter_modbus/config_flow.py", line 49, in <genexpr>
    entry.data[CONF_NAME] for entry in hass.config_entries.async_entries(DOMAIN)
    ~~~~~~~~~~^^^^^^^^^^^
KeyError: 'name'

You can try to delete IamMeter Modbus from hacs, then restart, and then reinstall IamMeter Modbus. Or you can create a new haos in a virtual machine and install IamMeter Modbus through hacs to see if there is still a problem and compare it.

Well, I did everything, but still not working :( . But I tried to make a new docker and from that is working well! It is very interesting. The version is same. How can I find what is the problem?

You can try to delete IamMeter Modbus from hacs, then restart, and then reinstall IamMeter Modbus. Or you can create a new haos in a virtual machine and install IamMeter Modbus through hacs to see if there is still a problem and compare it.

Maybe the problem is with pymodbus version... How can I check which version is installed, or how can I update? When I install your integration from hacs is that installing the pymodbus what it need as well?

And now If I want to use yaml, than this problem showing:


Invalid config for 'modbus' at iammeter_modbus.yaml, line 106: Modbus_Power_B: `count` illegal with `data_type: int32` 'modbus->0->sensors->8', got {'name': 'Modbus_Power_B', 'slave': 1, 'address': 12, 'input_type': 'holding', 'unit_of_measurement': 'W', 'device_class': 'power', 'state_class': 'measurement', 'count': 2, 'scale': 1, 'offset': 0, 'precision': 0, 'data_type': 'int32', 'scan_interval': 1}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 119: Modbus_ImportEnergy_B: `count` illegal with `data_type: uint32` 'modbus->0->sensors->9', got {'name': 'Modbus_ImportEnergy_B', 'slave': 1, 'address': 14, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 131: Modbus_ExportGrid_B: `count` illegal with `data_type: uint32` 'modbus->0->sensors->10', got {'name': 'Modbus_ExportGrid_B', 'slave': 1, 'address': 16, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 143: Modbus_PF_B: `count` illegal with `data_type: uint16` 'modbus->0->sensors->11', got {'name': 'Modbus_PF_B', 'slave': 1, 'address': 18, 'input_type': 'holding', 'device_class': 'power_factor', 'state_class': 'measurement', 'count': 1, 'scale': 0.001, 'offset': 0, 'precision': 2, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 156: Modbus_Voltage_C: `count` illegal with `data_type: uint16` 'modbus->0->sensors->12', got {'name': 'Modbus_Voltage_C', 'slave': 1, 'address': 20, 'input_type': 'holding', 'unit_of_measurement': 'V', 'device_class': 'voltage', 'state_class': 'measurement', 'count': 1, 'scale': 0.01, 'offset': 0, 'precision': 1, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 168: Modbus_Current_C: `count` illegal with `data_type: uint16` 'modbus->0->sensors->13', got {'name': 'Modbus_Current_C', 'slave': 1, 'address': 21, 'input_type': 'holding', 'unit_of_measurement': 'A', 'device_class': 'current', 'state_class': 'measurement', 'count': 1, 'scale': 0.01, 'offset': 0, 'precision': 1, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 180: Modbus_Power_C: `count` illegal with `data_type: int32` 'modbus->0->sensors->14', got {'name': 'Modbus_Power_C', 'slave': 1, 'address': 22, 'input_type': 'holding', 'unit_of_measurement': 'W', 'device_class': 'power', 'state_class': 'measurement', 'count': 2, 'scale': 1, 'offset': 0, 'precision': 0, 'data_type': 'int32', 'scan_interval': 1}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 193: Modbus_ImportEnergy_C: `count` illegal with `data_type: uint32` 'modbus->0->sensors->15', got {'name': 'Modbus_ImportEnergy_C', 'slave': 1, 'address': 24, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 205: Modbus_ExportGrid_C: `count` illegal with `data_type: uint32` 'modbus->0->sensors->16', got {'name': 'Modbus_ExportGrid_C', 'slave': 1, 'address': 26, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 20: Modbus_Current_A: `count` illegal with `data_type: uint16` 'modbus->0->sensors->1', got {'name': 'Modbus_Current_A', 'slave': 1, 'address': 1, 'input_type': 'holding', 'unit_of_measurement': 'A', 'device_class': 'current', 'state_class': 'measurement', 'count': 1, 'scale': 0.01, 'offset': 0, 'precision': 1, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 217: Modbus_PF_C: `count` illegal with `data_type: uint16` 'modbus->0->sensors->17', got {'name': 'Modbus_PF_C', 'slave': 1, 'address': 28, 'input_type': 'holding', 'device_class': 'power_factor', 'state_class': 'measurement', 'count': 1, 'scale': 0.001, 'offset': 0, 'precision': 2, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 230: Modbus_Frequency: `count` illegal with `data_type: uint16` 'modbus->0->sensors->18', got {'name': 'Modbus_Frequency', 'slave': 1, 'address': 30, 'input_type': 'holding', 'unit_of_measurement': 'Hz', 'device_class': 'frequency', 'state_class': 'measurement', 'count': 1, 'scale': 0.01, 'offset': 0, 'precision': 1, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 243: Modbus_Power_SUM: `count` illegal with `data_type: int32` 'modbus->0->sensors->19', got {'name': 'Modbus_Power_SUM', 'slave': 1, 'address': 32, 'input_type': 'holding', 'unit_of_measurement': 'W', 'device_class': 'power', 'state_class': 'measurement', 'count': 2, 'scale': 1, 'offset': 0, 'precision': 0, 'data_type': 'int32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 255: Modbus_ImportEnergy_SUM: `count` illegal with `data_type: uint32` 'modbus->0->sensors->20', got {'name': 'Modbus_ImportEnergy_SUM', 'slave': 1, 'address': 34, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 267: Modbus_ExportGrid_SUM: `count` illegal with `data_type: uint32` 'modbus->0->sensors->21', got {'name': 'Modbus_ExportGrid_SUM', 'slave': 1, 'address': 36, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 32: Modbus_Power_A: `count` illegal with `data_type: int32` 'modbus->0->sensors->2', got {'name': 'Modbus_Power_A', 'slave': 1, 'address': 2, 'input_type': 'holding', 'unit_of_measurement': 'W', 'device_class': 'power', 'state_class': 'measurement', 'count': 2, 'scale': 1, 'offset': 0, 'precision': 0, 'data_type': 'int32', 'scan_interval': 1}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 45: Modbus_ImportEnergy_A: `count` illegal with `data_type: uint32` 'modbus->0->sensors->3', got {'name': 'Modbus_ImportEnergy_A', 'slave': 1, 'address': 4, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 57: Modbus_ExportGrid_A: `count` illegal with `data_type: uint32` 'modbus->0->sensors->4', got {'name': 'Modbus_ExportGrid_A', 'slave': 1, 'address': 6, 'input_type': 'holding', 'unit_of_measurement': 'kWh', 'device_class': 'energy', 'state_class': 'total_increasing', 'count': 2, 'scale': 0.00125, 'offset': 0, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 69: Modbus_PF_A: `count` illegal with `data_type: uint16` 'modbus->0->sensors->5', got {'name': 'Modbus_PF_A', 'slave': 1, 'address': 8, 'input_type': 'holding', 'device_class': 'power_factor', 'state_class': 'measurement', 'count': 1, 'scale': 0.001, 'offset': 0, 'precision': 2, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 82: Modbus_Voltage_B: `count` illegal with `data_type: uint16` 'modbus->0->sensors->6', got {'name': 'Modbus_Voltage_B', 'slave': 1, 'address': 10, 'input_type': 'holding', 'unit_of_measurement': 'V', 'device_class': 'voltage', 'state_class': 'measurement', 'count': 1, 'scale': 0.01, 'offset': 0, 'precision': 1, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 8: Modbus_Voltage_A: `count` illegal with `data_type: uint16` 'modbus->0->sensors->0', got {'name': 'Modbus_Voltage_A', 'slave': 1, 'address': 0, 'input_type': 'holding', 'unit_of_measurement': 'V', 'device_class': 'voltage', 'state_class': 'measurement', 'count': 1, 'scale': 0.01, 'offset': 0, 'precision': 1, 'data_type': 'uint16'}
Invalid config for 'modbus' at iammeter_modbus.yaml, line 94: Modbus_Current_B: `count` illegal with `data_type: uint16` 'modbus->0->sensors->7', got {'name': 'Modbus_Current_B', 'slave': 1, 'address': 11, 'input_type': 'holding', 'unit_of_measurement': 'A', 'device_class': 'current', 'state_class': 'measurement', 'count': 1, 'scale': 0.01, 'offset': 0, 'precision': 1, 'data_type': 'uint16'}


My config is:

# Example configuration.yaml entry for multiple TCP connections
- name: iammeter_charger_modbus
type: tcp
host: 192.168.1.66
port: 502
sensors:
- name: Modbus_Voltage_A
slave: 1
address: 0
input_type: holding
unit_of_measurement: V
device_class: voltage
state_class: measurement
count: 1
scale: 0.01
offset: 0
precision: 1
data_type: uint16
- name: Modbus_Current_A
slave: 1
address: 1
input_type: holding
unit_of_measurement: A
device_class: current
state_class: measurement
count: 1
scale: 0.01
offset: 0
precision: 1
data_type: uint16
- name: Modbus_Power_A
slave: 1
address: 2
input_type: holding
unit_of_measurement: W
device_class: power
state_class: measurement
count: 2
scale: 1
offset: 0
precision: 0
data_type: int32
scan_interval: 1
- name: Modbus_ImportEnergy_A
slave: 1
address: 4
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32
- name: Modbus_ExportGrid_A
slave: 1
address: 6
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32
- name: Modbus_PF_A
slave: 1
address: 8
input_type: holding
#unit_of_measurement: '%'
device_class: power_factor
state_class: measurement
count: 1
scale: 0.001
offset: 0
precision: 2
data_type: uint16

- name: Modbus_Voltage_B
slave: 1
address: 10
input_type: holding
unit_of_measurement: V
device_class: voltage
state_class: measurement
count: 1
scale: 0.01
offset: 0
precision: 1
data_type: uint16
- name: Modbus_Current_B
slave: 1
address: 11
input_type: holding
unit_of_measurement: A
device_class: current
state_class: measurement
count: 1
scale: 0.01
offset: 0
precision: 1
data_type: uint16
- name: Modbus_Power_B
slave: 1
address: 12
input_type: holding
unit_of_measurement: W
device_class: power
state_class: measurement
count: 2
scale: 1
offset: 0
precision: 0
data_type: int32
scan_interval: 1
- name: Modbus_ImportEnergy_B
slave: 1
address: 14
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32
- name: Modbus_ExportGrid_B
slave: 1
address: 16
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32
- name: Modbus_PF_B
slave: 1
address: 18
input_type: holding
#unit_of_measurement: '%'
device_class: power_factor
state_class: measurement
count: 1
scale: 0.001
offset: 0
precision: 2
data_type: uint16

- name: Modbus_Voltage_C
slave: 1
address: 20
input_type: holding
unit_of_measurement: V
device_class: voltage
state_class: measurement
count: 1
scale: 0.01
offset: 0
precision: 1
data_type: uint16
- name: Modbus_Current_C
slave: 1
address: 21
input_type: holding
unit_of_measurement: A
device_class: current
state_class: measurement
count: 1
scale: 0.01
offset: 0
precision: 1
data_type: uint16
- name: Modbus_Power_C
slave: 1
address: 22
input_type: holding
unit_of_measurement: W
device_class: power
state_class: measurement
count: 2
scale: 1
offset: 0
precision: 0
data_type: int32
scan_interval: 1
- name: Modbus_ImportEnergy_C
slave: 1
address: 24
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32
- name: Modbus_ExportGrid_C
slave: 1
address: 26
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32
- name: Modbus_PF_C
slave: 1
address: 28
input_type: holding
#unit_of_measurement: '%'
device_class: power_factor
state_class: measurement
count: 1
scale: 0.001
offset: 0
precision: 2
data_type: uint16

- name: Modbus_Frequency
slave: 1
address: 30
input_type: holding
unit_of_measurement: Hz
device_class: frequency
state_class: measurement
count: 1
scale: 0.01
offset: 0
precision: 1
data_type: uint16

- name: Modbus_Power_SUM
slave: 1
address: 32
input_type: holding
unit_of_measurement: W
device_class: power
state_class: measurement
count: 2
scale: 1
offset: 0
precision: 0
data_type: int32
- name: Modbus_ImportEnergy_SUM
slave: 1
address: 34
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32
- name: Modbus_ExportGrid_SUM
slave: 1
address: 36
input_type: holding
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
count: 2
scale: 0.00125
offset: 0
precision: 2
data_type: uint32

I just used this yaml: https://github.com/lewei50/Solar-PV-Monitoring/blob/master/Yaml%20in%20Home%20Assistant/ModbusTCP/modbus.yaml to test it and it is normal. You can use this yaml. As for the python error problem, I am not familiar with it. You can ask in the official forum to see if there is a corresponding solution: https://community.home-assistant.io/

Looks like you are new here. Register for free, learn and contribute.