Trying to get info from my Ecoflow Delta Max battery

As of today,
I am successfully receiving data from ecoflow and passing it onto home assistant.

Yay!

Hey! Thanks for the responses! I’m finally also getting data. Appreciate the follow-ups!

Thanks for posting this! I’ve recently bought a Delta Pro and wanted to see how I might automate its charging and usage. Great to see they have an API that’s accessible so easily!

I thought I’d add here the changes that I’ve made to bring the sensor code “up-to-date” a little, using the new template sensor format. Nothing wrong with your way, it’s perfectly functional but I wanted to use the most recent formats where possible.

The rest sensor is the same but removes the authentication since it isn’t required and I’ve reduced the update time to every 30 seconds. 5 seconds was a bit aggressive.

sensor:
  - platform: rest
    name: ecoflow_delta_pro
    resource: !secret delta_pro_rest_url
    scan_interval: 30
    timeout: 30
    headers:
      User-Agent: Home Assistant
      Content-Type: application/json
      Accept: application/json
    json_attributes_path: "$.data.data"
    json_attributes:
      - remainTime
      - socSum

Here’s the biggest change which is to use the new template sensor format and also set the availability of the sensors based on the return of a valid integer from the original rest sensor. I also use state_attr() instead of the named attributes approach, which is another small change but “preferred”.

template:
  - sensor:
      - name: "EcoFlow Delta Pro - State of Charge"
        state: "{{ state_attr('sensor.ecoflow_delta_pro', 'socSum') }}"
        unit_of_measurement: "%"
        state_class: measurement
        unique_id: ecoflow_delta_pro_soc
        device_class: battery
        availability: "{{ state_attr('sensor.ecoflow_delta_pro', 'socSum') | int(default=-100000) > -100000 }}"
      - name: "EcoFlow Delta Pro - Remain Time"
        state: "{{ state_attr('sensor.ecoflow_delta_pro', 'remainTime') }}"
        unit_of_measurement: "min"
        state_class: measurement
        unique_id: ecoflow_delta_pro_remain
        icon: mdi:update
        availability: "{{ state_attr('sensor.ecoflow_delta_pro', 'remainTime') | int(default=-100000) > -100000 }}"

Again, thanks for posting your original code and letting us all know that the API was even available!

1 Like

Thanks for this additional info. I have 3 different EcoFlow devices, is there a way to use templates to create separate sensors without creating 3 different entries per device?

The only way I’m aware of is likely via the implementation of an actual integration which can list the serial numbers for all devices on your account and then create sensors for them. As it is, with the API available that we are using to do what we’ve done so far, it doesn’t seem that’s possible, so there would need to be a different API, or one with more information before you’ll see the features you’re asking for.

I’ve created another sensor that converts the total remainTime minutes in to days, hours and minutes to make for easier reading - it’s even grammatically correct about it.

template:
  - sensor:
      - name: EcoFlow Delta Pro - Friendly Remaining Time
        state: >
         {% set time = state_attr('sensor.ecoflow_delta_pro', 'remainTime') | int %}
          {% set days = (time / 1440) | int %}
          {% set leftover_minutes = time % 1440 %}
          {% set hours = (leftover_minutes / 60) | int %}
          {% set mins = time - (days*1440) - (hours*60) %}
          {%- if days > 0 -%}
            {%- if days == 1 -%}
              {% set output = days ~ " day " %}
            {%- else -%}
              {% set output = days ~ " days " %}
            {%- endif -%}
          {%- endif -%}
          {%- if hours > 0 -%}
            {%- if hours == 1 -%}
              {% set output = output ~ hours ~ " hour " %}
            {%- else -%}
              {% set output = output ~ hours ~ " hours " %}
            {%- endif -%}
          {%- endif -%}
          {%- if mins > 0 -%}
            {%- if mins == 1 -%}
              {% set output = output ~ mins ~ " minute" %}
            {%- else -%}
              {% set output = output ~ mins ~ " minutes" %}
            {%- endif -%}
          {% endif %}
          {{ output }}
        state_class: measurement
        unique_id: ecoflow_delta_pro_friendly_remain
        icon: mdi:update
        availability: "{{ state_attr('sensor.ecoflow_delta_pro', 'remainTime') | int(default=-100000) > -100000 }}"

And single digits (day in this case)

image

2 Likes

Thank you for the good work
I adapted it to my new River Pro.

Problem for the Data was that I have a lot of missreadings resulting in a lot or Zerro readings - commentong out the “else 0” statement solved that.

Hi, I’m currently thinking about getting an Ecoflow device to better use the energy from my mini solar system.

