Replies: 8 comments 10 replies
-
I am not familiar enough to know if the YAML you have will work or not but I can see that the indentation (the number of spaces at the start of each line) has gone a little wonky. This indentation is really important to YAML as it defines if the next line is a child or sibling of the previous one. Take for example the line that starts with I am sorry if this doesn't mean all that much to you but the indentation is the the grammer in YAML and if the grammer is not correct the computer can't understand it. Sadly computers are not as capable at guessing what a human means when we forget to put punctation in our sentenses. Anyway I don't know if this is correct but I believe that I have corrected the YAML for you, however I have had a go at correcting it for you, it may or may not work. automation:
- alias: "Ecoflow Delta Pro Charge Control"
icon: mdi:battery-charging
description: Adjust the charge speed of Ecoflow Delta Pro based on the power reading sensor
variables:
power_sensor: sensor.power_reading # change this to your power reading sensor entity ID
ecoflow_entity: switch.ecoflow_delta_pro # change this to your Ecoflow Delta Pro entity ID
min_charge_speed: 200 # the minimum charge speed in watts
max_charge_speed: 1500 # the maximum charge speed in watts
charge_step: 100 # the amount to increase or decrease the charge speed by in watts
power_threshold: -200 # the power reading threshold to start adjusting the charge speed in watts
trigger:
- platform: state
entity_id: "{{ power_sensor }}"
action:
- choose:
- conditions: "{{ trigger.to_state.state | int < power_threshold }}"
sequence:
- service: ecoflow.set_charge_speed # change this to the service that sets the charge speed of Ecoflow Delta Pro
target:
entity_id: "{{ ecoflow_entity }}"
data:
speed: >-
{% set current_speed = state_attr(ecoflow_entity, 'charge_speed') | int %}
{% set new_speed = current_speed + charge_step %}
{{ [new_speed, max_charge_speed] | min }}
- conditions: "{{ trigger.to_state.state | int > 0 }}"
sequence:
- service: ecoflow.set_charge_speed # change this to the service that sets the charge speed of Ecoflow Delta Pro
target:
entity_id: "{{ ecoflow_entity }}"
data:
speed: >-
{% set current_speed = state_attr(ecoflow_entity, 'charge_speed') | int %}
{% set new_speed = current_speed - charge_step %}
{{ [new_speed, min_charge_speed] | max }} I might have to look into this some more, I can see some cool things I might be able to do to use excess solar power when my delta pro battery is full... |
Beta Was this translation helpful? Give feedback.
-
I don't have examples to share at this point in time though I am planning to build out some automations that control when circuits are switched to battery on the SHP based on solar input to the DPs and possibly even try to find a way to "fool" the SHP into switching between DPs (for a form of "load balancing") under certain conditions. All of that is going to take some time and thought to build out and test and I've been waiting for the weather to reach a point where I have reliable enough solar to work with. That said, you might have a look at this: It's not exactly the same thing but a similar concept and give some good example of more complex automation. In particular I would suggest considering the 'for' condition for the same reasons the author suggests in the YAML comments. You don't want things to be jumping around going up and down all the time so it might be prudent to automate such that "once export is -200W for 1 minute... start charging" or "if export -500W for 30 seconds, change charge rate..." (again, this is off the cuff thoughts not really thinking through all the details). Another random thought might be to try to construct a single automation that can dynamically adjust. Something like "whenever export rate changes by <-100W (for >30 seconds), turn charging "on" and set rate to {export-rate} x 0.9 [rounded to the nearest 100]". Making your charge rate a rounded percentage of the export rate would likely make it easier to do what you want in only 1 or 2 automations as opposed to creating a separate automation for every 100W "step" and I'd suggest that having the charge rate be something a bit less than the export rate would give you a bit of buffer to be sure you're always charging with "excess energy". Other consideration are making sure you don't create some kind of infinite loop, thinking through if/when/how you want to end the charging (set the charging switch to OFF) taking into account that SHP will flip that off itself if the DP ever hits the charge limit. You could consider a much simpler approach such as determining a good average charge rate, setting the DP to that, and simply having the automation flip the charging switch "on" whenever export is available (for >1 minute) and "off" whenever it is not (for >1 min). For example: Let's say that you generally export 10kwh (or more) over a 5 hour period on a daily basis and you know you can fill the DP from empty in 4 hours at 1000W -- so you just set the DP to 1000W rate and let the charge switch be "on" anytime power is -11000W and "off" otherwise. Perhaps not as intelligent or sophisticated but might get you 90% of what you want with 10% of the work. You may also want to think about cloudy days or days with high demand where you did not export enough to charge the DP enough "for free". Maybe that means you just don't get much, if any run time out of the battery that cycle. Maybe you want to be sure the battery never goes below X% -- In any case there may be merit to leveraging the SHP automations for some things and only use HA for stuff the SHP can't do. For example a simple automation within the SHP could say "between 1 and 4am daily, if the battery is <55%, charge to 60% at 900W" (if you want to use AC charging to top up against a buffer for example). Apologies if all this is not helpful (I know I may be just injecting more to think about). The trick with automation is to work through the complexity back to the simplest way to accomplish the intended result. Sometimes this can be limited by the tools at hand and other times it just takes an iterative process. On the other hand when wading into new territory it is sometimes best to start as simply as possibly and slowly add functionality from there. You may find it gets overly convoluted in the end and you may end up (with hindsight and new found knowledge) starting over and making something more elegant, powerful, and yet simpler. But that's all part of the journey. ;) |
Beta Was this translation helpful? Give feedback.
-
What is this 1500W cap you speak of? The limit for manual AC charging via SHP is the same as for plugging a DP into the wall when not connected to SHP. It's a 15A limit (so 1800W assuming 120V exactly from the wall) but you will never see the full 1800W going into the battery due to conversion losses and the inverter will ramp down based on battery temp and how full the battery is as well. You can achieve up to 3400W rapid AC charging via SHP using a native SHP charging automation. Those can be manipulated using JSON/MQTT as well but that would not be 'simple' within an HA automation given the structure of it. I've done it to create a charging automation that has a -20% starting point (which can be set in the JSON but is not accessible via the app) but that was done by manually manipulating the payload and not via HA automation. One thing I've been contemplating (but have not had time to test) is setting up an automation within the SHP and using triggers in HA to simple enable or disable that automation. I want to be sure this can be done without posting the entire content of every variable within the automation config back to the SHP each time, however. |
Beta Was this translation helpful? Give feedback.
-
Heres a brief video which shows the 1500w on 1 DP. https://youtu.be/2ODFkvVX2Ag |
Beta Was this translation helpful? Give feedback.
-
OK after a bit of playing in the app I've worked out the easiest way to bypass the weird 1500w is by setting 2 separate automations for each DP to recharge at 3400w. Now I just need to manually turn each automation on for each DP and it allows me to alter the charge speed on each DP manually like I showed in the video but it will go beyond 1500w to up to 2900w so thanks a lot for pointing it out as it has been a big bug bear since I had them installed! So if I could toggle those 2 automations on/off in home assistant script it would allow me to charge each DP beyond 1500w. But it sounds like that is something that much more complex and I'm still trying to work out the basic automation script and not getting very far so far. I still can't get ChatGPT coding lines to actually do what it's supposedly should do. I've worked out if I use the Visual Editor mode and replicate the script conditions that ChatGPT (as best I can work out) then put a generic number (into the charge speed value) in and save it then paste in the line of code that ChatGPT produced it's stopped the error messages that I originally posted but when I run the script it aborts before it gets there. As I said in earlier post it's really difficult to find a decent amount of time to focus on it to make a difference. I am currently able to get automation script to start when power reading is -200w then it turns on first DP and sets the charge speed to 200w. I have managed this morning to get the charge speed to increase by 100w while the power reading stays under 100 all the way to 1500w cap. I am trying to get it to now reduce the charge speed when its above 0 then it decreases the charge speed by 100w from whatever charge speed it was up to until its back to 200w charge speed then turns the charging off completely. The power reading seems to only update every 10 seconds or so so there needs to be a delay in changing the charge speed up or down or else it will be over/undercharging too much before the next power sensor reading is updated. So my own attempt basically has gone like this: As I don't get how to write this in a shorter sequence on visual editor, I've just duplicated the same thing and just changed the charge rate for each so the code it ridiculously long and repetitive. However testing it it only works to gradually increase the charge rate from 200w to 1500w but doesn't seem to decrease the charge. I don't know what I am doing wrong yet in the sequence. I am sure I will keep fiddling with it and get mini breakthroughs but any help if I am doing something obviously wrong would be great as usual!
|
Beta Was this translation helpful? Give feedback.
-
I think you want to build an automation that is based more on "relative calculation" such as "when meter power below -100 for 1 minute make charge rate [meter] x -1" (or maybe even -0.9 to be safe). You can employ rounding to nearest 100 if you like but I'm pretty sure the DP will take any valid value so you really just need to round to a whole number... You may want to employ "conditions" as well to make sure something does not go off the rails... Here is an example. It does something different than what you're trying to achieve but maybe it helps illustrate a bit:
This is what I use to 'fool' the SHP into a form of load balancing. It watches for >10% difference in average SOC between my 2 sets of DP+EB and then switches my D2 charging on at 1200W for 1 minute by setting the charge limit to [current SOC] +2% then setting back to -2% below SOC... It only does this if the D2 SOC is >5% and <95%, only 1 DP is supplying power, and the output from that DP is >650W and <1800W I'm using my D2 as a "dummy load" to artificially push the demand >1800W... This causes the SHP to engage the 2nd DP and then, 1 minute later, if demands is <1200W the DP with lower SOC will disengage... Note that I'm only using sensors from the DPs (nothing from SHP) and will eventually use a smart switch with a 1000W of halogen or some other dummy load. The D2 made for an easy "proof of concept". Hopefully that helps? |
Beta Was this translation helpful? Give feedback.
-
Hi all, Thank you for this topic. I have a DP for one year now, and I am in the same situation – I have my solar panels at the building roof, and I can only charge the DP via AC. Since the beginning I wanted to have an “automated AC charge speed” able to put in the battery the excess solar energy. During this process, as you know, ecoflow closed the communication port.. and this has delayed my progress on this topic. However, it was good because I was able to re-do and finetune my automation. Please note that I have ZERO skills in programming, but this didn’t stop me to do something.. I have faced some challenges: After some days of testing and finetuning, the automations are working fine for 2 or 3 months. Picture enclosed (in pink the solar production and in blue the grid main meter) |
Beta Was this translation helpful? Give feedback.
-
I have managed to recently finally get the automation to work as close to what I want as possible! I've attached the yaml files (anonymised) for anyone to see if the can use it. However basically the automation runs continuously and keeps the charge speed of each Delta Pro to under what is being produced by my existing rooftop solar panels. I have put a tolerance of at least 100w so that it rarely goes over to charging on the grid. However due to the limitations of the refresh rate of the Glow smart meter being roughly every 10 seconds that has been programmed to alter the charge rate of each battery every 10 seconds by 100w up or down. To compensate for sudden drop in light (like when it suddenly goes cloudy) I have put 500,1000,1500,2000,2500w decrease jumps if the power sensor number massively jumps up by those ranges as the existing automation would take several minutes to gradually drop the charge speed by 100w every 10 seconds. I have also put a basic notification to my mobile when it is using 300w+ from grid to warn me that the automation isn't working properly. The only caveat is that you need to set up the automation for charging in Ecoflow app and manually turn that on if the solar electricity is making over 1500w (single battery charge)/3000w (double battery charge) is so that you can charge over upto 2900w on each battery. My rooftop solar seems to max out at around 6KW during midday summer but I am choosing to only charge 1 delta pro at a time so I still manually switch on the Ecoflow app automation each time. I have also put a loop which restrict the charge to 2600w max as I found the automation kept crashing if it got to 2900w charge and tried to increase the charge to 3000w so keeping if at 2600w means it doesn't crash! Finally I created a custom sensor which allows me to average out the battery percentage for Delta Pro and 2 extra batteries as this didn't seem to be a existing entity (even though its shown in the Ecoflow app). This just allowed me to be warned if the battery I am charging is reaching over 70% as I prefer to charge one at a time rather than both so the other non charging battery can handle any spikes in usage in the house without suddenly causing me to use grid power. Anyways thanks to everyone who has helped me get this far especially @mattwells for initial set up video and @Ne0-Hack3r for letting me have access to his SHP repo! I am happy to try to help anyone who has any questions on it and of course if anyone has any suggestions to refine the automation to make it even more efficient than let me know! |
Beta Was this translation helpful? Give feedback.
-
Thanks to a lot of Youtube tutorials @mattwells and help from @Ne0-Hack3r giving access to his SHP integration I now have my Smart Home Panel and 2 Delta Pros and extra batteries hooked up and controllable via Home Assistant. I also managed to get a Glow CAD smart meter device that I have managed to connect to HA as well.
The aim for this is because I have existing solar array on my roof which is fed into their own inverters so produce AC power for the house. I want any excess solar to charge into the Delta Pros via the Smart Home Panel. However this is where I have become stuck again... I know I really only need 5 entities to work in harmony (anonymised):
Smart Meter Electricity:FXXXX Power – sensor.smart_meter_electricity_fXXXX_power
SHP PRO1 Recharge – switch.shp_pro1_recharge
SHP PRO2 Recharge - switch.shp_pro1_recharge
Delta Pro 1 charge speed – number.delta_pro_1_ac_charge_speed
Delta Pro 2 charge speed - number.delta_pro_2_ac_charge_speed
So you should know that it starts at 200w charge rate, so I have managed to get the first sequence working which once Smart Meter is showing '-200 (watts)' or less it turns the 1st turns on recharge for 1st Delta Pro and makes sure its set to 200w.
`alias: basic toggle test
description: ""
trigger:
entity_id: sensor.smart_meter_electricity_fXXXX_power
below: -200
condition: []
action:
data: {}
target:
entity_id: switch.shp_pro1_recharge
data:
value: "200"
target:
entity_id: number.delta_pro_1_ac_charge_speed`
However the next step I seem to be not getting anywhere. If the power sensor continues to stay at -100 or more after it refreshes then the Delta Pro charge speed needs to keep going up in 100w until 1500w (this is a cap I have found EcoFlow has put on the Delta Pro if it registered DC charge as I have both of them connected to separate solar panels via the DC cable so I can't charge to 2900w).
So I was trying to work out how to do this and ended up asking ChatGPT on Bing as I read it can do basic coding and it came up with this:
`alias: Ecoflow Delta Pro Charge Control
icon: mdi:battery-charging
description: Adjust the charge speed of Ecoflow Delta Pro based on the power reading sensor
variables:
power_sensor: sensor.power_reading # change this to your power reading sensor entity ID
ecoflow_entity: switch.ecoflow_delta_pro # change this to your Ecoflow Delta Pro entity ID
min_charge_speed: 200 # the minimum charge speed in watts
max_charge_speed: 1500 # the maximum charge speed in watts
charge_step: 100 # the amount to increase or decrease the charge speed by in watts
power_threshold: -200 # the power reading threshold to start adjusting the charge speed in watts
trigger:
entity_id: "{{ power_sensor }}"
action:
sequence:
target:
entity_id: "{{ ecoflow_entity }}"
data:
speed: >-
{% set current_speed = state_attr(ecoflow_entity, 'charge_speed') | int %}
{% set new_speed = current_speed + charge_step %}
{{ [new_speed, max_charge_speed] | min }}
sequence:
target:
entity_id: "{{ ecoflow_entity }}"
data:
speed: >-
{% set current_speed = state_attr(ecoflow_entity, 'charge_speed') | int %}
{% set new_speed = current_speed - charge_step %}
{{ [new_speed, min_charge_speed] | max }}`
So I tried to add it and kept getting errors whereever I paste it e.g. in automations.yaml
Trying to paste into new automation via edit in YAML comes up with this error
I checked the code in a YAML validator and it seems to not spot any errors so I think its just I'm putting it in the wrong place? Any help with the script code or what I am doing wrong with the autogenerated code above would be great.
Beta Was this translation helpful? Give feedback.
All reactions