EcoFlow BLE (Unofficial)

Hello folks,

I spent some time reverse-engineering the EcoFlow BLE protocol for my Delta Pro Ultra and Smart Home Panel 2 ( GitHub - rabits/ef-ble-reverse: Unofficial repository with EcoFlow BLE protocol V2 reverse engineering ) and finally after weeks of development created this integration: GitHub - rabits/ha-ef-ble: Unofficial EcoFlow BLE Home Assistant integration

It’s still an alpha (v0.3.0), but already can collect pushed data from SHP2 & DPU devices so could be useful. I will continue to improve and will be glad to hear constructive criticism. Since it’s my first integration for HA: quite sure I missed something important, so any general suggestions or PRs on how to improve the integration overall will help greatly!

Docs can be found here: Home · rabits/ha-ef-ble Wiki · GitHub

3 Likes

Gave this a go but seems all my sensors show unavailable. Though I am running different version on shp2 4.0.3.27. I’ll give the scripts a go and check if that gets me further.

Thank you for testing! Sorry it’s still in early stage and I yet need to figure out the firmware upgrade process for shp2 & dpu to be able to control firmware upgrade/downgrade freely.

If you can collect the debug logs - that should give us some thoughts to think about.

I’m having the same unavailable issue as well on firmware 4.0.3.27, but willing to help get the info if needed. What do you need from me?

Thanks!

Hi @Jazzphone , will be great to see: so you click “add integration”, selecting “EcoFlow BLE (Unofficial)” and it shows you something (like list of available devices) or it’s empty?
And you can go into integration https://YOUR_HA_ADDRESS/config/integrations/integration/ef_ble and click “Enable debug logging” - then try to add device, then click “Disable debug logging” and it will ask you where to save the log file. But please check it before attaching here - it could contain your EcoFlow ID, so will be better to mask it.

Thank you!

Hi. I’ve trying to test this but without success. I am running the smart Home Panel 2 on firmware 4.0.3.27 and when launched the Integration sees bith my devices (SMH2 and Delta Pro Ultra) but I can’t find my Ecoflow User ID

I can log in to the ecoflow portal, but I don’t know where ot find the “Dev Console”…

Hi @slatour007 , yeah I suppose I need to describe it better in the docs - the dev console you can find in your browser: Firefox or Chrome (usually you can open it by pressing F12, or through the menu).

I managed to find my userid. Tried to connect the integration but everything is still “unavailable”. I’ll keep working on it in the next few days.

Moving forward. Thanks

I was able to locate the POST sent to api-a.ecoflow.com, but I did not find the data.user.userId field in the response headers as described on the github site. I don’t have a rooted device - Is there any other way to identify the user id?

Hi @fcorrao , I just did the same and prepared a little screenshot from my firefox, so hopefully this will help you:

Thanks. I was able to extract my userId with these instructions. I added your integration and it found my shp2 and dpu but doesn’t show any data for them. So I pulled down your ef-ble-reverse scripts and tried to use those to connect. I can’t figure out the shp2’s address and it doesn’t show up in the scanner when running connect.py. I do see the dpu’s but when I try to connect to it by specifing its address in connect.py, I get “KeyError”. firmware on the dpu is 5.0.0.49 and on the shp2 is 4.0.3.34

Hi @fcorrao , could you please attach any debug logs (please check them on private info like login id or serial numbers of the devices before sending)? You can enable debug logging in the integration and then try to connect the device. Then disable it and it will allow you to save the log.

If you are using the ef-ble-reverse repo - please make sure you know python and can read the exception traces, this tool is not for regular users and is needed for debug purposes of developers.

I also gave it a try since I would really like to not connect my EcoFlow to Wifi. Unfortunately, I wasn’t even able to scan for devices, it seems? I have other BLE integrations in my HA config. Is it the reason?

Thank you for your work!

Hi @me.tommyc , oh that’s a shame, sorry about that - but in general if your BLE dongle can see the device there should be no issues in detecting the devices. So what’s the EF devices do you have?

