Ecoflow Integration

Any chance of getting an Ecoflow integration? They are coming on strong in the Solar generator, power backup industry.

I had to wait for 3 weeks just to get a API key from them. So far I am not impressed with their API this is all it returns:

{"code":"0","message":"Success","data":"soc":90,"remainTime":5999,"wattsOutSum":2,"wattsInSum":0}}

As for sending events there is no consumer API for pushing commands to the units that I have found and their support team said there is no public API documentation.

I really wanted to write a NUT driver for their products since I operate my Ecoflow devices in UPS mode. With the limited info there is not much I can do.

1 Like

Thanks for your efforts!! Keep us posted!

So far Ecoflow is a no go. The basic API they provided me is just the information string the the remaining power and watts in and watts out. If I "poll" the API too quickly it starts to time out. I guess with the magic of math I could deduce when it's on battery and when it's not by watts in being less than watts out.

I have be trying out various things in a python script on a Raspberry Pi just to get prototype done and it's just too unreliable.

The next thing maybe is to hack the app and capture the packets to and from their services but I am not a fan of this reverse engineering when you are dealing with critical infrastructure like UPS mode for sump pumps and other things.

This is the json I decoded into variables:

{"code":"0","message":"Success","data":{"soc":100,"remainTime":5999,"wattsOutSum":128,"wattsInSum":128}}

soc = state of charge (battery level)
remainTime = estimated run time when on line power it seem to stay at 5999
wattsOutSum = Service Load in Watts
wattsInSum = Line draw in Watts

It lines up with what is presented in their apps:

Having that information from my Ecoflow Delta 2 would allow me to run a closed-loop system. At my remote cottage, during a power outage, my Delta 2 runs my Starlink, router, and hub. And the hub controls the run cycle of my generator but has no information on the Delta's power level. I currently restart the generator based on a calculation of when the Delta should be getting low. During a power outage this week, I came very close to a system shutdown because it was snowing out, and the Starlink went into an antenna heat cycle pulling 200 watts that sucked the Delta down in just a few hours. It was just by chance I looked at Delta's app and noticed how low the battery was and had the hub restart the gen. API coding is not my thing but it would be very beneficial for me to have my Ecoflow battery status.

This issue is that their application API is closed and the API they gave me was minimal. That is why I abandoned my NUT driver for it but you are right it may be something to allow at least values from the unit into Hubitat so you can use rule machine to act upon.

I would suggest you send a email to their support to get the API key's you need for your unit. Also you unit needs to be IoT connected as they called If it's not IoT connected the API won't work. The round trip of the API is to Ecoflow's cloud servers not the local unit. Thus if your internet is down, You will not receive status.

Thanks, Ron, for the info - I will send them a message and see what I get. Structured text and PLC code are my limits for coding. If I get the API, is it a few hours of coding for a proficient individual to get a Hubitat Driver written, or is it a much bigger dive than that?

There should be enough examples of other folks drivers that use API keys and JSON that you can borrow from. I built a MQTT listener by looking over existing device drivers so I could import my weather station data. I think there is even a action in Rule Machine that can make a direct call to a web service.

Nope I was wrong it's just a HTTP request:

image

Thanks for everyone's efforts on this!

I contacted Ecoflow and promptly received an API for my Delta 2 battery. Below is what I received.

curl -X GET
https://api.ecoflow.com/iot-service/open/api/device/queryDeviceQuota?sn= R331ZAB4ZEXXXXXX
-H 'Content-Type: application/json'
-H 'appKey: 05b96738bb3e48c18ab6e3699XXXXXXX'
-H 'secretKey: abc3448c09c24befb1e5515dXXXXXXX'

I would like to get battery status variables, so I can use them to help decide how long to leave my generator off.

I ran the code at https://reqbin.com/curl and had the data below returned.
{
"code": "0",
"message": "Success",
"data": {
"soc": 83,
"remainTime": -5939,
"wattsOutSum": 74,
"wattsInSum": 83
}
}

Unfortunately, I don't have any idea where to start. I would appreciate some guidance on how to accomplish this task.

Thanks!

Ecoflow Driver - I started on the driver to run the curl get command. The attributes and input portion seems straightforward, but I have no idea where to begin for the "GET, Paraphrase and Poll part of the code.

Sorry I have been tied up with elections coming up next Tuesday since I am a election judge. Let me poke around to see if I can find something in a driver that may help. What you have there is as far as I got with a driver myself. Was able to get the parameters to access but never got to the polling. The closest pattern of code I have downloaded is the WeatherFlow API driver that may be the key.

No worries. I will keep plugging along.

Last week I was able to execute the curl command on reqbin but this week, it keeps giving me an can not process error. I do know if I am typing it in wrong or if something broke. If someone wants to give it a try for me - I can DM the full app keys.

curl -X GET
https://api.ecoflow.com/iot-service/open/api/device/queryDeviceQuota?sn= R331ZAB4ZExxxxx
-H 'Content-Type: application/json'
-H 'appKey: 05b96738bb3e48c18ab6e369915xxxxx'
-H 'secretKey: abc3448c09c24befb1e5515db9fxxxxx'

Here is my httpget command:

This returns server error 1006 (no serial number)
If I put the serial number at the end of the URL (...quota?sn=R331ZAB4ZE8xxxx), I get error 400 returned (bad request).

How do I format the command to get the serial number to the server?

I have my httpget command working. A giant leap for me, a minuscule step for hubitat. :laughing: And thanks out to @snell for the help.

Next challenge - get the info from data.json into the corresponding fields.

2 Likes

Here is my Hubitat driver used to connect the Ecoflow batteries. See instructions in the driver. Note - an API request from Ecoflow is needed. This is NOT a local driver.

Special thanks to dsnell for all his help on this driver and for the base code I used to create the Ecoflow driver.

My first post to github - Hope the link works.

1 Like

Let me give this a try over the Thanksgiving holiday. We have been so swamped at work with rollout out a new product haven't been doing a lot of things at home. My todo list for the long weekend has about 100 items on it. I will make this a top 10.

1 Like

@ronv42 I'm running my D2 and EB to low bat shut down and seeing some strange stuff. Pics below are the EF app vs the API screen. It appears the API SOC is for the D2 only and does not take the EB into consideration. Note App says combined SOC is 34% and API say 1%. Maybe that will improve after calibration...as for now not sure how to react to this info. I'll contact EF about the situation.


Appreciate all the hard work. Looks like it's starting to come together. Reached out to Ecoflow for API key a couple days ago. Nothing yet.

I have the 1st generation EF River Pro with extra battery and there isn't any report on the extra battery. The only way I know it's there is the duration of run or charging changes when the extra battery is connected which my setup is 100% of the time.

The first time I used the external battery I would never see the unit "top off". I opened a support case and they had me go though re-calibration steps of discharging the unit with the external battery removed. Then attaching the external and discharging that also.

They had me change the config for "AC Slow Charging" with charge level at "100%" and charging the unit with the external removed, then attaching the external and charging. Finally discharging with external connected when both batteries were 100% and then charging again. That seemed to do the trick and the unit has been working just fine since those steps were taken.

Also there was a firmware update that better "balanced" the charge when the external was connected a few days latter that they said resolved some "drift" that can happen when using the external.

I would say if you can't resolve it with calibration then contact their tech services. They were very responsive to my issue since I run in UPS mode for my "networking" gear and basement storm room power. With the external I have lighting and networking/radio's for about 7 hours when both the main unit and external is topped off at 100%.

By the way I loaded your driver last night after I finshed working at it's polling just fine:

image

These are my screens from their app:

1 Like