huawei_solar icon indicating copy to clipboard operation
huawei_solar copied to clipboard

SmartLogger 3000A

Open bdkacz opened this issue 1 year ago • 32 comments

System Health details

System Health

version core-2022.7.6
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.10.5
os_name Linux
os_version 5.15.45
arch x86_64
timezone Europe/Warsaw
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4870
Installed Version 1.26.2
Stage running
Available Repositories 1072
Downloaded Repositories 2
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 8.2
update_channel stable
supervisor_version supervisor-2022.07.0
agent_version 1.2.1
docker_version 20.10.14
disk_total 30.8 GB
disk_used 2.9 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons SSH & Web Terminal (11.0.2), Log Viewer (0.14.0), File editor (5.3.3), Samba share (10.0.0)
Dashboards
dashboards 1
resources 0
mode auto-gen
Recorder
oldest_recorder_run 21 lipca 2022 06:31
current_recorder_run 21 lipca 2022 09:12
estimated_db_size 0.43 MiB
database_engine sqlite
database_version 3.38.5

Huawei Solar Setup

2x Huawei SUN-60-KTL-M0 inverters connected via rs485 to SmartLogger 3000A with modbus-tcp enabled on logger

Describe the issue

I have a challenge for the author :)

I have a SolarLogger 3000A and 2 inverters connected to it (at address 1 and 2, logger is at address 0), link to the modbus documentation

If I understand the provisions of chapter "2.7 Remapped Modbus definitions", the registers are shifted in relation to the situation when we connect directly to the inverter

Currently, an attempt to establish a connection under any slaveID (0,1,2) results in such records in the logs

Reproduction steps

  1. Install Addon
  2. Try to add device

Relevant debug logs

