Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Huawei Energy Management Assistant (EMMA-A01 / A02) Support #498

Closed
2 tasks done
Roving-Ronin opened this issue Oct 9, 2023 · 120 comments
Closed
2 tasks done
Labels
on-hold Don't close when stale

Comments

@Roving-Ronin
Copy link
Contributor

Roving-Ronin commented Oct 9, 2023

Describe your feature request

As per the wall charger feature request, this 'issue' is intended as a location for people to be able to start gathering information and discussing how it works and how it may potentially be supported in the integration.

Given that the EMMA in future will be the preferred method of installation for Huawei Solar installations, with it :

  • providing the energy/consumption meter functionality (superceded the standalone DDSU/DTSU-666H meter);
  • connecting to the inverter(s) via RS485 to provide the aforementioned energy/consumption meter functionality;
  • providing network/internet connectivity for the inverter(s) and LUNA ESS connected via RS485, with its inbuilt WiFi+WAN ethernet ports;
  • connecting to the (forthcoming) SmartGuard-63A that is the replacement for the BackupBox device, that provides for a protected circuit in the event of a grid outage;
  • connecting to the (forthcoming) Huawei Smart Charger 7/21kW for EV charging, via either the LAN port (bad naming, it is only for charger <--> EMMA direct patching, with a single charger). See Issue: [Feature Request]: Wallbox Integration #491
  • Also adds smart / cloud capabilities such as being able to access weather information and make decisions, such as if it will be raining / overcast tomorrow, then charge the LUNA ESS off the cheapest grid power available before tomorrow.

Hopefully Huawei will be utilising the same modbus registers used on the DDSU/DTSU-666H meters, to provide themselves with maximum compatibility for existing installations upgrading, that will allow for 'out of the box' compatibility with WLCRS. However this needs to be confirmed when documentation is published detailing the modbus register definitions for EMMA.
As EMMA is adding additional functionality, it would be a good expectation that there may be additional modbus registers added to EMMA, that would then need to be reviewed and see if any are 'worthwhile' or of use to request being added to WLCRS.

To date documentation published on EMMA is:
EMMA-(A01, A02) User Manual.pdf v01 - Superceded
FusionSolar App Quick Guide (EMMA).pdf
Huawei - EMMA Quick Installation Guide.pdf

Proper usage

  • I confirm that this is not a bug report or support request
  • I confirm that this feature request is within the stated scope of the integration
@wlcrs wlcrs added the on-hold Don't close when stale label Oct 18, 2023
@Roving-Ronin
Copy link
Contributor Author

FYI Huawei have released an installation videa for the EMMA devices, and a new User Guide that includes updating network information.

Note: The EMMA is a device that manages energy in a home with a PV system. It can implement unified scheduling and management of home energy. The EMMA has two models:

EMMA-A01: Only PV and ESS features are supported. Plant-level power control functions, such as maximum self-consumption and grid-tied point control, are supported for unified scheduling of home energy and plant-level energy optimization, further improving the PV energy utilization

EMMA-A02: Features of PV, ESSs, smart chargers, and smart loads are supported. In addition to unified scheduling of home energy, the EMMA-A02 can connect to smart loads such as chargers, SG Ready heat pumps, and smart switches. Users can set the reservation time to charge vehicles and heat water in advance at the specified time. In addition, users can set the priority to use PV energy for devices as required to make the best use of PV energy.


EMMA Installation Video: https://support.huawei.com/enterprise/en/doc/EDOC1100338746?idAbsPath=7639526%7C258788303%7C258788491%7C258789989%7C23205712%7C256539983

