# Implementation DEYE Inverter - Approach

**URL:** <https://community.openems.io/t/implementation-deye-inverter-approach/2541>\
**Category:** English Forum\
**Created:** [April 4, 2024, 8:06am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541 "2024-04-04T08:06:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 4, 2024, 8:06am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/1 "2024-04-04T08:06:07Z")

</div>

Hello,

I´m trying to implement the DEYE Inverter (DEYE SUN-12K-SG04LP3-EU). Thanks to @acabrera I got a brief overview how to implement the hybrid battery inverter. I still try to figure out how to implement the whole system. My approach after some weeks of trying is now following. The Inverter holds data in his register for following things I need.

- Grid Active Power
- PV Active Power
- Battery Stuff

Now my approach would be to implement three new Components:

- Meter 1 - Type: GRID (Reads the data from the specific register in the inverter)
- Meter 2 - TYPE: PRODUCTION (Reads the data from the specific register in the inverter)
- ESS (Regulates Power and Battery stuff)

Is this the architecture openEMS wants?

Now I´m stuck on the PRODUCTION Meter. I´m reading the value from the register but in the UI the value is summed up to consumption. After some trial and error wrote a dummy value into active power and wrote the meter like the PV Inverter Simulator Meter. But still the active power is added to the consumptation. When only using the PV Inverter Simulator Meter the UI displays it the right way.

Here is the UI with my own meter, where I strictly write 1000 as active power

 ![Bildschirmfoto 2024-04-04 um 10.00.08](https://community.openems.io/uploads/default/original/2X/e/e98abc43dc83ffa135ce9310df80bf2f294cad86.jpeg)  
Here is the UI with the simulator meter, where the UI is right.  
 ![Bildschirmfoto 2024-04-04 um 10.01.26](https://community.openems.io/uploads/default/original/2X/2/2136f21316276c62a3aa0b74fb31cc5b170358a2.jpeg)

My questions are following:

- Is my approach for implementing the hybrid inverter right with three new components?
- What am I doing wrong with my own written Production Meter  
[DeyeMeterImpl.java](https://community.openems.io/uploads/short-url/aYYYbe9vzgCFAdh5Dt5scpOpUg4.java) (5.5 KB)

---

<div class="post-metadata">

**Author:** ![Sn0w3y](https://community.openems.io/user_avatar/community.openems.io/sn0w3y/32/636_2.png) [@Sn0w3y](https://community.openems.io/u/Sn0w3y)\
**Post date:** [April 4, 2024, 9:04am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/2 "2024-04-04T09:04:15Z")

</div>

I think this is exactly the same Question i got a few Months ago..

> [@ElectricityMeter General Question](https://community.openems.io/t/electricitymeter-general-question/1802/2):
>
> For future readers: this was answered here:

---

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 4, 2024, 11:45am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/3 "2024-04-04T11:45:50Z")

</div>

Thanks for the reply I now added a simulator reacting grid meter. Now the value is displayed on the grid side of the UI. I want it to be on the production side. Do you have any clue why it is still not working?

I´m setting the active power channel value to 1000 on a meter with type production.

Here is my configuration.

 ![Bildschirmfoto 2024-04-04 um 13.44.06](https://community.openems.io/uploads/default/original/2X/6/64fa1c3d699ae2d631b0366e8c857ea5737d1cfc.png)  
 ![Bildschirmfoto 2024-04-04 um 13.44.19](https://community.openems.io/uploads/default/original/2X/4/46f0e46d862413f7f5c9b5f86c8718650683bdaf.png)

---

<div class="post-metadata">

**Author:** ![Sn0w3y](https://community.openems.io/user_avatar/community.openems.io/sn0w3y/32/636_2.png) [@Sn0w3y](https://community.openems.io/u/Sn0w3y)\
**Post date:** [April 4, 2024, 12:11pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/4 "2024-04-04T12:11:47Z")

</div>

> [@Rayleigh3105](#):
>
> Do you have any clue why it is still not working?

Could you please show me your Code on GitHub as we can work on it better then

First thing is that the “Production Meter” is falsly used here as a Production Meter is really a Meter as such and not a PV-Inverter. So basically your fault is that you define it as a Meter and not a PV-Inverter.

Please share your Code on GitHub so we / I can have a look

You need to have a look in here so you know what i mean i guess:

> <https://github.com/OpenEMS/openems/blob/4b3f35b938c7de6fdc59acb5ba39465c196850ab/io.openems.edge.pvinverter.solarlog/src/io/openems/edge/pvinverter/solarlog/PvInverterSolarlogImpl.java>

---

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 4, 2024, 12:19pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/5 "2024-04-04T12:19:44Z")

</div>

Here is my repo [GitHub - Rayleigh3105/openems at production\_meter](https://github.com/Rayleigh3105/openems/tree/production_meter/). As mentioned earlier I just want to write a meter which collects the active power from the deye inverter and displays it in the UI. As you can see [here](https://github.com/Rayleigh3105/openems/blob/production_meter/io.openems.edge.batteryinverter.deye/src/io/openems/edge/deye/productionmeter/DeyeMeterImpl.java) I´m strictly writing 1000 the the active power channel of the EletricityMeter. I also have the modbus definition running but I think this is not the problem right now. I just wanted to test if I can get the active power value 1000 to the production side of the UI element. 😃

Thanks for helping out.

Greetings

---

<div class="post-metadata">

**Author:** ![Sn0w3y](https://community.openems.io/user_avatar/community.openems.io/sn0w3y/32/636_2.png) [@Sn0w3y](https://community.openems.io/u/Sn0w3y)\
**Post date:** [April 4, 2024, 12:24pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/6 "2024-04-04T12:24:58Z")

</div>

As i said. You need to differ between:

1. Production Meter as a physical Metering Device
2. ManagedSymmetricPvInverter (use this)

 ![image](https://community.openems.io/uploads/default/original/2X/a/af07e71ed30e8a7de9aef2aee364ac6b93952b3c.png)

Also please keep your Repo Up-To-Date because sometimes there are changes in the Meter Implementations so we speak about the last recent Version either way 🙂

I will have a closer look later on your Implementation and maybe fix some things

---

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 4, 2024, 12:26pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/7 "2024-04-04T12:26:52Z")

</div>

Thanks in advance I will try to get my head around it. Here are the modbus definitions of the deye inverter. now I would add register 673 and 674 to get the production energy.  
[Deye SUN Inverter Modbus manual.pdf](https://community.openems.io/uploads/short-url/eYykuRAJqP5MiSJRrJjMHGe6TnF.pdf) (194.4 KB)

---

<div class="post-metadata">

**Author:** ![Sn0w3y](https://community.openems.io/user_avatar/community.openems.io/sn0w3y/32/636_2.png) [@Sn0w3y](https://community.openems.io/u/Sn0w3y)\
**Post date:** [April 4, 2024, 2:06pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/8 "2024-04-04T14:06:21Z")

</div>

Btw:

I recommend using this tool to simulate the Modbus Devices;

[https://www.modbustools.com/download.html](https://www.modbustools.com/download.html)

ModbusSlave ! 🙂

---

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 4, 2024, 2:11pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/9 "2024-04-04T14:11:58Z")

</div>

I´m now able to retrieve the data from the inverter the right way. See latest commit. But the UI still displays it on the consumption side of the widget. I also did it like the mentioned PvInverterSolarLogImpl.  
In the log I can see that the production and consumptation is the same 😕

 ![Bildschirmfoto 2024-04-04 um 16.11.27](https://community.openems.io/uploads/default/original/2X/f/f291523e4bc7f774966f8c7ce84981cae39fae6a.jpeg)  
 ![Bildschirmfoto 2024-04-04 um 16.11.40](https://community.openems.io/uploads/default/original/2X/1/196df4e4f3aa3856b2a183e323585b9b876c92f0.png)

---

<div class="post-metadata">

**Author:** ![Sn0w3y](https://community.openems.io/user_avatar/community.openems.io/sn0w3y/32/636_2.png) [@Sn0w3y](https://community.openems.io/u/Sn0w3y)\
**Post date:** [April 4, 2024, 2:40pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/10 "2024-04-04T14:40:05Z")

</div>

Somehow the ‘Pv-Inverter’ is still missing…

@stefan.feilmeier could you maybe have a look ?

---

<div class="post-metadata">

**Author:** ![Sn0w3y](https://community.openems.io/user_avatar/community.openems.io/sn0w3y/32/636_2.png) [@Sn0w3y](https://community.openems.io/u/Sn0w3y)\
**Post date:** [April 4, 2024, 5:03pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/11 "2024-04-04T17:03:02Z")

</div>

Moment, hast du überhaupt ein echtes Grid Meter ? Also ein 3-Phasen Netzzähler?

---

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 5, 2024, 6:10am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/12 "2024-04-05T06:10:12Z")

</div>

At first I simulated the grid. Now I implemented a [grid meter](https://github.com/Rayleigh3105/openems/tree/production_meter/io.openems.edge.batteryinverter.deye/src/io/openems/edge/deye/gridmeter) which reads the data from the registers on the deye inverter. This is an old implementation I will now have a look and try to implement it like the GoodWeGridMeter

But it has the same effect

 ![Bildschirmfoto 2024-04-05 um 08.09.03](https://community.openems.io/uploads/default/original/2X/f/f0dfbcf10ecfa24adb8c1d8e1526c5c170de9d10.png)  
**Current configuration**  
 ![Bildschirmfoto 2024-04-05 um 08.09.28](https://community.openems.io/uploads/default/original/2X/d/d03c548f9c9eaaf116e3a4e11d58624bdf59f717.png)

---

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 8, 2024, 7:53am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/13 "2024-04-08T07:53:04Z")

</div>

Hey @Sn0w3y, have you had a chance to take a look at the case? Maybe I also need a simulated ESS in order to work as expected?

Greetings

---

<div class="post-metadata">

**Author:** ![Sn0w3y](https://community.openems.io/user_avatar/community.openems.io/sn0w3y/32/636_2.png) [@Sn0w3y](https://community.openems.io/u/Sn0w3y)\
**Post date:** [April 8, 2024, 10:08am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/14 "2024-04-08T10:08:33Z")

</div>

Hi @Rayleigh3105 ,

unfortunately i can not clone your Repo, maybe add me as a Maintainer on your fork please - Sn0w3y

---

<div class="post-metadata">

**Author:** ![tsicking](https://community.openems.io/user_avatar/community.openems.io/tsicking/32/954_2.png) [@tsicking](https://community.openems.io/u/tsicking)\
**Post date:** [April 8, 2024, 1:33pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/15 "2024-04-08T13:33:39Z")

</div>

Hi, I had the same problem some time ago when implementing a PV inverter. The problem is that even though a PV inverter implements the method `getMeterType()` by returning `MeterType.PRODUCTION`, the UI doesn’t know this. Instead, it checks a list of hard coded factory IDs. If the PV inverter is not in the list, it won’t show in the UI. There is a [PR](https://github.com/OpenEMS/openems/pull/2371) fixing this, but it hasn’t been merged yet.  
The `Sum` component on the other hand knows the meter type. As the consumption active power is calculated as sum of grid active power, production active power and ess active power, the production power is added to the consumption. You may also check that the channel `_sum/ProductionActivePower` contains the value.

I am aware of three ways how you can fix this:

1. Merge the PR from above into your repository
2. Add the factory ID of your inveter to the list here [openems/ui/src/app/shared/edge/edgeconfig.ts at 60b473fe7849d853deedea4d1548464d50d12abb · OpenEMS/openems · GitHub](https://github.com/OpenEMS/openems/blob/60b473fe7849d853deedea4d1548464d50d12abb/ui/src/app/shared/edge/edgeconfig.ts#L300)
3. Add a config parameter `type()` and set it to `MeterType.PRODUCTION`, as if it was a normal meter.

I am confident that at least one of the three options will work.

Best regards,  
Thomas

---

<div class="post-metadata">

**Author:** ![Rayleigh3105](https://community.openems.io/user_avatar/community.openems.io/rayleigh3105/32/1178_2.png) [@Rayleigh3105](https://community.openems.io/u/Rayleigh3105)\
**Post date:** [April 9, 2024, 7:04am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/16 "2024-04-09T07:04:47Z")

</div>

With the help of @tsicking I can now view Production and Grid values for the DEYE Hybrid Inverter. Next step is to implement the ESS. Thanks for all the help @Sn0w3y / @tsicking

 ![WhatsApp 2024-04-09 08.24](https://community.openems.io/uploads/default/original/2X/a/a4c0929b68ee1dc3fa00acc887c518903ea8d015.jpeg)

Maybe the above named PR should be merged? @stefan.feilmeier / @Sn0w3y ?

Greetings Moritz

---

<div class="post-metadata">

**Author:** ![mrdomek](https://community.openems.io/letter_avatar_proxy/v4/letter/m/3d9bf3/32.png) [@mrdomek](https://community.openems.io/u/mrdomek)\
**Post date:** [January 29, 2025, 11:44pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/17 "2025-01-29T23:44:44Z")

</div>

Hello @Rayleigh3105,

I wanted to ask how far your development status is to the Deye?  
I got a SG05LP3 two weeks ago and therefore it would be very important for me to be able to integrate it into openEMS.

Unfortunately, I don’t have any strong programming skills, but I’m quite good at hardware. Maybe I can contribute something to your development?  
I’ve already done some research on Github and also set up the IDE. I was able to fork your Deye project and get it up and running in my test environment. I noticed in the ESS part that some Modbus registers might not be correct here. Likewise, according to my current state of knowledge, it is not so easy to operate the Daye as a pure “AC coupled battery storage”, as this is apparently only possible if many registers between charging and discharging are changed at the same time.

I already have an inquiry in the Deye forum as well as at the Deye Service if there is a simpler solution.

What I have worked out so far:(I am currently testing this with iobroker)

Unload battery:  
-Workmode-\>Sale First  
-Activate Usage Time → Register 146 (Bit 0-7 =1)  
-Set Usage Time-\>Power to Time Slot → Register 154-159  
-Usage Time-\>SOC Set Actual Value → Register 166-171

Load battery:  
-Workmode-\>sale first  
-Battery settings grid charging → register 130  
-Activate usage time → register 146-no extra power setting? Alternatively, only battery setting-\>battery charging current controllable? → Register 128?  
-Usage Time-\>Grid Charging Activate → Register 172-177  
-Usage Time-\>SOC Set Over Actual Value → Register 166-171

Unfortunately not very simple, I hoped Deye has a workmode ala “AC coupled battery storage” a register to load or unload, i mean-\> power + =load; Power - = discharge and 0 = standby.  
In my opinion, the register would have to be cyclically described for safety reasons, so that the inverter does not remain in the last state in the event of a failure of the EMS and continues to work uncontrollably.  
Unfortunately, this does not seem to exist so far.

Register 77 “Active power regulation” is probably only for solar sales? I don’t have a PV system on the inverter myself, so I can’t test this.

I am happy about feedback

---

<div class="post-metadata">

**Author:** ![klinki](https://community.openems.io/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@klinki](https://community.openems.io/u/klinki)\
**Post date:** [March 18, 2025, 8:36am UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/18 "2025-03-18T08:36:07Z")

</div>

Hi everyone,

I was wondering how far along you are with your integrations for Deye hybrid systems. I am currently planning a new installation, and the Deye inverters seem very interesting due to their wide range of compatible (and affordable) batteries.

regards,  
klinki

---

<div class="post-metadata">

**Author:** ![Jaguar222833](https://community.openems.io/user_avatar/community.openems.io/jaguar222833/32/2053_2.png) [@Jaguar222833](https://community.openems.io/u/Jaguar222833)\
**Post date:** [April 22, 2025, 9:24pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/19 "2025-04-22T21:24:25Z")

</div>

Good evening!

I have a need to connect exactly the same inverter to OpenEms as you have. Is it possible to use your work? And if you can briefly explain how to integrate your solution, as I am the first time I encounter such programmes

I will be glad to any help.

---

<div class="post-metadata">

**Author:** ![klinki](https://community.openems.io/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@klinki](https://community.openems.io/u/klinki)\
**Post date:** [May 21, 2025, 12:31pm UTC](https://community.openems.io/t/implementation-deye-inverter-approach/2541/20 "2025-05-21T12:31:28Z")

</div>

I’ve been working for almost two weeks on a control solution for a Deye SUN-20 K.  
Discharging is now more or less under control:

Select external power-limit mode 142 → 2  
Enable Time-of-Use block 146 → 255 (all weekdays on)  
Time-slot start 148 → 0 (00 : 00)  
Time-slot end 149 → 2355 (23:55, single all-day slot)  
Battery discharge-current limit 109 value in A  
Power limit for the slot 154 value in W  
Minimum SoC for the slot 166 → 5 %  
Allow PV export (solar sell) 145 → 1

That setup basically works, but:

The Deye can’t cope with many Modbus writes.  
With my 1 s cycle time I have to insert a 3-cycle pause after every write or the command is ignored.

There is a noticeable gap between Battery power (reg 590) and the target power set in reg 154.  
The offset has to be adjusted dynamically.

Charging:  
Setting 166 (SoC target) to its maximum does make the inverter accept charge commands, but the battery rarely draws more than ≈ 500 W.  
There is obviously an internal control loop that I haven’t figured out yet.

You can force higher charge power by throttling the maximum export power with reg 143.  
The battery then absorbs more PV power — but if the battery can’t take the full PV output, the inverter starts clipping PV.

I couldn’t find a reliable way to detect when the PV is actually clipping, so I can’t regulate right at the clipping point.

The SUN-20 K is a very touchy piece of hardware – poorly documented and, in my opinion, partly buggy.  
Otherwise I can’t explain the behaviour shown in the attached image. There is actually no load (consumption) active

 ![IMG_0740](https://community.openems.io/uploads/default/original/2X/c/c73536690c59346b538bc3c39280ecb5de4abdab.jpeg)

[Next page](https://community.openems.io/t/implementation-deye-inverter-approach/2541.md?page=2)