2022-07-21 09:13:40 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting to 131.87.12.200:502.
2022-07-21 09:13:40 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-07-21 09:13:40 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client connected to modbus server
2022-07-21 09:13:40 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol made connection.
2022-07-21 09:13:40 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Connected to 131.87.12.200:502.
2022-07-21 09:13:41 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2022-07-21 09:13:41 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x3 0xa7 0xfe 0x0 0x1
2022-07-21 09:13:41 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2022-07-21 09:13:41 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] recv: 0x0 0x1 0x0 0x0 0x0 0x3 0x1 0x83 0x3
2022-07-21 09:13:41 DEBUG (MainThread) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x3 0x1 0x83 0x3
2022-07-21 09:13:41 DEBUG (MainThread) [pymodbus.factory] Factory Response[131]
2022-07-21 09:13:41 DEBUG (MainThread) [pymodbus.transaction] Getting transaction 1
2022-07-21 09:13:41 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 123, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 88, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 217, in get
    return (await self.get_multiple([name], slave))[0]
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 259, in get_multiple
    response = await self._read_registers(
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 350, in _read_registers
    result = await _do_read()
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 332, in _do_read
    raise ReadException(
huawei_solar.exceptions.ReadException: Got error while reading from register 43006 with length 1: Exception Response(131, 3, IllegalValue)
2022-07-21 09:13:41 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client disconnected from modbus server: None
2022-07-21 09:13:41 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol lost connection.

bdkacz avatar Jul 21 '22 08:07 bdkacz

That is not straightforward, but should be doable. Any chance that we can work out a way for me to access your installation (VPN, Wireguard, whitelisting of an IP)? That would immensely speed up the development cycle.

wlcrs avatar Jul 21 '22 08:07 wlcrs

What happens if you only mention slave ID 1 and 2 during the installation wizard? Can you post the logs of what happens then?

wlcrs avatar Jul 21 '22 09:07 wlcrs

With slaveid =1:

2022-07-21 11:10:54 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting to 131.87.12.200:502.
2022-07-21 11:10:54 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-07-21 11:10:54 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client connected to modbus server
2022-07-21 11:10:54 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol made connection.
2022-07-21 11:10:54 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Connected to 131.87.12.200:502.
2022-07-21 11:10:55 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2022-07-21 11:10:55 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x3 0xa7 0xfe 0x0 0x1
2022-07-21 11:10:55 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2022-07-21 11:10:55 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] recv: 0x0 0x1 0x0 0x0 0x0 0x3 0x1 0x83 0x3
2022-07-21 11:10:55 DEBUG (MainThread) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x3 0x1 0x83 0x3
2022-07-21 11:10:55 DEBUG (MainThread) [pymodbus.factory] Factory Response[131]
2022-07-21 11:10:55 DEBUG (MainThread) [pymodbus.transaction] Getting transaction 1
2022-07-21 11:10:55 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 123, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 88, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 217, in get
    return (await self.get_multiple([name], slave))[0]
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 259, in get_multiple
    response = await self._read_registers(
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 350, in _read_registers
    result = await _do_read()
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 332, in _do_read
    raise ReadException(
huawei_solar.exceptions.ReadException: Got error while reading from register 43006 with length 1: Exception Response(131, 3, IllegalValue)
2022-07-21 11:10:55 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client disconnected from modbus server: None
2022-07-21 11:10:55 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol lost connection.

with slaveid=2:

2022-07-21 11:13:09 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting to 131.87.12.200:502.
2022-07-21 11:13:09 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-07-21 11:13:09 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client connected to modbus server
2022-07-21 11:13:09 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol made connection.
2022-07-21 11:13:09 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Connected to 131.87.12.200:502.
2022-07-21 11:13:09 DEBUG (MainThread) [zeroconf] IPv6 scope_id 0 associated to the receiving interface
2022-07-21 11:13:09 DEBUG (MainThread) [zeroconf] Received from '::ffff:192.168.2.72':5353 [socket 12 (('::', 5353, 0, 0))]: <DNSIncoming:{id=0, flags=0, truncated=False, n_q=1, n_ans=1, n_auth=0, n_add=0, questions=[ptr[question,QM,in,_anywhereusb._tcp.local.]], answers=[record[ptr,in,_anywhereusb._tcp.local.]=4205/4204,AW02-004853 [0004F31FC7AA] (AnywhereUSB)._anywhereusb._tcp.local.]}> (96 bytes) as [b'\x00\x00\x00\x00\x00\x01\x00\x01\x00\x00\x00\x00\x0c_anywhereusb\x04_tcp\x05local\x00\x00\x0c\x00\x01\xc0\x0c\x00\x0c\x00\x01\x00\x00\x10m\x00+(AW02-004853 [0004F31FC7AA] (AnywhereUSB)\xc0\x0c']
2022-07-21 11:13:10 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2022-07-21 11:13:10 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x2 0x3 0xa7 0xfe 0x0 0x1
2022-07-21 11:13:10 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2022-07-21 11:13:10 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] recv: 0x0 0x1 0x0 0x0 0x0 0x3 0x2 0x83 0x3
2022-07-21 11:13:10 DEBUG (MainThread) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x3 0x2 0x83 0x3
2022-07-21 11:13:10 DEBUG (MainThread) [pymodbus.factory] Factory Response[131]
2022-07-21 11:13:10 DEBUG (MainThread) [pymodbus.transaction] Getting transaction 1
2022-07-21 11:13:10 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 123, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 88, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 217, in get
    return (await self.get_multiple([name], slave))[0]
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 259, in get_multiple
    response = await self._read_registers(
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 350, in _read_registers
    result = await _do_read()
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 332, in _do_read
    raise ReadException(
huawei_solar.exceptions.ReadException: Got error while reading from register 43006 with length 1: Exception Response(131, 3, IllegalValue)
2022-07-21 11:13:10 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client disconnected from modbus server: None
2022-07-21 11:13:10 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol lost connection.

bdkacz avatar Jul 21 '22 09:07 bdkacz

Ok, I have a suspicion that the issue is not related to the setup itself, but with those commercial inverters using other Modbus addresses, making them incompatible with this integration.

Can you download the register definitions, as described in this topic on the Huawei forum and upload them here? That way I can compare and check.

wlcrs avatar Jul 21 '22 09:07 wlcrs

Here click

bdkacz avatar Jul 21 '22 09:07 bdkacz

Ok. I make some discover.

So as on 2.7 Remapped Modbus definitions acrive power of inverters i found when connecting on slaveid=0 (logger) and read address

51001 for active power of inverter no 1 51026 for active power of inverter no 2

For read data directly from each inverter I use addresses from modbus v3.pdf and slaveid 1 or 2 - for example active power address 32080/32081

But when I try read timezone register 43006 i get 0

bdkacz avatar Jul 21 '22 10:07 bdkacz

Some readed from slave =1 data

Filename is number od start of register and contains 100-125 registers. So 3000.csv include data from registers 30000-30125, 32000.csv from 32000 to 32100 etc

Hope this helps

I use modbuspull from https://www.modbustools.com/download.html

bdkacz avatar Jul 21 '22 11:07 bdkacz

Here click

The strange thing is that the register that I try to read is mentioned in this document, but your logs clearly indicate that an "Illegal data value" exception is being thrown when reading the register:

image

Can you please try to read the registers in the 43xxx range with your modbuspoll tool?

wlcrs avatar Jul 21 '22 15:07 wlcrs

43000 to 43100 on all 3 slaveid 0,1,2 return 0 on all registers 43000.csv

don't ask why :)

bdkacz avatar Jul 21 '22 16:07 bdkacz

Time Zone I can read from logger registry 40005 (as in documentation for logger) and slaveid=0. Looks like registers 43000 of inverters are not acccessible over logger ??

IMHO best solution is try read 43006 if it fails try 40005 if success then connected device is logger and next access to each inverter values by slaveid 1,2 ... or by slaveid=0 of logger and remaped addresses

bdkacz avatar Jul 21 '22 16:07 bdkacz

Ok, thanks for the info. I'll need to think a bit over the approach for this. I could ignore the error on the time zone register, but this will have two consequences:

  • reported times (startup time etc) can be wrong
  • editable entities (mostly for battery management) will not show up. This is because I use the time zone register as a way to test if I have elevated permissions
  • optimizer entities will not show up as these need those elevated permissions

wlcrs avatar Jul 21 '22 19:07 wlcrs

For me, it will not matter too much, because I do not have any batteries or optimizers :) But if you want to do something universal, it is probably most sensible to do as I wrote, i.e. reading the time from two registers and depending on which success will be different futher proceeding. You can add in the documentation that if user have/use a logger, user should also provide the logger's slaveid to be able to read the time

bdkacz avatar Jul 21 '22 20:07 bdkacz

Can you try again with release 1.1.2?

wlcrs avatar Jul 28 '22 20:07 wlcrs

After upgrade to 1.1.2 I get error "Setup failed for custom integration huawei_solar: Requirements for huawei_solar not found: ['huawei-solar==2.1.2']",also "Unable to install package huawei-solar==2.1.2"

bdkacz avatar Jul 28 '22 20:07 bdkacz

After upgrade to 1.1.2 I get error "Setup failed for custom integration huawei_solar: Requirements for huawei_solar not found: ['huawei-solar==2.1.2']",also "Unable to install package huawei-solar==2.1.2"

I have the same issue with the 1.1.2 release

tdr-its42 avatar Jul 28 '22 20:07 tdr-its42

I have the same issue with the 1.1.2 release

Looks like typo mistake - somewhere in code should be 1.1.2 but is 2.1.2 :)

bdkacz avatar Jul 28 '22 20:07 bdkacz

I have the same issue with the 1.1.2 release

Looks like typo mistake - somewhere in code should be 1.1.2 but is 2.1.2 :)

2.1.2 release is used in manifest.json, but I don't think it's the cause, I just tested it...

Edit: it is indeed caused by that line, of you change it into 2.1.1, then it works 🙂

tdr-its42 avatar Jul 28 '22 20:07 tdr-its42

Whoops, the release of the huawei_solar library version 2.1.2 went wrong. Fixed now!

image

wlcrs avatar Jul 28 '22 21:07 wlcrs

Thanks for this prompt solution :)

