ESY Sunhome Integration

I just pulled the trigger on an ESY Sunhome system; HM6-30 to augment my existing 6.6kW solar with 5kW Sungrow inverter that I plan to leave as-is for warranty purposes. Therefore an AC coupled system.

So here I am starting a thread to begin conversation about integration of the ESY Sunhome system into Home Assistant…

So first, let it be known, there is an existing integration that has been worked on over here - It’s practically got everything you would need to integrate, and uses MQTT based approach to retrieve inverter parameters.

However, there’s two big shortcomings;

  1. Reliance on that public (no auth) MQTT server :nauseated_face:
  2. The MQTT values omit cumulative production/consumption values, therefore relying on integral Riemann Sum calculations to produce kWh values from instantaneous kW values. There are updated too infrequently which will result in measurement inaccuracies over time. And when the network goes out or Home Assistant is not running the values cannot be counted.

I reached out to ESY earlier last week before signing my contract to see if they were open to sharing any RS485/modbus specification with me, however was met with overall reluctance on that front:

Hi Nick,

Thank you very much for reaching out to us.

Unfortunately, we currently do not provide the access to Modbus/RS485 data interface on residential products. We have already discussed this issue with our app development team, but due to limited development resources, this functionality may not be available in this year. Instead, we recommend you to use our mobile application, ‘ESYsunhome’, which allows you to view, configure, and manage your battery-inverter system fully online. I have attached the user guide to this email for your reference.

Please feel free to reach out to us if you have any further questions.

Which is a bit of a shame. I will try going back and forth with them a little to see what wiggle room we might have, but ultimately the best outcome here would be to achieve a truly local integration (even if that is just Modbus over TCP/IP).

There’s some cross-discussion happening over on Whirlpool and I’ve been discussing with a few folks over in the ESY Sunhome Battery Users Australia facebook group.

This brand has a lot going for it, and I really want it to succeed and achieve a critical mass of adoption - It is very reasonably priced hardware in a stackable form factor. The only piece that seems to be letting it down right now (especially compared to upper-tier products like Sigenergy is the software and integration)

Definatly on board with this one, keep the pressure on for those modbus registers

Hi Nick,
saw you mention this thread on WP.
I have (2) ESY batteies on order . I will be very interested in HA automation. I have some simple automations to try to make use of Amber wholesale pricing (SE, but battery control not yet working).
I expect to have to use the ESY app for a while until I cobble up some HA automation for it.
I am very much a novice and appreciate all the help from the community.

I am thinking the same ESY told me //ing two inverters new software will be available end of September BTW whats your cost an who is the installer?

I put together a custom component integration based on the existing work, will investigate local integration but for now it does the job… GitHub - branko-lazarevic/esysunhome

1 Like

This is awesome, great job pulling that together. Once mine is installed I’ll start seeing what can be done for a local integration - I really want to get those missing cumulative statistics into Home Assistant (consumption/production/grid import/export) rather than relying on integral calculation.

1 Like

I’ve been talking a shot at a local integration. The mobile app is very poorly made and thankfully it will be asy to create a “fake” implementation of the API it very insecurely talks to (using unencrypted HTTP to store sensitive personal information in 2025, c’mon!).

I’m also able to get the battery to send data to an MQTT server I control via a combination of a Destination NAT rule and some DNS entries (I’m pretty sure the NAT is all that’s needed). The issue is that it sends data to the MQTT server using some sort of encoded message, likely a protocol buffer.

I’ve been trying to extract the data from the buffer but it’s very difficult and I’m not an expert with it.

Here’s what I have so far:

                          batterySoc pvPower                 gridPower loadPower                    wifiStrength                          loadPower(?)
080D1001980103A2013 40104 64         D618    0095020000 E713 EB04      4306      9A8901053C9A890100 D2           FFFFFFFFFFFFFFFF01FFFF03 85BB         02FFFF03 BF89028C03D5 FD03
                          100        3881                    3382      499                          -45