[EMMA-(A01, A02) User Manual - 2023-10-31 - v02.pdf](https://github.com/wlcrs/huawei_solar/files/13445816/EMMA-.A01.A02.User.Manual.-.2023-10-31.-.v02.pdf) from https://support.huawei.com/enterprise/en/doc/EDOC1100325377/9a24721e/networking

Comments:

Updated network diagrams appear to confirm that the EMMA will replace the sDongle as the (default?) method to provide connectivity for inverters/site to FusionSolar, whilst the DDSU/DTSU-666 meters will also be superceded with the EMMA providing this functionality also (option to use inbuilt CT's <63A or connect external CT's for >63A systems).

There is only reference to modbus-tcp in relation to certificates and authenticating with 'peer NMS' and FusionSolar.

image

image

Looking at the RS485 details, it has an RS485 A and B, with A going to the inverter/cascade and B for '3rd party devices'.
Previously on the SmartLogger devices this meant the DDSU/DTSU-666 meter, however this functionality is now inbuilt to EMMA,
To date EMMA documentation has zero reference to connecting to a SmartLogger device (IMHO looks like EMMA will be pitched at home users and IF anyone needs a SL that is for more commercial installations where a DDSU/DTSU is not used/needed).
Pending more information about EMMA and its modbus-tcp specifics, given metion of it and prior support in the sDongle it must have it, but as a fallback there is the question of could RS485-B be used as method to connect and Elfin modbus-tcp appliance if needed as a 'last resort'?

image

@torwag
Copy link

torwag commented Jan 19, 2024

Hi,
just to understand, I did nowhere see a configuration with cascaded inverters. Did Huawei mention anywhere how this EMMA would work in that case. To me it looks like a combination of a smart meter (DTSU666-H) with the smart logger (SmartLogger 3000 which seems to be intended for larger PV systems) or Smart Module (Smart Module 1000).
Honestly, Huawei is terrible in naming devices so that it doesn't confuse the heck out of people...
SmartMeter, SmartLogger, SmartModule, SmartDongle and now EMMA....

@Roving-Ronin
Copy link
Contributor Author

@torwag the EMMA appliance is a replacement option for the DDSU/DTSU-666H, USB sDongle etc so from an inverters persepctive is doesn't matter is its 1 or 3 inverters in a cascade. Instead of wiring in the DDSU/DTSU-666H in future you'll connect the EMMA via that RS485 port.

Also read the prior posts carefully and you'll notice at the bottom of 'Figure 2-2' it mentions:

"Inverters connect to the EMMA over RS485. A maximum of three inverters can be connected in parallel"

Worth noting also is that since that post, Huawei / Shelly have also announced that EMMA can integrate with some of their devices, see:

image

@MarkusKAuatria
Copy link

Hello
EMMA is now available in Europe

When do you want to start the integration?
Thank you
Mark

@Roving-Ronin
Copy link
Contributor Author

@MarkusKAuatria

Do you have an EMMA installed already and are offering to install the current WLCRS integration version and see if it 'mostly' works already (assuming it uses the same modbus registers as the DDSU/DTSU-666H for the power meter data)? Post that your able to provide WLCRS with remote access to your setup to allow him to develop and test, for any new modbus registers that are required?

@MarkusKAuatria
Copy link

MarkusKAuatria commented Mar 16, 2024

Hello
I have already installed EMMA-A02.
YES, I can give you remote access from my HASSIO test system.
I would like to send you the login details on a private channel
(Email, Telegram,...)
I'm looking forward to a good collaboration

Konfiguration
->EMMA-A02

--> SUN2000-10KTL-M1 (Modbus 1)
---> 1. LUNA2000-15-S0 (15kw)
---> 2. LUNA2000-15-S0 (15kw)

--> SUN2000-5KTL-M1 (Modbus 2)
---> 14x SUN2000-450W-P

https://ske-solar.com/wp-content/uploads/2024/02/QuickGuide_Three-Phase_PVESSEMMA-Networking_V03_2024-01-31_EN.pdf

Attention
Emma is connected via pin 2/3 and not via PIN 5/7 like the DTSU

@Roving-Ronin
Copy link
Contributor Author

@MarkusKAuatria
Have you tried installing the integration yet, any luck ? If so, what information do you see, or are their any logs ?

"Emma is connected via pin 2/3 and not via PIN 5/7 like the DTSU"

PIN 5 ias 'shielding ground' (shared with LUNA also) with PIN7 (485A2) and PIN9 (RS485B2) being used to connect to the DTSU-666H. Are you sure that EMMA is correctly wired though with it using PIN 2 (RS485B1-1 'Differential -') and PIN 3 (RS485A1-2 'Differential +'), apart from these being from different pairs, the Huawei documentation shows it as PIN 1 (+) and PIN 3 (-) , that is also the A1/B1 pair previously used to cascade (i.e. out from 1&3 from higher up modbus device, that then goes into 2&4 from lower device in the cascade)? See diagram posted earlier/above, from the EMMA manual.

Note: This would mean that EMMA now would become the Modbus Master, with the 'primary' inverter now becoming a modbus slave to it.
This requires confirming the modbus ID# of EMMA and the inverters, as installation may now change to be using ID# of EMMA, then Primary inverter and lastly seconary inverter.
i.e. if originally inverters installed with Primary inverter is ID#1, Secondary is ID#2 and when EMMA was installed it just assumed ID#3. Then installing the integration would now mean needing to use ID 3,1,2 (whereas previously the sDongle didn't have an ID and you just entered it as 1,2).

Hoping that Huawei used the same modbus registers that the DDSU/DTSU-666H meter uses, meaning the Smart Meter part of EMMA will work with WLCRS. I haven't see any updated information as to Modbus Registers for EMMA, and IF it adds any new ones to 'share' whatever additional data has / provides access to.

@wlcrs
Copy link
Owner

wlcrs commented Mar 18, 2024

@MarkusKAuatria
Do you have an account on https://community.home-assistant.io/ ? I can send you my contact details via private message over there.

Can you also download the latest (and current only) file from https://support.huawei.com/enterprise/en/fusionsolar/smarthems-pid-256539983/software/ and upload it here? For SUN2000 software downloads, the ZIP-files with the firmware updates also include PDF's with documentation on how the available modbus registers look like. As I do not own such a device, I do not have access to those downloads.

@MarkusKAuatria
Copy link

@wlcrs
My https://community.home-assistant.io/ account ist the same as the GITHUB account (I changed it now)

@Roving-Ronin
Sorry it is 7 and 9
The Modbus Adress from EMMA is 0 so it is 0,1,2
image

@torwag
Copy link

torwag commented Mar 19, 2024

Just out of curiosity, what would be the benefit of the EMMA for home assistant integration? As I understood, the "smart" features would be why we connect it to home assistant in the first place.
If the connection would be easier, that would be a win, I'm just in the middle of setting up a dedicated Rpi-based home assistant server (as remote unit to the main server). Dealing with (in my case) three wifi dongles for three inverters, is a bit a hassle right now, as HaOS doesn't come with the wifi kernel modules yet. As usual I was stupid selecting the "wrong" wifi sticks 😉

@Roving-Ronin
Copy link
Contributor Author

Roving-Ronin commented Mar 19, 2024

@torwag EMMA combines the modbus access and network connectivity (WiFi and Ethernet) previously provided by the sDongle, the DDSU/DTSU-666H smart meter functions into one unit, whilst then also adding support and connectivity for the Huawei EV charger(s), Load Shedding/Control (via select Shelly devices) and abilty to access cloud data (e.g. forecasts) and your usage trends to provide some 'intelligence' to a Huawei installation.

Yes WLCRS + HA users will still be taking this a step further and pulling in their own data and making automations etc, but the main thing is EMMA appears to be 'the' preferred solution for adding network connectivity, and smart/consumption meter to Huawei installs going forward (vs multiple seperate items). Huawei is also pushing this by the fact that the new Backup Box (aka the SmartGuard) includes an EMMA built into it. From a business perspective for Huawei it also means they are moving from having to buy another vendors consumption meter and work with it, to now producing and selling their own meter (and extra functionality) that they control the IP for, meaning better profits potentially but also potentially reducing their support costs (from issues arising from DDSU/DTSU-666H).

BTW trying to remember, was your setup the one with 3 inverters, with each essentially going to seperate users/apartments? Otherwise, why don't you just cascase them all together (bit of Cat5e cable), the only need 1 sDongle connection for the lot and 1 DDSU/DTSU-666H meter?
Are you linking the 'remote' HA to the main server? Have you looked at: https://github.com/custom-components/remote_homeassistant


@MarkusKAuatria
Where you able to get a hold of the file that Thijs (WLCRS) was after, containing the modbus definitions?
Did you have any luck trying to install WLCRS integration and entering ID# 0,1,2 ? (would be nice if that works, confirming the EMMA is just passing through the inverter / optimiser / battery modbus registers like the existing connection methods do, even though you'd have to presume EMMA has some additional ones for itself, let alone the Smart EV charger ones).

@wlcrs
Copy link
Owner

wlcrs commented Mar 19, 2024

I've received access details from Markus. The EMMA device does not have any open TCP ports at the moment, so he will need to check if he can access a setting to fix this (which seems to be available according to a screenshot from the manual ).

Alternatively, the EMMA-device also exposes a serial Modbus RTU interface on 2 pins (cfr. bottom screenshot of #498 (comment)). So that is another scenario that we can explore if necessary.

@fkhofmann
Copy link

Hello, now that there should be more EMMAs in the field, have you received any new information about possible ways to access EMMA? :)

I hope Huawei won't keep it closed to third-party apps for querying their devices.

@wlcrs
Copy link
Owner

wlcrs commented Jun 5, 2024

The EMMA device I had access to via Markus does not answer to any queries: not via TCP, not via RTU (serial). We haven't been able to obtain instructions on how we can locally connect to a solar installation with EMMA from Huawei.

I would urge everybody considering to order a Huawei Solar installation with EMMA device to first contact Huawei to verify if a local Modbus-connection is supported. If possible, please obtain a manual on how to achieve this and share it with me here.

@fkhofmann
Copy link

Oh, that's too bad, that is certainly not an optimal situation. I have also tried to get information on the topic as a potential future Huawei customer. Huawei's technical support didn't provide any information because I am not a customer (couldn't provide a device serial no) and referred me to a distributor. The distributor also didn't want to tell me anything because I am an end user.