tdr-its42 avatar Jul 28 '22 21:07 tdr-its42

Can you try again with release 1.1.2?

Unfortunately still not working, below the logs :

With device id=0 (logger)

2022-07-29 07:02:18 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting to 131.87.12.200:502.
2022-07-29 07:02:18 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-07-29 07:02:18 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client connected to modbus server
2022-07-29 07:02:18 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol made connection.
2022-07-29 07:02:18 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Connected to 131.87.12.200:502.
2022-07-29 07:02:19 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x0 0x3 0xa7 0xfe 0x0 0x1
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] recv: 0x0 0x1 0x0 0x0 0x0 0x5 0x0 0x3 0x2 0x0 0x0
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x5 0x0 0x3 0x2 0x0 0x0
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.factory] Factory Response[ReadHoldingRegistersResponse: 3]
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.transaction] Getting transaction 1
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.payload] [0]
2022-07-29 07:02:19 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 47000
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x2 0x0 0x0 0x0 0x6 0x0 0x3 0xb7 0x98 0x0 0x1
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 2
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] recv: 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x83 0x3
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.framer.socket_framer] Processing: 0x0 0x2 0x0 0x0 0x0 0x3 0x0 0x83 0x3
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.factory] Factory Response[131]
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.transaction] Getting transaction 2
2022-07-29 07:02:19 ERROR (MainThread) [huawei_solar.huawei_solar] Got error Got error while reading from register 47000 with length 1: Exception Response(131, 3, IllegalValue) while trying to determine battery.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 119, in _initialize
    self.battery_type = (await self.get(rn.STORAGE_UNIT_1_PRODUCT_MODEL)).value
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 245, in get
    return (await self.get_multiple([name], slave))[0]
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 287, in get_multiple
    response = await self._read_registers(
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 378, in _read_registers
    result = await _do_read()
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 360, in _do_read
    raise ReadException(
huawei_solar.exceptions.ReadException: Got error while reading from register 47000 with length 1: Exception Response(131, 3, IllegalValue)
2022-07-29 07:02:19 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 150, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 130, in _initialize
    raise rerr
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 119, in _initialize
    self.battery_type = (await self.get(rn.STORAGE_UNIT_1_PRODUCT_MODEL)).value
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 245, in get
    return (await self.get_multiple([name], slave))[0]
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 287, in get_multiple
    response = await self._read_registers(
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 378, in _read_registers
    result = await _do_read()
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 360, in _do_read
    raise ReadException(
huawei_solar.exceptions.ReadException: Got error while reading from register 47000 with length 1: Exception Response(131, 3, IllegalValue)
2022-07-29 07:02:19 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client disconnected from modbus server: None
2022-07-29 07:02:19 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol lost connection.

With deviceid=1 (first inverter)


2022-07-29 07:02:25 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting to 131.87.12.200:502.
2022-07-29 07:02:25 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Connecting.
2022-07-29 07:02:25 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client connected to modbus server
2022-07-29 07:02:25 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol made connection.
2022-07-29 07:02:25 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Connected to 131.87.12.200:502.

2022-07-29 07:02:26 DEBUG (MainThread) [huawei_solar.huawei_solar] Reading register 43006
2022-07-29 07:02:26 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] send: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x3 0xa7 0xfe 0x0 0x1
2022-07-29 07:02:26 DEBUG (MainThread) [pymodbus.transaction] Adding transaction 1
2022-07-29 07:02:26 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] recv: 0x0 0x1 0x0 0x0 0x0 0x3 0x1 0x83 0x3
2022-07-29 07:02:26 DEBUG (MainThread) [pymodbus.framer.socket_framer] Processing: 0x0 0x1 0x0 0x0 0x0 0x3 0x1 0x83 0x3
2022-07-29 07:02:26 DEBUG (MainThread) [pymodbus.factory] Factory Response[131]
2022-07-29 07:02:26 DEBUG (MainThread) [pymodbus.transaction] Getting transaction 1
2022-07-29 07:02:26 ERROR (MainThread) [huawei_solar.huawei_solar] Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 150, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 115, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 245, in get
    return (await self.get_multiple([name], slave))[0]
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 287, in get_multiple
    response = await self._read_registers(
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 378, in _read_registers
    result = await _do_read()
  File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/huawei_solar/huawei_solar.py", line 360, in _do_read
    raise ReadException(
huawei_solar.exceptions.ReadException: Got error while reading from register 43006 with length 1: Exception Response(131, 3, IllegalValue)
2022-07-29 07:02:26 DEBUG (MainThread) [pymodbus.client.asynchronous.async_io] Client disconnected from modbus server: None
2022-07-29 07:02:26 INFO (MainThread) [pymodbus.client.asynchronous.async_io] Protocol lost connection.

bdkacz avatar Jul 29 '22 05:07 bdkacz

Can you try again with release 1.1.2?

Hi. What IDE You use ? To easy debug, I will try correct something myself but I neded tip what tools use :)

bdkacz avatar Aug 10 '22 17:08 bdkacz

Hi,

I use VS Code, but feel free to use anything else :-)

I would suggest cloning the following repo: https://gitlab.com/Emilv2/huawei-solar.git on the develop-branch.

Run pip install -e . in the directory with setup.py to install the development version in your Python installation.

Have a look at the bridge_tst.py file on how to use the library. (this revision might be more interesting for you: https://gitlab.com/Emilv2/huawei-solar/-/blob/0b4c70a5e28984dd23c25c33e17cb7e339780416/bridge_tst.py )

Op wo 10 aug. 2022 om 19:33 schreef bdkacz @.***>:

Can you try again with release 1.1.2?

Hi. What IDE You use ? To easy debug, I will try correct something myself but I neded tip what tools use :)

— Reply to this email directly, view it on GitHub https://github.com/wlcrs/huawei_solar/issues/93#issuecomment-1211033422, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQM5LFHOQOUXNI2B64RMADVYPRWZANCNFSM54GUZRLQ . You are receiving this because you commented.Message ID: @.***>

wlcrs avatar Aug 10 '22 18:08 wlcrs

When I try debug in vs code I get error "No module named 'huawei_solar.register_names'; 'huawei_solar' is not a package"

bdkacz avatar Aug 11 '22 07:08 bdkacz

That is why you need to run pip3 install -e . in the directory with setup.py

On Thu, Aug 11, 2022, 09:29 bdkacz @.***> wrote:

When I try debug in vs code I get error "No module named 'huawei_solar.register_names'; 'huawei_solar' is not a package"

— Reply to this email directly, view it on GitHub https://github.com/wlcrs/huawei_solar/issues/93#issuecomment-1211641056, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQM5LAZMUYFMBMFWVFHR53VYSTUJANCNFSM54GUZRLQ . You are receiving this because you commented.Message ID: @.***>

wlcrs avatar Aug 11 '22 09:08 wlcrs

That is why you need to run pip3 install -e . in the directory with setup.py

Ok after second try it works .

So my suggestion is to add the "I'm using smartlogger" checkbox to the adding integration window. I attach the changed code, where I use this information - an additional parameter in the create method and then checking it in place where we read the time zone, I also added a register to the registers, where the logger keeps the time zone.

I imagine it so that the user adding the integration selects the checkbox and as the slave id he enters the ID of the inverters, e.g. 1,2. And the integration, seeing the selected checkbox, downloads the time zone from the logger, while the remaining data is read directly from the inverters using their slave_id's huawei-solar.zip

bdkacz avatar Aug 13 '22 10:08 bdkacz

Can you try to improve your contribution to automatically detect the smartlogger instead? I don't want to add checkboxes that cause confusion unless absolutely necessary.

On Sat, Aug 13, 2022, 11:39 bdkacz @.***> wrote:

That is why you need to run pip3 install -e . in the directory with setup.py

Ok after second try it works .

So my suggestion is to add the "I'm using smartlogger" checkbox to the adding integration window. I attach the changed code, where I use this information - an additional parameter in the create method and then checking it in the time zone, I also added a register to the registers, where the logger keeps the time zone.

I imagine it so that the user adding the integration selects the checkbox and as the slave id he enters the ID of the inverters, e.g. 1,2. And the integration, seeing the selected checkbox, downloads the time zone from the logger, while the remaining data is read directly from the inverters using their slave_id huawei-solar.zip https://github.com/wlcrs/huawei_solar/files/9331240/huawei-solar.zip

— Reply to this email directly, view it on GitHub https://github.com/wlcrs/huawei_solar/issues/93#issuecomment-1214135670, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQM5LCDP3QCHKKBIDCJXTDVY53OZANCNFSM54GUZRLQ . You are receiving this because you commented.Message ID: @.***>

wlcrs avatar Aug 13 '22 10:08 wlcrs

Can you try to improve your contribution to automatically detect the smartlogger instead? I don't want to add checkboxes that cause confusion unless absolutely necessary.

Ok I will try :)

bdkacz avatar Aug 13 '22 10:08 bdkacz

And we have a new code :) I added a check with slave_id = 0 if the connected device is a smartlogger and I set the self.detected_smart_logger = 1 flag when it detects a smartlogger. But I do not know how to add security, that when the user adds the integration, he will give slave_id 0,1,2, then if slave_id = 0 detects a smartlogger, devices under slave_id 1,2 .... should be treated as connected via a smartlogger, not directly via modbus huawei-solar.zip

bdkacz avatar Aug 13 '22 13:08 bdkacz

I cleaned up your code and committed it to a new branch: https://gitlab.com/Emilv2/huawei-solar/-/tree/smartlogger-support

Can you please verify that you can successfully run the changes to bridge_tst.py that I made? Only if that works I can start looking into updating the integration itself.

wlcrs avatar Aug 16 '22 07:08 wlcrs

Hi

First my mistake - the register should be 51000 not 51001

With register 51000 it detect smartlogger correctly,but it calls await HuaweiSolarBridge.__populate_fields(bridge) and fails with reading register 3000, which not exist in solarlog modbus - so the communication with smartlogger should end on detecting timezone

bdkacz avatar Aug 16 '22 08:08 bdkacz