question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't get your component to work

See original GitHub issue

I have an Huawei SUN2000-4KTL-M1 Home Assistant errors:

Logger: pymodbus.client.sync
Source: /usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py:214
First occurred: 12:04:15 (2 occurrences)
Last logged: 12:04:17

Connection to (192.168.89.206, 502) failed: [Errno 111] Connection refused
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py:171
First occurred: 12:04:17 (1 occurrences)
Last logged: 12:04:17

failed to connect to device, is the host correct?
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 169, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.89.206:502)]
Logger: homeassistant.components.sensor
Source: custom_components/huawei_solar/sensor.py:124
Integration: Sensor (documentation, issues)
First occurred: 12:04:17 (1 occurrences)
Last logged: 12:04:17

Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 169, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.89.206:502)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/huawei_solar/sensor.py", line 109, in setup_platform
    HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])
  File "/config/custom_components/huawei_solar/sensor.py", line 124, in __init__
    self._name = self._inverter.get("model_name").value
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 40, in get
    response = self.read_register(reg.register, reg.length)
  File "/usr/local/lib/python3.8/site-packages/huawei_solar/huawei_solar.py", line 172, in read_register
    raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.89.206:502)]

Errors in command line

❯ python3
Python 3.9.1 (default, Dec 10 2020, 11:11:14)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import huawei_solar
>>> inverter = huawei_solar.HuaweiSolar('192.168.89.206')
>>> inverter.get("model_name")
failed to connect to device, is the host correct?
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 169, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.89.206:502)]
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 169, in read_register
    response = self.client.read_holding_registers(register, length)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.89.206:502)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 40, in get
    response = self.read_register(reg.register, reg.length)
  File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 172, in read_register
    raise ConnectionException(ex)
huawei_solar.huawei_solar.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.89.206:502)]
>>>
❯ ping 192.168.89.206
PING 192.168.89.206 (192.168.89.206): 56 data bytes
64 bytes from 192.168.89.206: icmp_seq=0 ttl=255 time=2.485 ms
64 bytes from 192.168.89.206: icmp_seq=1 ttl=255 time=1.194 ms
64 bytes from 192.168.89.206: icmp_seq=2 ttl=255 time=1.252 ms
64 bytes from 192.168.89.206: icmp_seq=3 ttl=255 time=1.497 ms
64 bytes from 192.168.89.206: icmp_seq=4 ttl=255 time=1.246 ms
64 bytes from 192.168.89.206: icmp_seq=5 ttl=255 time=2.199 ms
64 bytes from 192.168.89.206: icmp_seq=6 ttl=255 time=1.943 ms

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:29 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
Emilv2commented, Mar 5, 2021

Ok, give me some time. I just found out it’s possible to install requirements from git, so I think I will just make it async first and see if that solves the issue.

0reactions
purcell-labcommented, Nov 24, 2021

Hallo i have problem with integration. I have connection with inverter. GitHub Logo core-2021.3.3 supervisor-2021.03.4 docker 20.10.5

DId you get a resolution for this, I am seeing the same error…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't use component in Angular 8
The solution seems to be under my nose but I can't see it. I keep getting this error: 'app-green' is not a known...
Read more >
Can't get ionic v4 CLI generated component to work
I'm currently working with the latest Ionic and I'm having a hard time trying to get a CLI generates component to work.
Read more >
Can't get Jest to work with Styled Components which ...
Hi everyone, I've been trying all day to get Jest working with my Styled Components. I opened the following Stack Overflow question to...
Read more >
Interactive components not working in the main components
I realised I was using a master component within the prototype by accident. Removing this and replacing with an instance solved the issue....
Read more >
How passing props to component works in React
Understanding the way props work is essential to mastering React, but to grasp ... Here we have a single React component rendering a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found