I guess a Huawei device owner would have to open a service request.

@MarkusKAuatria
Copy link

MarkusKAuatria commented Jun 5, 2024

Hallo
These were the last two feedbacks from HUAWEI Support

  • (Freitag, 5. April 2024 15:08) Unfortunately, we do not have any guideline about how access works exactly and how the individual services can be accessed (Modbus TCP, MQTT, web,...) especially for EMMA-A02.

  • (Friday, 5 April 2024 14:30) Please be advised that we created related SR NO. xxxxxxx and we will come back with a resolution as soon as possible. Kindly ask you to choose the option “Reply All” when communicating with our engineers in order to track your response easily.

@tmenguy
Copy link

tmenguy commented Jun 5, 2024 via email

@Roving-Ronin
Copy link
Contributor Author

@tmenguy the issue is adding support for EMMA, especially given in future installations it replaces the sDongle, DDSU/DTSU-666H consumption meter and becomes the primary means for communication for the plant (that also has 2 x M1 3p inverters).

@tmenguy
Copy link

tmenguy commented Jun 6, 2024

Yes, and I was looking at adding an EMMA to my existing installation (with the new backup box ... but it is not 3phases for now it seems). But correct me if I'm wrong: it will replace the meter and Sdongle all at once, but the inverter wifi will stay no? so perhaps there is a way to still connect through it?
(Or perhaps I'm completely dumb here and it is the Sdongle that was creating all the modbus connection and the inverter wifi was only a way to access the Sdongle capabilities, and the inverter is only a pass through. But if not it means at least the inverter inner meter and commands could still be available through the wifi no? )

@Roving-Ronin
Copy link
Contributor Author

@tmenguy The EMMA-A02 is available to support 3p, with AC voltage options of:
1P2W: 100 ~ 240 V, 50 / 60 Hz
3P3W: 346 ~ 415 V, 50 / 60 Hz
3P4W: 346 ~ 415 V, 50 / 60 Hz

The SmartGuard documentation has started mentioning a 'SmartGuard-63A-T0' with T0 = Three-phase Whole Home Backup system. See:

User Manual: https://support.huawei.com/enterprise/en/doc/EDOC1100366781?idPath=258788303%7C258788489%7C258789981%7C21102413%7C255740899

Networking Quick Guide: https://support.huawei.com/enterprise/en/doc/EDOC1100366779?idPath=258788303|258788483|258789967|21102414|21571652

Be aware though, that whilst it mentions 'whole home backup' have a look at the wiring diagram:
image

You'll note that it refers to 'Backup Load' and 'Non Backup Load', then have a look at the new 5k-12k MAP0 inverter series manual, with some handy networking diagrams on page 17-18:
https://support.huawei.com/enterprise/en/doc/EDOC1100366802?idPath=258788305|254827209|258792409|22755755

image

From this it appears the SmartGuard-63A-T0 will allow connecting the grid feed into it and then attaching the (bulk of the) house to its protected output up to 63A, so its now inline between your previous grid feed and the switchboard. You could then attach your 3p HVAC/Ducted Aircon unit to the unprotected circuit. Idea appears to be that you are protected this way and then can add an Automatic Transfer Switch (ATS) in to allow cutting over from a grid/mains feed to having a generator kick in, so your LUNA ESS + SmartGuard 'protects' the house for the 20ms until the generator kicks in automatically.

Note that is with the MAP0 inverters and typically it costs a few extra $ for a 3p with a automatic start. If you have the $ for a 3p generator and already have a M1 inverter(s), you could just have an ATS / Manual Transfer Switch (that don't cost much) installed and rely upon the LUNA covering you for a few minutes and walking outside and manually starting the generator.

@ismiregal17
Copy link

Hello, the new backup box Smartguard can also only supply 1 phase. The 3-phase designation refers to the inverter. There will be a real 3-phase backup box from Huawei in the future, but it will not be able to work together with the inverters currently on the market. There will be a new inverter for this backup box. The reason is that the current inverters are not unbalanced load capable.

@tmenguy
Copy link

tmenguy commented Jun 8, 2024

@Roving-Ronin thanks a lot for the, as always very detailed answer, I've seen only the S0 and not the T0 smartGuard, but loosing HA connection may be a no brainer to me if we don't find a way to connect to EMMA.
and well what you say @ismiregal17 is even worse then .... it means no true 3p backup for any of our current inverters (even my brand new MB0) ...something I completely missed, and well not happy at all (well I will survive probably :) )

@Roving-Ronin
Copy link
Contributor Author

@ismiregal17
"The reason is that the current inverters are not unbalanced load capable."

Good point, overlooked that....

@dragosmd
Copy link

Hi all,
I've just installed Huawei SmartGuard-63A-S0 with EMMA-A02 and updated it the latest version that allowed me to open 502 port.
I've tried everything connecting to it via Modbus but no luck.
Anything that I could do to help this move on?

I'm still pulling data though the Inverter AP

@dernicc
Copy link

dernicc commented Aug 1, 2024

I updated my EMMA-A02 to the latest version and now I got the following screen for adding a third party management system..

Screenshot_20240801_061457_FusionSolar

Does anyone has any info or manual regarding the communication with third party management systems?

@wlcrs
Copy link
Owner

wlcrs commented Aug 3, 2024

I've implemented initial support for EMMA devices, but as I do not own this device, I was not able to properly test this. I don't want to do a release before I have confirmation that it works.

To test:

0/ make sure that the firmware version of your EMMA is V100R024C00SPC100 or higher.
1/ turn off TLS encryption for Modbus TCP:

image

2/ download the repository ZIP file: https://github.com/wlcrs/huawei_solar/archive/refs/heads/main.zip
3/ extract the ZIP archive and rename the folder to huawei-solar
4/ put it in the config/custom_components folder of your Home Assistant.
5/ follow instructions from README: https://github.com/wlcrs/huawei_solar?tab=readme-ov-file#installation

If the documentation is correct, the EMMA will always be device 0. You need to lookup and add the slave ids of your inverters yourself, as they were chosen by your installer.

If I didn't make any error (which is highly unlikely), the integration should properly initialize.

If it fails, then please post the relevant parts of the full logs with the errors (buttons on the bottom of the Logs page).

If you don't see anything in the logs, then add the following to your configuration.yaml and try again:

logger:
  logs:
    pymodbus: debug 
    huawei_solar: debug
    homeassistant.components.huawei_solar: debug

@ismiregal17
Copy link

@wlcrs I have tried it but unfortunately it does not work.

This error was caused by a custom integration

Logger: custom_components.huawei-solar.config_flow
Quelle: custom_components/huawei-solar/config_flow.py:410
Integration: huawei-solar
Erstmals aufgetreten: 19:03:43 (Incidents 5): Last logged 19:04:30

Unexpected exception while connecting via ModbusTCP
Traceback (most recent call last):
File "/config/custom_components/huawei-solar/config_flow.py", line 410, in async_step_setup_network
info = await validate_network_setup(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/huawei-solar/config_flow.py", line 104, in validate_network_setup
bridge = await HuaweiSolarBridge.create(
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: HuaweiSolarBridge.create() got an unexpected keyword argument 'host'

@dragosmd
Copy link

dragosmd commented Aug 3, 2024

Going to verify the tls. L.E. Checked and SSL is off.

Firmware is ok
config # nc -vz 192.168.1.11 502
192.168.1.11 (192.168.1.11:502) open

I've deleted the invertor set to 192.168.200.1 I can't even add that one same error with port 6607. So its not related to emma.
1.5.0.a1 has 94 entities found vs 88 I had previously. Can't seem to find yet the difference. But I can't add EMMA on any ID 0,1,2, even 123 slave as Invertor is being mentioned in Fusion Solar Web.

2024-08-03 21:23:31.734 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xfb\xc0']
2024-08-03 21:23:31.734 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x03\xc5']
2024-08-03 21:23:31.734 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x03+']
2024-08-03 21:23:31.785 DEBUG (MainThread) [pymodbus.logging] Adding transaction 30
2024-08-03 21:23:31.785 DEBUG (MainThread) [pymodbus.logging] Resetting frame - Current Frame in buffer -
2024-08-03 21:23:31.785 DEBUG (MainThread) [pymodbus.logging] send: 0x0 0x1e 0x0 0x0 0x0 0x6 0x0 0x3 0x93 0x80 0x0 0x1c
2024-08-03 21:23:31.805 DEBUG (MainThread) [pymodbus.logging] recv: 0x0 0x1e 0x0 0x0 0x0 0x3b 0x0 0x3 0x38 0x3 0xc 0x0 0x0 0x0 0x2 0x11 0x8c 0xff 0xea 0xff 0xff 0xfb 0xe8 0x0 0x0 0x27 0x10 0x0 0x0 0x27 0x10 0x0 0x0 0x23 0x28 0x0 0x0 0x23 0x28 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x3 0x80 0xe0 0x0 0x3 0x77 0x4e 0x0 0x0 0x3 0xc5 0x0 0x0 0x3 0x2b old_data: addr=None
2024-08-03 21:23:31.805 DEBUG (MainThread) [pymodbus.logging] Processing: 0x0 0x1e 0x0 0x0 0x0 0x3b 0x0 0x3 0x38 0x3 0xc 0x0 0x0 0x0 0x2 0x11 0x8c 0xff 0xea 0xff 0xff 0xfb 0xe8 0x0 0x0 0x27 0x10 0x0 0x0 0x27 0x10 0x0 0x0 0x23 0x28 0x0 0x0 0x23 0x28 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x3 0x80 0xe0 0x0 0x3 0x77 0x4e 0x0 0x0 0x3 0xc5 0x0 0x0 0x3 0x2b
2024-08-03 21:23:31.805 DEBUG (MainThread) [pymodbus.logging] Factory Response[ReadHoldingRegistersResponse': 3]
2024-08-03 21:23:31.805 DEBUG (MainThread) [pymodbus.logging] Getting transaction 30
2024-08-03 21:23:31.805 DEBUG (MainThread) [pymodbus.logging] Very short frame (NO MBAP): wait for more data
2024-08-03 21:23:31.805 DEBUG (MainThread) [pymodbus.logging] [780, 0, 2, 4492, 65514, 65535, 64488, 0, 10000, 0, 10000, 0, 9000, 0, 9000, 0, 0, 0, 0, 0, 3, 32992, 3, 30542, 0, 965, 0, 811]
2024-08-03 21:23:31.806 DEBUG (MainThread) [pymodbus.logging] handle: [b'\xff\xff', b'\xfb\xe8']
2024-08-03 21:23:31.806 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x03', b'\x80\xe0']
2024-08-03 21:23:31.806 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x03', b'wN']
2024-08-03 21:23:31.806 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x03\xc5']
2024-08-03 21:23:31.806 DEBUG (MainThread) [pymodbus.logging] handle: [b'\x00\x00', b'\x03+']
2024-08-03 21:23:32.491 ERROR (MainThread) [custom_components.huawei_solar.config_flow] Unexpected exception while connecting via ModbusTCP
Traceback (most recent call last):
File "/config/custom_components/huawei_solar/config_flow.py", line 410, in async_step_setup_network
info = await validate_network_setup(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/huawei_solar/config_flow.py", line 104, in validate_network_setup
bridge = await HuaweiSolarBridge.create(
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: HuaweiSolarBridge.create() got an unexpected keyword argument 'host'
2024-08-03 21:23:32.818 ERROR (MainThread) [custom_components.huawei_solar.config_flow] Unexpected exception while connecting via ModbusTCP
Traceback (most recent call last):
File "/config/custom_components/huawei_solar/config_flow.py", line 410, in async_step_setup_network
info = await validate_network_setup(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/huawei_solar/config_flow.py", line 104, in validate_network_setup
bridge = await HuaweiSolarBridge.create(
^^^^^^^^^^^^^^^^^^^^^^^^^

@tudor0410
Copy link

@tudor0410 try this setup: 1 Connection to EMMA without secondary Slave-ID 2 New connection to inverter querying only the Inverter ID. This way I currently manage the battery. image

Any other ideea on how to fix the batteries settings?
This is clearly not working for me :(
any other preconditions needed?
Would help a lot to limit battery charging on a sunny day and still export with small power when I'm not consuming. Otherwise after battery is full, inverter starts exporting full power and enters in protection very often.

@dragosmd
Copy link

dragosmd commented Oct 2, 2024

@tudor0410 like I've mentioned before you need a secondary connection for now. Not to Emma up. You need to connect to the inverters IP. I'm using a TPLink MR-3020 that has the option for AP-Client.

I didn't find any other option fixing this though Emma.

Your problem with the grid can be solved with Q-U + HVLT and battery set to TOU and excess fed to grid. When HVLT will be triggered the export excess will be redirected to the battery. That was my option for Romanian Grid 🤦‍♂️

hopefully @wlcrs or someone more experienced will find the fix.

@tmycgn
Copy link

tmycgn commented Oct 3, 2024

There is a new Emma release 101 that fixes the modbus connectivity via WiFi. So who is still struggling to connect via WiFi try installing: SmartHems V100R024C00SPC101

Soon there will be also a new release for smartguard: V100R023C10SPC104

@dragosmd Sounds good, where did you get it shown? They're not available in the portal or on mobile. Or was it possibly recalled?

@wlcrs Is there a chance that the currently great running version 1.5.0a1 will become public? 😉

@dragosmd
Copy link

dragosmd commented Oct 3, 2024

@tmycgn Emma is public, as for SG the relevant version is specified in the Emma release notes but not yet published in the huawei website.

https://support.huawei.com/enterprise/en/fusionsolar/smarthems-pid-256539983/software/263209812

@tudor0410
Copy link

@tudor0410 like I've mentioned before you need a secondary connection for now. Not to Emma up. You need to connect to the inverters IP. I'm using a TPLink MR-3020 that has the option for AP-Client.

I didn't find any other option fixing this though Emma.

Your problem with the grid can be solved with Q-U + HVLT and battery set to TOU and excess fed to grid. When HVLT will be triggered the export excess will be redirected to the battery. That was my option for Romanian Grid 🤦‍♂️

hopefully @wlcrs or someone more experienced will find the fix.

Thank you very much!
It works like that. I've moved the raspberry Pi closer to inverter and used it's internal wifi to connect to inverter and everything works good now. all settings for battery are there.
Also, I'm starting to experiment with TOU with only one slot to discharge and it exports all excess and doesn't charge battery. I'll see tomorrow if lower HVRT also helps to redirect excess to battery or I need a script to calculate the max charging power depending on voltage and give the rest outside.
But anyways, TOU will be awesome for charging EV from solar only using Lektri.co with EM.

Let's wait for a fix from @wlcrs to get rid of secondary connection.
For sure it's some register change when addressing EMMA

@Roving-Ronin
Copy link
Contributor Author

@tmenguy would you be able to assist, trying to confirm the output for the modbus register that gives the model of battery connected? To date I've only been able to gain access to a LUNA S0 15kWh system to test this (it reports "LUNA 2000"), but needing to confirm what a LUNA S0 system reports (would be nice if it reported 'LUNA 2000 S0' or something to diffentiate from S0).

If possible, would you be able to paste these two pieces of code into the Develop Tools --> Template page and let me know what it reports? Edit: Just noticed you have an MB0 also, if you could confirm the output for it also ?

template:
##########################################################
#
#   Detects if there is a Huawei L0, L1, M1, MB0 or iStore
#   1PH or 3PH inverter, and publishes its model number.
#
  - sensor:
    - name: "Inverter 1 - Model"
      unique_id: inverter_model
      icon: phu:huawei-solar-inverter
      state: >-
        {{ device_attr("sensor.inverter_input_power", "model") | regex_findall_index('(SUN\d+-\d+KTL-[L|M|MB]\d+)|(IS-HYB-\d-\[1|3]PH)', 0) | first }}
      availability: >-
        {{  (states('sensor.inverter_input_power') not in [ 'unknown', 'unavailable', 'none' ] ) }}

  - sensor:
    - name: "Inverter 2 - Model"
      unique_id: inverter_model_2
      icon: phu:huawei-solar-inverter
      state: >-
        {{ device_attr("sensor.inverter_input_power_2", "model") | regex_findall_index('(SUN\d+-\d+KTL-[L|M|MB]\d+)|(IS-HYB-\d-\[1|3]PH)', 0) | first }}
      availability: >-
        {{  (states('sensor.inverter_input_power_2') not in [ 'unknown', 'unavailable', 'none' ] ) }}


##########################################################
#
#   Detects if there is a Battery attached to either inverter
#   and publishes the total number of batteries (stacks), up to 4.
#

  - sensor:
    - name: "Battery 1 - Model"
      unique_id: battery_model
      icon: phu:solar-battery-15
      state: >-
        {% set device_model = device_attr('sensor.battery_1_state_of_capacity', 'model') %}
        {% if device_model == none %}
          Not Installed
        {% else %}
          {{ device_model }}
        {% endif %}


  - sensor:
    - name: "Battery 2 - Model"
      unique_id: battery_model_2
      icon: phu:solar-battery-15
      state: >-
        {% set device_model = device_attr('sensor.battery_2_state_of_capacity', 'model') %}
        {% if device_model == none %}
          Not Installed
        {% else %}
          {{ device_model }}
        {% endif %}


##########################################################
#
#   Uses the 'Model' sensors above, to count the number of 
#   battery stacks (not cells) installed in the site.
#

  - sensor:
    - name: "Batteries - Installed"
      unique_id: batteries_installed
      icon: phu:solar-battery-15
      state: >-
        {% set battery_sensors = [
          states('sensor.battery_model'),
          states('sensor.battery_model_2'),
          states('sensor.battery_model_3'),
          states('sensor.battery_model_4')
        ] %}
        {% set installed_batteries = battery_sensors | reject('in', ['unknown', 'unavailable', 'none', 'Not Installed']) | list %}
        {{ installed_batteries | count }}


##########################################################

Version 2 - Model Detection

  - name: "Inverter #1 Model"
    unique_id: inverter_1_model
    state: >-
      {{ device_attr("sensor.inverter_input_power","model") | regex_findall_index('(SUN\d+-\d+(KTL|K)-(L|LC|M|MB|MAP)\d)|(IS-HYB-\d+-[1|3]PH)', 0) | first }}
    availability: >-
      {{ states('sensor.inverter_input_power') not in ['unknown','unavailable','none'] }}
  - name: "Inverter #2 Model"
    unique_id: inverter_2_model
    state: >-
      {{ device_attr("sensor.inverter_input_power_2","model") | regex_findall_index('(SUN\d+-\d+(KTL|K)-(L|LC|M|MB|MAP)\d)|(IS-HYB-\d+-[1|3]PH)', 0) | first }}
    availability: >
      {{ states('sensor.inverter_input_power_2') not in ['unknown','unavailable','none'] }}

Using custom/derived sensors and some new sensors coming with the next release from WLCRS, allows seeing:

image

..now if there was just a way to query firmware versions.

Many Thanks!

@XalaTheShepard
Copy link

Dear all,

I noticed this subject while looking for more information.
In spring 2025 I will install solar panels, home batteries and an EV charger all of the Huawei brand.
The installer prefers to install it with the EMMA smart meter.

Reading through this topic, I still don't know if the EMMA smart meter can be integrated in HA.
What are the things I should be aware of to have the solar panel, home battery and EV charger integrated in HA?

I already use HA for 8 years but still have a lot to learn about the green energy integrations.

Many thanks for the feedback and advice. I hope to be able to support you as well in half a year.

Kind regards,

Robin

@dragosmd
Copy link

dragosmd commented Oct 12, 2024 via email

@XalaTheShepard
Copy link

Dear dragosmd,

Many thanks for your reaction.
Is this the main topic to keep up-to-date about the EMMA developments or are there other ongoing to keep an eye on?

Kind regards,

Robin

@dragosmd
Copy link

dragosmd commented Oct 12, 2024 via email

@XalaTheShepard
Copy link

Dear Dragosmd,

Do you require any additional installations to read the information from the inverter? And has it to be hard wired?

Many thanks for the feedback.

Kind regards,

Robin

@dragosmd
Copy link

dragosmd commented Oct 12, 2024 via email

@XalaTheShepard
Copy link

Dear Dragosmd,

Many thanks for all the information.

Do you happen to know if EV chargers are also included in the integration?

Kind regards,

Robin

@dragosmd
Copy link

dragosmd commented Oct 12, 2024 via email

@XalaTheShepard
Copy link

I am also still in hybrid level, but am doing the necessary investments already since in Belgium the sale of gas and fuel powered cars will be prohibited in 2030 and at that moment both me and my wife also have to we will have to buy a new car since our is already 4 years old at this moment.

@dragosmd
Copy link

dragosmd commented Oct 12, 2024 via email

@XalaTheShepard
Copy link

If the EV charger is paid by the employer, I don't complain 😉

@wlcrs
Copy link
Owner

wlcrs commented Oct 14, 2024

v1.5.0 alpha 1 is available now with preliminary EMMA support.

Please open new issues when you encounter something that goes wrong. Please properly complete the issue template, as that contains important information for me to help debug.

@wlcrs wlcrs closed this as completed Oct 14, 2024
@PiGuyHome
Copy link

  • Connection of the EMMA via LAN, WLAN does not work (Fusion Solar App with installer > Connect EMMA > Communication configuration > Router configuration>Select LAN)
  • For the physical LAN connection, use the WAN port on the EMMA below, NOT the LAN

Is there now any possibility to connect to EMMA via WLAN? I do not have ethernet installed in my power box where EMMA is placed.

@dragosmd
Copy link

dragosmd commented Oct 17, 2024 via email

@PiGuyHome
Copy link

If you read the hole thread ... yes. With latest update 101 wlan now works on modbus. Cheers Sent from Gmail Mobile

I read it but somehow did not see or realize your comment (for sure as it was exactly what I was looking for 😆). Thank you so much! I will do the update and test again.

@tmycgn
Copy link

tmycgn commented Oct 25, 2024

Short feedback at this point after a few weeks of operation, from my point of view it works great. Thank you @wlcrs @Roving-Ronin !

@tmenguy
Copy link

tmenguy commented Oct 25, 2024

@Roving-Ronin Really sorry ! missed this one

Here are the results:

##########################################################

Detects if there is a Huawei L0, L1, M1, MB0 or iStore

1PH or 3PH inverter, and publishes its model number.

  • sensor:
    • name: "Inverter 1 - Model"
      unique_id: inverter_model
      icon: phu:huawei-solar-inverter
      state: >-
      {{ device_attr("sensor.inverter_input_power", "model") | regex_findall_index('(SUN\d+-\d+KTL-[L|M|MB]\d+)|(IS-HYB-\d-[1|3]PH)', 0) | first }}
      availability: >-
      {{ (states('sensor.inverter_input_power') not in [ 'unknown', 'unavailable', 'none' ] ) }}

The regex is not working but
device_attr("sensor.inverter_input_power", "model") gives me this:

SUN2000-15K-MB001076371-006

I have no second inverter so the other sensor is not working

##########################################################

Detects if there is a Battery attached to either inverter

and publishes the total number of batteries (stacks), up to 4.

  • sensor:
    • name: "Battery 1 - Model"
      unique_id: battery_model
      icon: phu:solar-battery-15
      state: >-
      {% set device_model = device_attr('sensor.battery_1_state_of_capacity', 'model') %}
      {% if device_model == none %}
      Not Installed
      {% else %}
      {{ device_model }}
      {% endif %}

for the battery:
device_attr('sensor.battery_1_state_of_capacity', 'model') gives me only:

LUNA 2000

Hope this helps

@Roving-Ronin
Copy link
Contributor Author

@tmenguy

Thanks for that. Is 01076371-006 your inverters serial number, so as an EMMA user it's reporting your model name + serial as one string ?

If it's OK, I'll send you some updated code (later), to test and get this working for 'non EMMA and EMMA users'?

@tmenguy
Copy link

tmenguy commented Oct 26, 2024

Hi,

I’m not a EMMA user … and this number (SUN2000-15K-MB001076371-006 this is my Device name it seems) is not my serial number …

BR
Thomas

@andheller123
Copy link

andheller123 commented Oct 26, 2024 via email

@fkhofmann
Copy link

I've also tried your code on the tempalate dev page.

My setup:
Inverter: SUN2000-10KTL-M1
Battery: LUNA2000 S1 7
EMMA

Output Inverter (with regex):
SUN2000-10KTL-M1

without regex I've got also a number behind the model description (01074311-0).
It's Huawei's model number for the device:

01074311-006: SUN2000-10KTL-M1
01076370-006: SUN2000-15K-MB0
01076371-006: SUN2000-17K-MB0

Output Battery:
LUNA2000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-hold Don't close when stale
Projects
None yet
Development

No branches or pull requests