If I could figure out what the format of these messages is, I believe it would be quite simple to create a local integration.

You can capture these messages by subscribing to the public MQTT server (seriously wtf):

mosquitto_sub -h "99.83.178.210" -p 1883 -t "/SERVICE/<device id>/NEWS" -v -F %X

(You can also use a tool like MQTT Explorer or MQTTX but they dump the output in a “raw” format which I haven’t figured out a good way to handle)

If anyone has any experience with reversing this kind of information, please let me know.

Yeah… the S in IoT stands for security… you can subscribe to parameters from anyone’s inverter through their public MQTT server.

Short of some man-in-the-middle solution, I believe that the only true way for a local integration that supports setting parameters like charge/discharge current/mode will be via modbus, which they are not forthcoming with documentation on…

How are you triggering the battery to publish information? i know how the app does it but if you can trigger it locally then i think we can make a truly local integration. Check /APP/[DEVICE ID]/NEWS for more readable data on your battery

Hi Branko,

I am hoping you are still hacking your ESY battery. I want to set the amount of charge to buy overnight (cheep power) based on my forecast solar generation for tomorrow. I have the a script running, using your MQTT hack, and see you are setting “mode” I was hoping you also knew how to set “Cut-off soc of electricity purchase (%)”.

At this stage it can be done via the API, i haven’t figured out how to do it via MQTT but there will be a way… There’s some information on the endpoints and data to be sent in the airzone-sama github page. In the meantime, i have been working on the modbus integration, at the moment im just reading registers for better reporting but hopefully it should be able to handle everything locally once we get more info. The modbus integration does require some hardware, the project is here: GitHub - branko-lazarevic/esy_sunhome_modbus: ESY Sunhome HM6 - Modbus Integration

1 Like

This worked for me. Cheers

#-----------
    async def set_charge_cut_off(self, chargeCutOff: int):
        #ESY_SAVE_ENDPOINT = "/api/lsydevicechargedischarge/save?deviceId=
        await self.get_bearer_token()
        url = f"{ESY_API_BASE_URL}{ESY_SAVE_ENDPOINT}{self.device_id}"
        headers = {"Authorization": f"bearer {self.access_token}"}
        _LOGGER.info(f"Setting chargeCutOff to {chargeCutOff} for device {self.device_id}")
        async with aiohttp.ClientSession() as session:
            async with session.post(url, json={"chargeCutOff": chargeCutOff, "deviceId": self.device_id}, headers=headers) as response:
                _LOGGER.debug(f"Response status: {response.status}, Response body: {await response.text()}")
                if response.status == 200:
                    _LOGGER.debug(f"chargeCutOff successfully updated to {chargeCutOff}")
                else:
                    raise Exception(f"Failed to set mode. Status code: {response.status}")
        await session.close()
#-----------

Thanks @Branko56 for the great work. I followed the instructions on your git (left the device id blank), but couldn’t get it to work. I went back to the origin integration mentioned in the first port, and there is the script to get the ID. So I reinstalled your integration, configured it using the ID returned by the script, and it worked :slight_smile:
I just thought I should mention it here in case anyone runs into this issue.

I was also wondering about your modbus solution:

  • You mention it requires * 120Ω resistance 120Ω Termination Resistor, but I couldn’t see where it goes in your wiring diagram.
  • Could you post a photo of your inverter to see how you plugged it there?
  • In the configuration part, you give all the modbus config setting. but what is it that needs to be configured? the ESP32 unit? If so how do you configure it?
  • What’s the cable you have have between the RS485 unit and the ESP32S3?
  • in the home assistant section you mention All sensors automatically appear in Home Assistant via the API. If my understanding is correct and based on my assumption in the config question above, once you have configured the ESP32 unit, there is nothing to do in home assistant? is the mod module sending the data to esy MQTT, which you then retrieve from within your integration?
    Thanks again for all the great work