No idea how to do that, I don’t use python so not terribly familiar with it.
see if you receive anything after running python3 and these commands from a previous answer:
I can connect successfully (got a True) but after that, I doesn’t seem to read the register
Hooray, Just found the answer, thanks to somebody from the Huawei forums
https://forum.huawei.com/enterprise/en/sun2000-smart-dongle-modbus-tcp-issues/thread/675885-100027?page=3
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
import time
client = ModbusClient("192.168.1.14", port=502)
client.connect()
if client.connect():
time.sleep(1)
rr = client.read_holding_registers(0x7D50, 0x02, unit=1) #32080 => active_power
activePowerInv=rr.registers[1]
print(activePowerInv)
“The trick is to specify the unit id (equal to 1) on each read_holding call. The dongle doesn’t answer to any request if the unit is not specified.”
This works along the FusionSolar app/website.
@Emilv2 thanks for your HASS plugin. I think that the code above may need to be integrated in the plugin, because as it is now, it didn’t work, at least for my configuration (KTL8-M1, 3P + smart dongle at version 122)
Only since version 120, the WLAN dongle allows the communication via 502 port directly.
For those that need an update for their wlan dongle just login in the fusionsolar web app, https://eu5.fusionsolar.huawei.com/ go to Plants > Device Management > Upgrade Management > Add (top right) select dongle > target xxxSPC122 then your dongle should appear in the next input or search for it
It will take a while (20mins), then check the status of the update, mine stated initially as “Delayed”, then I restarted the inverter (it applies the update when the dongle restarts).
It was posted here also few times.
@ligeza thanks for letting me know, sorry wasn’t able to read every single post. I really thought I was on to something
Hopefully it can be integrated in the plugin.
Hi guys and welcome in this forum!
This thread is a valuable repository of knowledge about connecting to the SUN2000 inverter, so now I am able to monitor my SUN2000 inverter with hard.
I just want to share that If someone is struggling in configuring a router for accessing SUN2000 internal WiFi (especially using DD-WRT) I think that my blogpost can help with this:
https://skyboo.net/2021/07/how-to-connect-to-sun2000-from-dd-wrt/
regards!
I have added a slave option to the component, you can now set the option slave : 1
to make this work.
When you click Device Management and select a Dongle there is a Reset button/switch. Is this for dongle reboot ? If so - then maybe it will be sufficient to click this after firmware upgrade?
@manio Yes! Reset is what I used and then it took a while to come back, but it did.
@Emilv2 thanks a lot! You’re awesome
I just updated my dongle to fw V100R001C00SPC122 using Upgrade Management from FusionSolar web interface. Thanks @andro1 for this info!
I just Added entry for dongle upgrade, it went with progress from 0…100% and then I’ve got ‘Delayed’ status, but after several minutes it just automatically restarted the dongle without my intervention and it changed to ‘Success’
After this I’ve got:
PORT STATE SERVICE
502/tcp open mbap
So I’ve changed slave address to 1 and recompiled hard, and here are the resulting query times before and after:
2021-07-31, 06:10:52.968 [INFO] sun2000: read 65 parameters [⏱ 3529 ms]
2021-07-31, 06:10:56.537 [INFO] sun2000: read 65 parameters [⏱ 3478 ms]
2021-07-31, 06:11:00.126 [INFO] sun2000: read 65 parameters [⏱ 3523 ms]
2021-07-31, 06:11:03.923 [INFO] sun2000: read 65 parameters [⏱ 3614 ms]
2021-07-31, 06:11:07.543 [INFO] sun2000: read 65 parameters [⏱ 3561 ms]
2021-07-31, 06:11:11.213 [INFO] sun2000: read 65 parameters [⏱ 3551 ms]
2021-07-31, 06:11:14.659 [INFO] sun2000: read 65 parameters [⏱ 3353 ms]
2021-07-31, 06:11:18.341 [INFO] sun2000: read 65 parameters [⏱ 3569 ms]
2021-07-31, 06:11:22.034 [INFO] sun2000: read 65 parameters [⏱ 3594 ms]
2021-07-31, 06:11:25.507 [INFO] sun2000: read 65 parameters [⏱ 3390 ms]
2021-07-31, 06:11:29.022 [INFO] sun2000: read 65 parameters [⏱ 3403 ms]
2021-07-31, 06:11:32.665 [INFO] sun2000: read 65 parameters [⏱ 3525 ms]
2021-07-31, 06:11:36.320 [INFO] sun2000: read 65 parameters [⏱ 3567 ms]
2021-07-31, 06:11:39.908 [INFO] sun2000: read 65 parameters [⏱ 3466 ms]
2021-07-31, 06:11:43.558 [INFO] sun2000: read 65 parameters [⏱ 3549 ms]
2021-07-31, 06:11:47.148 [INFO] sun2000: read 65 parameters [⏱ 3526 ms]
2021-07-31, 06:11:50.646 [INFO] sun2000: read 65 parameters [⏱ 3412 ms]
2021-07-31, 06:11:54.135 [INFO] sun2000: read 65 parameters [⏱ 3446 ms]
2021-07-31, 06:11:57.927 [INFO] sun2000: read 65 parameters [⏱ 3685 ms]
2021-07-31, 06:12:01.505 [INFO] sun2000: read 65 parameters [⏱ 3485 ms]
2021-07-31, 06:12:05.152 [INFO] sun2000: read 65 parameters [⏱ 3487 ms]
2021-07-31, 06:12:08.666 [INFO] sun2000: read 65 parameters [⏱ 3421 ms]
2021-07-31, 06:12:12.329 [INFO] sun2000: read 65 parameters [⏱ 3574 ms]
2021-07-31, 06:12:15.905 [INFO] sun2000: read 65 parameters [⏱ 3492 ms]
2021-07-31, 06:12:19.510 [INFO] sun2000: read 65 parameters [⏱ 3508 ms]
2021-07-31, 06:12:23.216 [INFO] sun2000: read 65 parameters [⏱ 3613 ms]
2021-07-31, 06:12:26.774 [INFO] sun2000: read 65 parameters [⏱ 3459 ms]
2021-07-31, 06:12:30.371 [INFO] sun2000: read 65 parameters [⏱ 3556 ms]
2021-07-31, 06:12:34.056 [INFO] sun2000: read 65 parameters [⏱ 3588 ms]
2021-07-31, 06:12:37.678 [INFO] sun2000: read 65 parameters [⏱ 3539 ms]
2021-07-31, 06:12:37.820 [INFO] 🚩 hard terminated, daemon running time: 12h 36m 37s 682ms 850us 685ns
2021-07-31, 06:14:22.817 [INFO] sun2000: read 7 parameters [⏱ 1376 ms]
2021-07-31, 06:14:34.461 [INFO] sun2000: read 65 parameters [⏱ 11643 ms]
2021-07-31, 06:14:46.595 [INFO] sun2000: read 65 parameters [⏱ 12043 ms]
2021-07-31, 06:14:58.600 [INFO] sun2000: read 65 parameters [⏱ 11909 ms]
2021-07-31, 06:15:10.968 [INFO] sun2000: read 65 parameters [⏱ 12285 ms]
2021-07-31, 06:15:23.784 [INFO] sun2000: read 65 parameters [⏱ 12721 ms]
2021-07-31, 06:15:35.139 [INFO] sun2000: read 65 parameters [⏱ 11264 ms]
2021-07-31, 06:15:47.366 [INFO] sun2000: read 65 parameters [⏱ 12135 ms]
2021-07-31, 06:15:59.577 [INFO] sun2000: read 65 parameters [⏱ 12157 ms]
2021-07-31, 06:16:11.582 [INFO] sun2000: read 65 parameters [⏱ 11926 ms]
2021-07-31, 06:16:24.280 [INFO] sun2000: read 65 parameters [⏱ 12603 ms]
2021-07-31, 06:16:36.450 [INFO] sun2000: read 65 parameters [⏱ 12070 ms]
2021-07-31, 06:16:48.426 [INFO] sun2000: read 65 parameters [⏱ 11868 ms]
2021-07-31, 06:17:00.012 [INFO] sun2000: read 65 parameters [⏱ 11496 ms]
2021-07-31, 06:17:12.342 [INFO] sun2000: read 65 parameters [⏱ 12232 ms]
2021-07-31, 06:17:24.728 [INFO] sun2000: read 65 parameters [⏱ 12322 ms]
2021-07-31, 06:17:36.696 [INFO] sun2000: read 65 parameters [⏱ 11878 ms]
2021-07-31, 06:17:48.263 [INFO] sun2000: read 65 parameters [⏱ 11466 ms]
As you can clearly see: reading 65 parameters via internal WiFi tooks about 3.5 sec, while doing the same with WLAN-FE dongle took about 12 secs, so roughly 4 times slower!!
Do you guys have similar behavior?
Is it because the Dongle is constantly sending data to FusionSolar?
I reinstalled the hacs plugin, but I can’t test just yet.
I still doesn’t work for me for some reason, keep getting the same error “another device connected?”
It works perfectly over the hass native modbus though. (I disabled modbus while testing this plugin)
- platform: huawei_solar
host: '192.168.1.55'
optimizers: false
battery: false
slave: 1
Error while setting up huawei_solar platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/huawei_solar/sensor.py", line 115, in setup_platform
HuaweiSolarSensor(inverter, config[CONF_OPTIMIZERS], config[CONF_BATTERY])
File "/config/custom_components/huawei_solar/sensor.py", line 130, in __init__
self._name = self._inverter.get("model_name").value
File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 263, in get
response = self.read_register(reg.register, reg.length)
File "/usr/local/lib/python3.9/site-packages/huawei_solar/huawei_solar.py", line 310, in read_register
raise ReadException(message)
huawei_solar.huawei_solar.ReadException: could not read register value, is an other device already connected?
@Emilv2
For me is also not working, but if I set slave=1 as default
def __init__(self, host, port="502", timeout=5, loop=None, slave=1):
then it is working.
I can add
sensor:
- platform: huawei_solar
host: '192.168.5.83'
slave : 0
and it’s still working, so maybe there is problem with passing value.
That was indeed the issue, it should be fixed in the latest version.
@Emilv2 Thanks for the fix, indeed it’s working.
Altough there is a bug, I think. If I inspect the object returned by the plugin, I see that “active_power” attribute is completely missing:
model_id: 428
serial_number: Hxxxxx
nb_pv_strings: 2
rated_power: 8000
grid_standard: VDE-AR-N-4105
grid_country: Germany
daily_yield: 0.72
total_yield: 85.17
grid_voltage: 424.3
grid_current: 1.012
line_voltage_A_B: 424.3
line_voltage_B_C: 429.7
line_voltage_C_A: 428.1
phase_A_voltage: 249
phase_B_voltage: 243.8
phase_C_voltage: 247.6
phase_A_current: 1.012
phase_B_current: 1.026
phase_C_current: 1.016
day_active_power_peak: 0
reactive_power: 0
power_factor: 1
efficiency: 94.97
grid_frequency: 49.98
power_meter_active_power: 0
input_power: 776
grid_A_voltage: 0
grid_B_voltage: 0
grid_C_voltage: 0
active_grid_A_current: 0
active_grid_B_current: 0
active_grid_C_current: 0
active_grid_power_factor: 0
active_grid_frequency: 0
grid_exported_energy: 21474836.47
grid_accumulated_energy: 21474836.47
active_grid_A_B_voltage: 0
active_grid_B_C_voltage: 0
active_grid_C_A_voltage: 0
active_grid_A_power: 0
active_grid_B_power: 0
active_grid_C_power: 0
startup_time: '04:31:38'
shutdown_time: '19:07:14'
internal_temperature: 46.6
device_status: On-grid
nb_optimizers: 0
system_time: '2021-08-01T06:54:29+00:00'
pv_string_01_voltage: 195.2
pv_string_01_current: 2.83
pv_string_02_voltage: 345.1
pv_string_02_current: 0.55
unit_of_measurement: W
friendly_name: SUN2000-8KTL-M1
icon: mdi:solar-power
Here it seems to have the correct register assigned to it:
And I can read it successfully from the inverter via direct modbus connection, like this:
modbus:
- name: Huawei Solar
type: tcp
host: 192.168.1.55
port: 502
delay: 2
sensors:
- name: HuaweiActivePower
slave: 1
address: 32080
unit_of_measurement: W
data_type: int
count: 2
scale: 1
precision: 1
scan_interval: 20
Active power is the value of entity…
Haha , thanks guys! My bad.
2021-08-01 08:01:20 ERROR (MainThread) [homeassistant.setup] Setup failed for homeass: Integration not found.
What is integration homeass
?
2021-08-01 08:01:20 ERROR (MainThread) [homeassistant.components.http] Failed to create HTTP server at port 8123: [Errno 98] error while attempting to bind on address (’::’, 8123, 0, 0): address already in use
Seems like home assistant is already running, I don’t think your problem has anything to do with the huawei_solar integration.
Jak mogę wyciągnąć napięcie na fazach? dziękuję za pomoc
Jeśli używasz integracji od @Emilv2 to w atrybutach masz napięcie na falowniku
Phase A voltage: 246.5
Phase B voltage: 247.3
Phase C voltage: 245.9
Jeśli posiadasz również miernik to możesz odczytać również napięcie na mierniku:
Grid A voltage: 235.8
Grid B voltage: 241.1
Grid C voltage: 241.8
Jeśli używasz integracji modbus to wtedy odczytujesz odpowiednie rejestry:
"phase_A_voltage": RegisterDefinitions("u16", "V", 10, 32069, 1),
"phase_B_voltage": RegisterDefinitions("u16", "V", 10, 32070, 1),
"phase_C_voltage": RegisterDefinitions("u16", "V", 10, 32071, 1),
"grid_A_voltage": RegisterDefinitions("i32", "V", 10, 37101, 2),
"grid_B_voltage": RegisterDefinitions("i32", "V", 10, 37103, 2),
"grid_C_voltage": RegisterDefinitions("i32", "V", 10, 37105, 2),
Oczywiście pod integracje modbus musisz sobie odpowiednio te dane sformatować.
Anyone have the 3000L version working?
What is need (if something) in the logger so this integration works?