Hello, I’m also facing the issue where I’m able to connect to my Delta Pro Ultra via Bluetooth, but none of the entities populate.
My DPU has FW Version: V0.1.0.0 and 2.0.2.4(Wi-FI)

A Snippet of the logs:

2024-12-02 18:08:47.234 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Disconnecting from device
2024-12-02 18:08:47.652 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Connected
2024-12-02 18:08:47.652 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: MTU: 500
2024-12-02 18:08:47.652 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Init completed, starting auth routine...
2024-12-02 18:08:47.652 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: initBleSessionKey: Pub key exchange
2024-12-02 18:08:47.653 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 00 01 2c 00 01 00 38 31 37 73 6f 48 f7 8c 23 7f bb b6 49 48 d2 75 bd 65 54 09 46 9c 02 75 10 9e 5f af 96 61 29 bd 34 79 67 23 bc 22 42 50 02 18'
2024-12-02 18:08:48.070 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseSimple: Data: '5a 5a 00 01 2d 00 01 00 00 3e b1 31 e9 89 53 34 16 a2 de b8 b1 78 fa 5a b8 eb 57 fe d8 73 d6 f2 65 d2 43 f1 31 69 ee cf e5 9b 8b ce 95 87 4e 49 d1 25 2b'
2024-12-02 18:08:48.072 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: getKeyInfoReq: Receiving session key
2024-12-02 18:08:48.072 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 00 01 03 00 02 86 c2'
2024-12-02 18:08:48.483 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseSimple: Data: '5a 5a 00 01 23 00 02 e5 be d7 e2 93 fd 42 45 8f fa 74 99 0f 4d a4 5d 6d 11 d5 0d f2 f0 e6 e9 4e 91 32 e0 d2 6e 28 f7 e6 3b'
2024-12-02 18:08:48.484 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: getKeyInfoReq: Receiving auth status
2024-12-02 18:08:48.485 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 10 01 22 00 8d 85 ca 80 49 3a a2 b5 61 6b d5 d5 8a 25 19 aa a0 0b b1 83 74 a6 cc 6f 3d 6c 85 ab 69 81 d7 22 b5 9c'
2024-12-02 18:08:48.884 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: Data: '5a 5a 10 01 22 00 68 0b 50 b9 df 3b 37 2b 84 c2 b0 99 df 24 e7 f6 50 b2 3c dc 21 8f 9e 46 47 e5 6f 7d 74 56 10 0c b2 8a'
2024-12-02 18:08:48.885 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: decrypted payload: 'aa 03 02 00 f4 0e 00 00 00 00 05 1d 35 21 01 01 35 89 01 00 b9 a3'
2024-12-02 18:08:48.886 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: getAuthStatusHandler: data: '01 00'
2024-12-02 18:08:48.886 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: autoAuthentication: Sending secretKey consists of user id and device serial number
2024-12-02 18:08:48.888 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 10 01 42 00 31 61 cc 13 ec a3 a6 0c 32 fc 37 7c 1f 6e 62 2d c1 6d 9a ad ac 61 23 10 b9 11 f5 1f fa 6d cc e7 2e bf 43 50 72 24 7c 7b d5 42 f0 0e e4 cb cf 08 36 02 f0 cb d5 07 92 e1 22 6a 10 a2 31 1f 13 8b c4 a7'
2024-12-02 18:08:49.231 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: Data: '5a 5a 10 01 22 00 4c d8 fe cf 3d d3 16 c3 ff 6b 6a d8 17 c7 29 61 87 3d 0b 73 1d 11 c1 a0 de 5a b4 24 cd f9 9e 5d e6 cd 5a 5a 10 01 22 00 db b3 8e 13 8c f2 7d 79 43 4f b6 c9 e6 84 05 e4 30 12 47 24 b6 03 e4 f7 a6 72 11 67 76 42 d5 49 00 40'
2024-12-02 18:08:49.232 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: decrypted payload: 'aa 03 01 00 cb 0e 00 00 00 00 05 1d 35 21 01 01 35 86 00 ce a8'
2024-12-02 18:08:49.233 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: decrypted payload: 'aa 03 00 00 de 0d 00 00 00 00 05 1d 35 21 01 00 01 52 09 96'
2024-12-02 18:08:49.233 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: autoAuthenticationHandler: data: '00'
2024-12-02 18:08:49.233 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: listenForData: Listening for data from device
2024-12-02 18:08:49.802 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: Data: '5a 5a 10 01 52 00 db e7 28 c8 1b 09 bc 3c 60 a8 07 93 66 15 c0 8a 1b 81 e5 8f 43 c8 c2 b2 87 2d f5 0d 40 e8 21 f1 dc db ed 5d d5 96 4a 8b 8c 0d e8 2d c7 57 9c db a9 58 2d f7 85 54 b3 ec 4c 4a f6 71 89 49 70 5f d7 22 4c 06 36 34 6f 8c 14 cf 2c 62 63 92 71 9a 50 c0'
2024-12-02 18:08:49.804 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: decrypted payload: 'aa 13 30 00 85 2c 0f d3 0d 00 06 1d 06 21 01 00 fe 10 07 0e 15 15 07 0e 1f b9 1f 17 bd 05 2d 1f 0f 0f 8f 30 0f 0f 8f 30 0f 0f 0f 0f 0f 0f 0f 0f 2d 1f 56 38 3e 3d 55 4e 4d 3b 3b 48 4e 49 3f 3c 39 38 d7 4d'
2024-12-02 18:08:49.804 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: listenForDataHandler: packet src: 06, cmdSet: FE, cmdId: 10
2024-12-02 18:08:49.804 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: listenForDataHandler: packet data: '07 0e 15 15 07 0e 1f b9 1f 17 bd 05 2d 1f 0f 0f 8f 30 0f 0f 8f 30 0f 0f 0f 0f 0f 0f 0f 0f 2d 1f 56 38 3e 3d 55 4e 4d 3b 3b 48 4e 49 3f 3c 39 38'
2024-12-02 18:08:54.135 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Disconnected from device
2024-12-02 18:08:54.136 DEBUG (MainThread) [custom_components.ef_ble] Init EcoFlow BLE Integration
2024-12-02 18:08:54.136 DEBUG (MainThread) [custom_components.ef_ble] Connecting Device
2024-12-02 18:08:54.136 DEBUG (MainThread) [custom_components.ef_ble.eflib.devicebase] <MAC>: Creating new device: Delta Pro Ultra 'EF-YJ0310
2024-12-02 18:08:54.136 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Connecting to device
2024-12-02 18:08:58.193 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Connected
2024-12-02 18:08:58.193 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: MTU: 500
2024-12-02 18:08:58.193 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Init completed, starting auth routine...
2024-12-02 18:08:58.193 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: initBleSessionKey: Pub key exchange
2024-12-02 18:08:58.194 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 00 01 2c 00 01 00 e2 54 20 7c bc c4 c8 09 a4 39 ac 56 df 6b 4e 5e 6e ad 86 46 84 d3 f2 93 9b 40 bf ee 78 74 76 86 b4 df ee 88 96 55 31 d1 ad 8a'
2024-12-02 18:08:58.412 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseSimple: Data: '5a 5a 00 01 2d 00 01 00 00 24 38 0c a1 57 fc 97 e1 f1 dc ea 59 a0 47 9a bc 76 f0 ba 41 58 d3 4f 1e 07 c7 da f9 d2 eb cf 2b 92 7d e0 53 ad 35 4f 4c c9 49'
2024-12-02 18:08:58.414 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: getKeyInfoReq: Receiving session key
2024-12-02 18:08:58.414 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 00 01 03 00 02 86 c2'
2024-12-02 18:08:58.420 DEBUG (MainThread) [custom_components.ef_ble] Creating entities
2024-12-02 18:08:58.420 DEBUG (MainThread) [custom_components.ef_ble] Setup done
2024-12-02 18:08:58.800 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseSimple: Data: '5a 5a 00 01 23 00 02 b8 db a2 14 8d 35 d8 b6 80 de d7 ae 94 3f e5 16 c2 5c 5f 6c c3 90 87 8c 71 95 af 2b 85 9d 78 2d 3d e3'
2024-12-02 18:08:58.801 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: getKeyInfoReq: Receiving auth status
2024-12-02 18:08:58.802 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 10 01 22 00 09 55 31 40 12 fa dc 52 65 37 77 62 18 e6 e3 e8 a9 53 1e f1 ee c7 3b 7e db 81 1e 49 c8 bf 4a 63 3d b1'
2024-12-02 18:08:59.209 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: Data: '5a 5a 10 01 22 00 2d f4 ac 07 7b 8b 27 14 cf 2e 0c ab f8 28 d0 14 94 12 ad 94 d0 f6 1d 9a 93 c3 cd 0f c3 9a 80 60 b6 82'
2024-12-02 18:08:59.210 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: decrypted payload: 'aa 03 02 00 f4 0e 00 00 00 00 05 1d 35 21 01 01 35 89 01 00 b9 a3'
2024-12-02 18:08:59.210 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: getAuthStatusHandler: data: '01 00'
2024-12-02 18:08:59.210 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: autoAuthentication: Sending secretKey consists of user id and device serial number
2024-12-02 18:08:59.212 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Sending: '5a 5a 10 01 42 00 74 b3 29 5f eb 40 6b da e4 15 e3 18 31 4e b0 81 03 1b 2c 25 72 cb ae 59 b6 06 f0 07 46 63 01 e4 16 49 7e 4a 36 7a 89 30 bd 31 ba 8c de da 6b 85 e0 52 d6 04 63 b6 5b d1 5c 9f db 09 2e 2c 4c 57 b1 45'
2024-12-02 18:08:59.524 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: Data: '5a 5a 10 01 22 00 e4 62 1c f6 9a 06 78 96 b7 c6 ff 8e 1d 15 df 24 43 3e 47 5c dd 35 9e b2 ca 03 a5 f9 dc ed 2e d0 d8 cd 5a 5a 10 01 22 00 7e 0e b1 ff 41 c7 a3 cf 42 fd fb 07 6f fb 6d ba cc 8c d0 64 7e e6 46 ec 83 f6 85 05 d4 f7 2e d4 ae c5'
2024-12-02 18:08:59.525 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: decrypted payload: 'aa 03 01 00 cb 0e 00 00 00 00 05 1d 35 21 01 01 35 86 00 ce a8'
2024-12-02 18:08:59.526 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: parseEncPackets: decrypted payload: 'aa 03 00 00 de 0d 00 00 00 00 05 1d 35 21 01 00 01 52 09 96'
2024-12-02 18:08:59.527 DEBUG (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: autoAuthenticationHandler: data: '00'
2024-12-02 18:08:59.527 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: listenForData: Listening for data from device
2024-12-02 18:09:03.559 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Disconnected from device
2024-12-02 18:09:03.560 INFO (MainThread) [custom_components.ef_ble.eflib.connection] <MAC>: Reconnecting to device

Hi @toastflyinginsectpie , sorry for the confusion - but the integration still can’t work with DPU (only SHP2 for now) - there is no device implemented yet, although it can handle the protocol and in my reverse-engineering repo there are protobuf handlers for it. So no worries - subscribe here or to the integration repo and I will send a notification when DPU will be available as well.

Overall the logs looks fine - so that will be an easy one to update and get the entities.

Ah Darn, in my skimming of the documentation it sounded like it was working.

For what its worth, I’m seeing this a bit as well in my logs:


<MAC>: Auth failed with response: '65 6c 77 77 65 6c 7d db 7d 75 df 67 4f 7d 6d 6d ed 52 6d 6d ed 52 6d 6d 6d 6d 6d 6d 6d 6d 4f 7d 34 5a 5c 5f 37 2c 2f 59 59 2a 2c 2b 5d 5e 5b 5a'

<MAC>: Auth failed with response: '29 20 3b 3b 29 20 31 97 31 39 93 2b 03 31 21 21 a1 1e 21 21 a1 1e 21 21 21 21 21 21 21 21 03 31 78 16 10 13 7b 60 63 15 15 66 60 67 11 12 17 16'

<MAC>: Auth failed with response: ''

<MAC>: Auth failed with response: 'c1 c8 d3 d3 c1 c8 d9 7f d9 d1 7b c3 eb d9 c9 c9 49 f6 c9 c9 49 f6 c9 c9 c9 c9 c9 c9 c9 c9 eb d9 90 fe f8 fb 93 88 8b fd fd 8e 88 8f f9 fa ff fe'

<MAC>: Auth failed with response: '1d 14 0f 0f 1d 14 05 a3 05 0d a7 1f 37 05 15 15 95 2a 15 15 95 2a 15 15 15 15 15 15 15 15 37 05 4c 22 24 27 4f 54 57 21 21 52 54 53 25 26 23 22'

<MAC>: parseEncPackets: Unable to parse encrypted packet - prefix is incorrect: '5a 10 01 22 00 20 85 32 46 4b 35 58 de f6 c7 b9 9a 3e ac fd de b0 dc bd 69 b2 12 1b 90 19 df 61 d2 8a ba fa c1 93 8f'

<MAC>: parseEncPackets: Unable to parse encrypted packet - prefix is incorrect: '5a 10 01 22 00 f8 8d f0 26 f3 02 eb 30 81 db 9f 70 36 b8 71 9d bc 01 d6 9a fc 1c a0 fa 08 77 34 50 20 57 83 7a 14 cb'

<MAC>: parseEncPackets: Unable to parse encrypted packet - prefix is incorrect: '5a 10 01 22 00 29 d4 db 29 a6 43 65 c5 8d 67 f6 6d 7f d2 93 ab 65 19 3b a4 b7 7d cb 7a fa bb 6e f3 65 56 55 51 60 f6'

<MAC>: parseEncPackets: Unable to parse encrypted packet - prefix is incorrect: '5a 10 01 22 00 72 29 57 79 de 53 2a 1d 1a a2 15 78 3c 6d 7b db 86 ac 65 39 9c dc 96 c2 16 e1 3a 55 81 69 17 58 5b 2b'

<MAC>: parseEncPackets: Unable to parse encrypted packet - prefix is incorrect: '5a 10 01 22 00 5e 69 49 7f 6a 84 c7 e5 9e ef a4 5c 5e 3a df 17 b7 16 a4 b6 6f c5 a6 51 4a 5a e6 fc be 2c 6a bb df 4d'

Regardless thanks for the quick reply, and let me know if I can do any additional debugging for you!

Yep, no worries about that - DPU uses slightly different encoding (also xor’s data), so it’s already addressed in the reverse-engineering repo, but still need to find some time to make it right in the integration itself. Sorry for the inconvenience, hopefully upcoming holidays will allow me to work on this integration more, but unfortunately still busy with paid work :slight_smile:

1 Like

@Rabit I have a recent EcoFlow Delta 2 Max and indeed there’s an error in logs

Logger: custom_components.ef_ble.eflib
Source: custom_components/ef_ble/eflib/init.py:30
integration: EcoFlow BLE (Unofficial) (documentation, issues)
First occurred: 08:42:23 (1 occurrences)
Last logged: 08:42:23

XX:XX:XX:XX:XX:XX: Unknown SN: b’serial’

Is there anything I could do?

Hi @me.tommyc , sorry to say, but if you will look at the supported devices - you will see only SHP2 for now. Also in my plan is to implement DPU, but not the other devices - because I don’t have them to test properly. Will be glad to see PR’s with changes to integration to support them though.