klatremis / esphome-for-deye Goto Github PK
View Code? Open in Web Editor NEWEsphome component for Deye 3 phase inverters for Home Assistant
Esphome component for Deye 3 phase inverters for Home Assistant
Hi,
i always have this error.
What i am doing wrong?
Hi,
hab meinen 12kW Deye via Canbus https://solar-assistant.io/help/deye/2_in_1_bms_port an meinem raspherry pi (CAN to USB / RS485)
damit läuft beispielsweile evcc hervorragend.
Kann ich mit dieser SW-Lösung hier auch die Register mit meiner obigen HW-Beschaltung schreiben?
I get this errors:
INFO Reading configuration /config/esphome/deye-8k.yaml...
ERROR Error while reading config: Invalid YAML syntax:
while parsing a block mapping
in "/config/esphome/deye-8k.yaml", line 3, column 1:
substitutions:
^
expected , but found ''
in "/config/esphome/deye-8k.yaml", line 40, column 3:
id: mod_bus
^
hi,
i have:
WT32-ETH01
RS485 to TTL
power supply
deye SUN-10K-SG04LP3-EU
I connect:
WT32 IO17 to TTL TX
WT32 IO05 to TTL RX
WT32 3v3 to TTL VCC
WT32 GND to TTL GND
RS485 A+ to deye ModBus RJ45 7
RS485 B+ to deye ModBus RJ45 8
RS485 GND to deye ModBus RJ45 6
I shorten the R0 for 120 Ω resistance between B+ and A+ on the RS485.
The WT32 is available ( via Webservice ), but I don't get answers from the deye sun-10k.
i just get:
[12:33:26][D][modbus_controller:043]: Modbus command to device=1 register=0x82 countdown=0 no response received - removed from send queue
[12:33:27][D][modbus_controller:043]: Modbus command to device=1 register=0x8D countdown=0 no response received - removed from send queue
[12:33:28][D][modbus_controller:043]: Modbus command to device=1 register=0x94 countdown=0 no response received - removed from send queue
[12:33:30][D][modbus_controller:043]: Modbus command to device=1 register=0xA6 countdown=0 no response received - removed from send queue
[12:33:31][D][modbus_controller:043]: Modbus command to device=1 register=0x154 countdown=0 no response received - removed from send queue
[12:33:32][D][modbus_controller:043]: Modbus command to device=1 register=0x1F4 countdown=0 no response received - removed from send queue
[12:33:34][D][modbus_controller:043]: Modbus command to device=1 register=0x204 countdown=0 no response received - removed from send queue
[12:33:35][D][modbus_controller:043]: Modbus command to device=1 register=0x21D countdown=0 no response received - removed from send queue
[12:33:36][D][modbus_controller:043]: Modbus command to device=1 register=0x227 countdown=0 no response received - removed from send queue
[12:33:38][D][modbus_controller:043]: Modbus command to device=1 register=0x24A countdown=0 no response received - removed from send queue
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=108 count=2
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=145 count=2
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=548 count=1
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=590 count=2
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=625 count=1
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=638 count=1
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=653 count=1
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=655 count=1
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=672 count=2
[12:33:39][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=676 count=4
[12:33:39][W][component:214]: Component modbus_controller took a long time for an operation (0.09 s).
[12:33:39][W][component:215]: Components should block for at most 20-30ms.
and every now and then:
[12:33:53][W][modbus:108]: Modbus CRC Check failed! C822!=FDFF
Does anyone of you have an idea what I'm doing wrong and can help me.
thanks
Since I still some Umbaue and test, I switch off the Deye or also times the ESPhome device, after switching on, however, irrwitzig high values are sent. Could not this be turned off?
Hi ,
I cannot get it to work that both RX and TX Led blinking at the same time! If I Change PIN 16 and 17 the other start to bling. What have I done wrong?
uart:
id: mod_bus
tx_pin: 17
rx_pin: 16
baud_rate: 9600
stop_bits: 1
modbus:
id: modbus1
modbus_controller:
I am using this TTL :
JZK 5PCS TTL to RS485 module, 485 to serial port UART level mutual conversion, hardware automatic flow control, TTL Turn RS485 3.3V 5V
Thanks
Mit freundlichen
Is there a way to read the power coming in to the GEN ports from a Microinverter and display it in Home Assitant ?
Hello,
I need some thoughts about this: is it possible to enable / disable the battery remote?
I found the "98 - Control Mode" but it's only 0 and 1 for leadascid and lithium in the register discription.
Is it possible to set also 2 or 3? I can't finde any explenation...
if the Control Mode is the right address, it should work like this?
- platform: modbus_controller
use_write_multiple: true
modbus_controller_id: ${modbus_controller_id}
name: ${device_type}-control-mode
address: 98
value_type: U_WORD
optionsmap:
"Lithium": 0
"Use Bat V": 1
"Use Bat %": 2
"No Bat": 3
Hi,
We've just flashed a ESPHome on a ESP32, and used your configuration. It's initiated as it should, however, it's reporting very random-like numbers on each sensor.
We've followed the wirering diagram, and it's clear that it's OK.
After the ESP32 has been rebooted, we're back to normal numbers for a period of time.
Is this a timing or signal issue? Have you experinced simular problems? (We just tested with 20s interval)
Is is triggered by a specific event on the DEYE, or?
Here's a correct "load" with numbers:
We've tried to move the NodeMCU is moved outside of the "inverter-box", to secure proper WiFi-signal. That didn't help.
If we restart the ESP32 by using the "restart" command in ESPHome, nothing changes:
Restarting the ESP32 by unplugging and replugging the USB-cord, nothing changes:
[hello,]
I followed your tutorial but I have feedback at 0 in home assistant. I do not understand ...
I have model SUN-6K-SG03LP1-EU
In the menu I am in MASTER modbus sn:01
Attached yaml file + logs
I am using this integration now for several month on my Deye 12K inverter and have observed that received values for different entities (sun12k-pv2_power, sun12k-battery_capacity and a lot more, but not all of them) to be completely out of range, e.g. sun12k-pv2_power being set to 30806kW (real maximum should be around 10.000kW). It seems to appear at random and only for a short period of time.
During this "condition" some entities seem to be set to fixed values (e.g. "30806" appears on several other entities), maybe depending on data type (integer, float, ...) or units.
The behavior started to appear on April 23rd, see included picture (peaks = wrong values). The effect seems to get stronger with higher solar radiation / higher values.
From the Debug log:
2024-05-01 11:20:26.596 DEBUG (MainThread) [aioesphomeapi.connection] deye-modbus @ 192.168.0.212: Got message of type SensorStateResponse: key: 3933863750
state: 4114 (correct)
... (other entities)
2024-05-01 11:21:17.823 DEBUG (MainThread) [aioesphomeapi.connection] deye-modbus @ 192.168.0.212: Got message of type SensorStateResponse: key: 3933863750
state: 30806 (incorrect)
... (other entities)
2024-05-01 11:36:54.946 DEBUG (MainThread) [aioesphomeapi.connection] deye-modbus @ 192.168.0.212: Got message of type SensorStateResponse: key: 3933863750
state: 3749 (correct)
I have no clue but it somehow looks that with certain values / bit combinations the reception of data is not working correctly.
Any ideas?
Thank you,
Ewald
I got this message:
11:27:41 | [W] | [modbus_controller:113] | Duplicate modbus command found: type=0x3 address=676 count=4
and in addition:
Modbus CRC Check failed.
I get this message for many registers. Do you have a clue what causes this ?
Just found out: Duplicate command appears if I use switches too fast so I guess update interval.
sensors seem to cause the CRC Check failed msg.
Meanwhile I see the values of the registers. It was related to the esphome version I used for compiling. I updated to the latest and it works now. CRC and Duplicate messages still there, but I went down to 1 sec interval. It seems it doesn't make a difference compared to 10 or 15 sek.
Hi,
I would like to turn Peak shaving on and off. This is needed if you want to export to grid from batteries at night (only works if Grid peak shaving is disabled) and use Grid Peak shaving at day.
For that I need to change bits 4-5 on address 178 - Well actually only bit 5 will do since bit 4 is always 1.
Can you please provide me a code to do this.
I tried like that but not sure what bitmask is doing (not a programmer just mechanical engineer).
Thank you and best regards,
Bogdan
Hello
I have configured the genrator port for microinverter connection.
How do I display the delivered displayed on this port?
Hi There,
I was trying to create a Daily consumption sensor, and i believe the modbus adress is 526 but it seams the messurment is of by quite a bit. (a least compared to the Solarman Logger interface)
My sensor code is this:
- platform: modbus_controller #Daily Consumption
modbus_controller_id: ${modbus_controller_id}
skip_updates: 10
name: ${device_type}-Daily Consumption
id: ${device_type}_Daily_consumption
register_type: holding
address: 526
unit_of_measurement: "kWh"
state_class: "total_increasing"
device_class: energy
accuracy_decimals: 2
value_type: U_WORD
filters:
- multiply: 0.1
Have you tried getting this sensor to work?
Thank you for creating this repo. Nice clean way of communicating with the inverter, I like it...
Tried with a 8266 first, lights of the tll-rs485 were flashing but nothing received, also not with logging disabled (as per esphome wiki).
ESP32 WROOM 4Mb Devkit V1 working first try..
There's one thing that I don't like, it's the time value, but no matter what lambda I try or HA sensor I create I can't get it to any decent time format.
Currently using:
- platform: modbus_controller
use_write_multiple: true
modbus_controller_id: ${modbus_controller_id}
id: sun3p_Time_point_1
name: "sun3p-Time point 1 start"
min_value: 0
max_value: 2400
step: 100
address: 148
value_type: U_WORD
adress 130
maybe a stupid Q?
what does it do?
mvh andy
og tak for kode!
Dear Team.
I see the update frequency is 15s, which is great for live-feed.
However, does it also write back the values every 15s ?
My concern is, if the values are also constantly written over and over (every 15s) and eventually wear out the memory flash-chip in the Deye inverter.
But I'm unsure how the detailed workings are with the modbus and state changes in ESPHome / Homeassistant.
The optimum would be to read at every 15s and write only updated values back to inverter.
Thank you.
PS: My first github post ever, so please be gentle :-)
Not sure if this is a case to open an issue, if not I´m sorry;
I tried different configurations with a D1 Mini ESP8266. It always ends up in a boot loop.
Eg I also tried to use UART1 for logging and RX/TX Pins GPIO3 and GPIO1 for the modbus connection without success,
Is it possible to use the ESP8266 and I´m doing it wrong or do I need an ESP32 anyway?
Thanks for pointing me into the right direction!
Thanks for sharing this implementation, this fits my need exactly and works well with a 10kw 3-phase inverter from deye. i have another small problem: i try to configure the "priority mode" and "Load Limit (system work mode) via the modbus register 141 and 142. After some research I found the following:
select:
select:
Maybe someone of you has already implemented this or can tell me if this has a chance of success, before I try it live.
Any chance this same hardware / software (with some modifications) could work on the SUN-5K-SG03LP1?
If I can control the AC -> DC charge and DC -> AC discharge I am happy. :)
Otherwise I might buy one the SG04LP3 inverters to be sure..
Hi, Deye sends PV1 and PV2 separated only. Sometimes it's better to have total PV power already calculated
The only solution I could find until now:
sensor:
- platform: template
name: "${device_type}-Total PV Power"
id: ${device_type}_Total_PV_Power
unit_of_measurement: "W"
state_class: "measurement"
accuracy_decimals: 0
lambda: |-
return (id(${device_type}_PV1_Power).state + id(${device_type}_PV2_Power).state);
update_interval: 5sec
But it's not synced (=> delayed) with PV1 and PV2 power, because it's not triggered by PV1 or PV2.
Is there any better solution for it?
Hi,
After installing my second Deye inverter of the same type with ESPHome according to the instructions with the same ESP32 WROOM and the same converter, I get the following error logs about 4 days after problem-free data transfer.
My configuration is the following:
The other system runs absolutely problem-free, where could the error be?
Thank You
Hi,
Is it possible to add a daily charge and discharge of battery?
Jeg har 2 invertere (Addr. 01 og 02).
Når jeg benytter Mod(e)BUS stikket på masteren, kommer der intet svar. benytter jeg derimod stikket på slave-inverteren, får jeg fint svar - men de data jeg får, er fra slave inverteren! Dette til trods for at jeg beder om data fra adresse 0x1.
Yderligere kan jeg se at hvis jeg ændrer f.eks. time-of-use, så hopper de ændrede værdier tilbage, når masteren synkroniserer data ud.
Jeg har en mistanke om at dette repo kun virker med enkeltstående invertere, men jeg HÅBER at blive modbevist! er der andre i en lignende situation der har haft held med at kommunikere med masteren?
Hej Klatremis,
I have 2 parallel 12 kW Deye hybrid inverters - like yours.
I want to reduce their power usage to the absolute minimum during night-time. They have a rather high idling power level (around 160W) and that's too high and ineffective compared to my house load of about 350 W. I have therefore invested in a microinverter that I crank up when our power usage is low and the sun-production has ended for the day.
I can see there is a Modbus 80 register that could be a software ON/OFF switch for the Deyes - Have you tried to address that register?
If using 80 is not feasible can you then suggest alternatives to reduce the Deye power level?
Thanks / Peter
"Out-of-grid–total power" is working as if it have a "skip_updates: 2".
Is the "skip_updates: 2" inherited from another variable?
...
platform: modbus_controller
modbus_controller_id: ${modbus_controller_id}
skip_updates: 2
name: "${device_type}-External CT L3 Power"
id: ${device_type}_External_CT_L3_Power
register_type: holding
address: 618
unit_of_measurement: "W"
state_class: "measurement"
accuracy_decimals: 0
value_type: S_WORD
Hi!
I installed ESP Home successfully on my ESP and connected it accordingly to the wiring diagram with the Inverter RS485 Port. Sadly, no communictaion is happening as far as I understand.
There are many mesages in the log "Duplicate modbus command found: type=0x3 address=172 count=2" - is this okay?
Where could the problem be? What am I doing wrong?
Wiring shoudl be correct, I checked multiple times. Maybe do I use the wrong TTL to RS485 modules?
Hi.
First of all I would like to thank you for your work - it really helped me to make some nice automations in Home Assistant.
I'm trying to change Max grid shave power directly from ESPHome on ESP32 without Home Assistant (where with automations this works without any issues).
My simple code is:
`time:
platform: homeassistant
id: homeassistant_time
on_time:
The problem is that value 8000 (or 10000 at 3hr50min) is set for only couple of second and will then be turned back to value set before that time (set on Deye like lets say 12000).
How can I set value that remain same until at different time different value is set?
Thank you and best regards.
Bogdan
after several days of normal operation the entities in HA becomes unavailable.
Home Assistant 2023.10.5
ESPHome 2023.11.2
WiFi ok. module is online
Reinstalled - no results
Delete device from HA - no results
log shows:
22:19:02][D][modbus_controller:043]: Modbus command to device=1 register=0x94 countdown=0 no response received - removed from send queue
[22:19:03][D][modbus_controller:043]: Modbus command to device=1 register=0xA6 countdown=0 no response received - removed from send queue
[22:19:04][D][modbus_controller:043]: Modbus command to device=1 register=0x154 countdown=0 no response received - removed from send queue
[22:19:06][D][modbus_controller:043]: Modbus command to device=1 register=0x21D countdown=0 no response received - removed from send queue
[22:19:07][D][modbus_controller:043]: Modbus command to device=1 register=0x224 countdown=0 no response received - removed from send queue
Hello,
New to Deye, but generally not new to electronics or ESP programming. I have recently purchased a 12kW hybrid inverter and it should obviously integrates to HA so this code was on my favorites even before the purchase.
After getting the inverter I soldered my 485 to TTL module on an ESP32 I had laying around and connected it using the diagrams in the manual (pin 1 and pin 2 on RJ45) and put it in the Modbus port on the inverter. The ESP kept sending but never received anything (LED lights) so even though I was sure about the connections I exchanged the TX and RX - still not working. I then returned the RX and TX wires to their original placement and started plugging the RJ45 in the other ports. Only the Meter485 port worked for me, but even this was not 100%. I could read all the values, but whenever I wrote something it got overwritten with the old value after a few seconds.
Am I doing something wrong or missing a small detail somewhere?
lines 423 and 240 should be moved to right posistion 2 places right
Hello, since I have got some Wemos D1 mini ESP8266 chips, I would like to try communication on this chip. I tried to upload the yaml but I got error on this lines:
lambda: |-
uint16_t value = modbus_controller::word_from_hex_str(x, 0);
Is it due to different chip, or there has to be more changes made inside the program code?
Thanks Martin
Hi! Do you have the modbus-register for this? I wantto add som points
Hey Hoo,
is there a way to send the data via mqtt without using an homeassistant instance?
Would be nice to have because not everybody is using HA....
Hej. Der er rigtig mange folk der oplever af RS485/TTL board brænder af da der står en spænding hen over modulet (lækstrøm) og så futter chippen af. Kan du ikke skrive i vejledningen at man bør "luse" GND tværs over modulet fra side til side? Det løser problemet.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.