v1ckxy / ecoflow-withoutflow

Trying to understand how to communicate with Ecoflow Portable Power Stations in OFFLINE mode.
48 stars 7 forks source link

Reprogrammed my Delta Mini over Port 80, not working anymore #2

Closed hoinzy closed 1 year ago

hoinzy commented 2 years ago

Thanks for this Repo, I did some investigation myself using the port 80 frontend. It seems like you can query the http server for device Info, tcp server and client. And you can overwrite it too :(

Unfortunatly, before discovering how to query using get, I used the writing set functions.

Can you do me a favor and look what the default values are, using this command?

curl -X POST -d '{"action":"getTCPClient"}' http://192.168.4.1 curl -X POST -d '{"action":"getTCPServer"}' http://192.168.4.1

Careful with these ones!

curl -X POST -d '{"action":"setTCPClient","data": {"host": "iot1.ecoflow.com", "port": 8055}}' http://192.168.4.1 curl -X POST -d '{"action":"setTCPServer","data": {"port": 6093}}' http://192.168.4.1

Some basic stuff: curl -X POST -d '{"action":"setSTA","data": {"ssid": "SSID_PLACEHOLDER", "psw": "PASSWORD_PLACEHOLDER"}}' http://192.168.4.1/

I found some potential implementation of this http server, this is how I discovered the other methods, and what they expect: https://github.com/Linjisen/ljs/blob/d4b78af306466ab87b2b127ea4a67fad174f40c8/bk7253_sdk_release_3.2/samples/apconfig/network_ap_config.c

It also has the discoveryDevice action, which I can see in wireshark during setup. This is done over UDP on the broadcast address 192.168.4.255 on port 6099:

request: {"action": "discoveryDevice"}
answer: { "action":"discoveryDevice",
                "Msg":"success","data:{"staMAC":"aa:bb:cc:dd:ee:ff",
                "staIP":"0.0.0.0",
                "devID":"xxxxxxxxxxxx",
                "devType":"ecoflow_ttl",
                "version":"V0.3.3",
                "deviceName":"",
                "SN":"",
                "model":0,
                "soc":0}}}
franki29 commented 2 years ago

Hi , please find the output on my delta mini: action":"getTCPClient","data":{"host":"iot1.ecoflow.com","port":6500}," "action":"getTCPServer","data":{"port":8055}," Br. Frank

franki29 commented 2 years ago

curl -X POST -d '{"action":"getDeviceInfo"}' http://XXX.XXX.XXX.XXX will give you your current wifi settings with password, very horrible to get so easy your password for your wifi.

franki29 commented 2 years ago

Hi, with the new app the output of TCPClient has changed :

"action":"getTCPClient","data":{"host":"tcp.ecoflow.com","port":80

hoinzy commented 2 years ago

Hi franki, thank you so much! This recovered my device after some back and forth. I'm currently investigating the decompiled java apk from ecoflow. I saw some interesting hardcoded IP's as alternatives to ,

(api.ecoflow.com): http://10.10.11.108:9000 TEST_HOST_PUBLIC = "http://10.10.11.108:9000"

(tcp.ecoflow.com) 10.10.11.109, seems to be port 6500

(MQTT) public static final String PORT = "8883"; public static final String SERVER = "ssl://10.10.11.107"; public static final String SUBSCRIBE_ONLINE_STATUS = "/app/device/status/%s"; public static final String SUBSCRIBE_UPGRADE_STATUS = "/app/device/progress/%s";

franki29 commented 2 years ago

Hi hoinzy, thanks for the information. I already wrote in the other issue thread that I am able to use node red to figure out some of the information about Input, Output and %. I am also able to switch on/off the 12V DC and AC output using node red.

Here the buffer values that has to be send for the delta mini with node red: ["0xaa","0x02","0x01","0x00","0xa0","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x05","0x20","0x51","0x00","0xce","0xc2"] 12V DC Out off

["0xaa","0x02","0x01","0x00","0xa0","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x05","0x20","0x51","0x01","0x0f","0x02"] 12V DC out on

["0xaa","0x02","0x07","0x00","0xde","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x04","0x20","0x42","0x00","0xff","0xff","0xff","0xff","0xff","0xff","0x2e","0xe8"] AC out off

["0xaa","0x02","0x07","0x00","0xde","0x0d","0x00","0x00","0x00","0x00","0x00","0x00","0x20","0x04","0x20","0x42","0x01","0xff","0xff","0xff","0xff","0xff","0xff","0x3e","0x28"] AC out on

So I can now use my Domoticz Server together with node red to control my Delta Mini not using a local connection. Br. Frank

franki29 commented 2 years ago

By the way, it does not matter if the device is connected to the internet or not.