I had a look in the manual and it states that the charging speed can be set in the app. Has anyone tried to set the charging speed from HA? That would be really cool because I have exact information on the power that I have left over for charging.

Thanks to everyone taking the time to respond

I have now contacted their support team and found out that their API doesn’t provide any funtionality to control the device. They have forwarded the idea to their engineering team so maybe we will see this in the future.

Hi there,

Great !
The more people asking them to open more their API, the better !

Currently, all they gave was the ability of reading State of charge and Remaining time of charging/discharging but it could be so much more :-).

1 Like

So, I got my Delta MAX back from their support after it was stuck and decided to share my feedback on this.
The RMA was a bit painful but in the end all went well.
I’ve got my unit back plug it in, saw there was an update, click on the button, went away and came back, the unit seemed stuck again.
So I went back on the app, pushed again on the update button, it continued where it was.
When I came back, it was finish but still on 1.2.6.19 instead of 1.2.6.29.

Now, it says it’s up-to-date :open_mouth:

Anyway, I raised a ticket to explain the situation to them… and to ask one more time about other API access ;-).

While I was there, I made them the following suggestion:
"What could be great is to get a bypass mode (only provides the power requested by the devices plugged on the battery) and an off-grid mode (use energy only in the battery even when plugged in the wall).

With these 2 features available through the App or the API, users could use automation to charge the battery only with excess solar from their rooftop !

  • When PV production > house consumption = normal mode: battery charging if needed + power for devices on it
  • When PV production < house consumption = off-grid mode, until it reaches 20%
  • When PV production < house consumption and battery < 20% = bypass mode, until there is excess solar again.

It could greatly help people auto-consume their energy !"

Not sure if anything will come out of it, but at least I’ve tried :-).

Hi ! To estimate the missing value for solar input I am using the following formula:
wattinput=$(echo "scale=4; (0.5102040816326531 * 882* (100-$socSum)/100 )/$remainTimeMinutes*150"| bc )

for my EcoFlow Delta Mini (882Wh). Don’t expect this to be accurate … it’s my educated guess using the provided values while no output is seen.

Seems like Ecoflow changed the functionaility of the API. Getting the SOC does not work for me anymore. If I access

https://iot1.ecoflow.com/api/v1/devices/queryDeviceData?sn=XXXXXXXXXXX&appkey=XXXXXXXXXXXXXXXXXXX

I get as response:
{“code”:0,“message”:“success”,“data”:{“sn”:“XXXXXX”,“data”:{}}}

Does anyone have a new working URL?

I’m having this issue with one of my Ecoflow’s. They “changed the server” when they updated the app and in my case, it asked me to relink a River Pro. Since relinking this battery’s API returns no data. For my River, no relinking, works great, same for the Delta Pro. When I contacted support they told me all should be broken, not just the River Pro, however the data is present and reflected in HA.

Odd, I know.

This post is of little actual help other than to let you know (something unknown) is in flux and you are not alone.

Yes, I can confirm it’s the same for me, unfortunately.

I’ll try to find the time to contact them tomorrow and ask for support about it.
Gosh, it should be the other way around: more info, not less.

I contacted the support also. They suspended the Support for the API. I should tell them my serial number and ecoflow account. They will contact me with a new APP Key, as soon as it is available.

Hi, I‘m also interested in a EcoFlow integration.

Have someone tried this out?

It seems to be a Hacs integration, but it is not listed in the Hacs Integration Database? Could this be installed manual via git on Hass somehow?

When it is a legit integration it would also not need an Public API as it looks like it uses direct communication.

Hey !

Thanks about this, I didn’t know about this integration.

Yeah, you can always add the repository manually by going to HACS > Integratoins > 3 dots en the top right > Custom repositories and copy/paste the URL of the project:

Then, as usual with HACS, click on it, install it, reboot, then go to Settings > Devices & Services > Add integration and you’ll find it there.

But I’ve just tried with my Delta Max and it doesn’t seem to work:
image

It currently supports River products, so this should be the reason.
Too bad, local access would have been even better!

I’ve just created a feature request:

Anyone else has tried?

Hi, I have ecoflow delta pro. Only the AC switch works in HA, no values from the sensors.

https://imgur.com/a/UnSvyLC

Thanks for the pointer on this one. I also had no clue of this integration. As I use a couple Rivers for smaller jobs around the homestead I thought I’d give it a go. Outstanding data pulls for the River! (including total cycles, total pv, all sorts of amazing data to analyze)

Confirmed it didn’t play as nice with the Delta Pro, but my API calls are still working on that one (shrug) so at least I have what I’m used to with the Delta’s.

Anyhow, fantastic work on this one, I really hope to see it evolve.