berezhinskiy / ecoflow_exporter

Prometheus exporter for EcoFlow portable power stations
GNU General Public License v3.0
184 stars 27 forks source link

No Data for DELTA 2 #25

Closed Sprinterfreak closed 1 year ago

Sprinterfreak commented 1 year ago

What is the current state of the API implementation?

I tried today for the first time and got no data so far.

Running on ubuntu (docker)

~$ docker run --rm \
    -e DEVICE_SN=R33************* \
    -e ECOFLOW_USERNAME=************** \
    -e ECOFLOW_PASSWORD=********** \
    -it -p 9090:9090 ghcr.io/berezhinskiy/ecoflow_exporter
2023-03-09 02:54:16,295 INFO    Login to EcoFlow API https://api.ecoflow.com/auth/login
2023-03-09 02:54:16,891 INFO    Successfully logged in: Ecoflow User
2023-03-09 02:54:16,891 INFO    Requesting IoT MQTT credentials https://api.ecoflow.com/iot-auth/app/certification
2023-03-09 02:54:17,464 INFO    Successfully extracted account: app-8cc8****************************
2023-03-09 02:54:17,509 INFO    Connecting to MQTT Broker mqtt.ecoflow.com:8883
2023-03-09 02:54:18,085 INFO    Subscribed to MQTT topic /app/device/property/R33*************
2023-03-09 02:54:22,895 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:54:27,896 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:54:32,896 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:54:37,896 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:54:42,896 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:54:47,897 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:54:52,897 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:54:57,897 INFO    Message queue is empty. Assuming that the device is offline
2023-03-09 02:55:02,898 INFO    Message queue is empty. Assuming that the device is offline

Exporter output

~$ curl --silent http://localhost:9090/
# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 308.0
python_gc_objects_collected_total{generation="1"} 235.0
python_gc_objects_collected_total{generation="2"} 0.0
# HELP python_gc_objects_uncollectable_total Uncollectable object found during GC
# TYPE python_gc_objects_uncollectable_total counter
python_gc_objects_uncollectable_total{generation="0"} 0.0
python_gc_objects_uncollectable_total{generation="1"} 0.0
python_gc_objects_uncollectable_total{generation="2"} 0.0
# HELP python_gc_collections_total Number of times this generation was collected
# TYPE python_gc_collections_total counter
python_gc_collections_total{generation="0"} 54.0
python_gc_collections_total{generation="1"} 4.0
python_gc_collections_total{generation="2"} 0.0
# HELP python_info Python platform information
# TYPE python_info gauge
python_info{implementation="CPython",major="3",minor="11",patchlevel="1",version="3.11.1"} 1.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 3.5926016e+07
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 2.6157056e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.67833045501e+09
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 2.2800000000000002
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 9.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP ecoflow_online 1 if device is online
# TYPE ecoflow_online gauge
ecoflow_online{device="R33*************"} 0.0
# HELP ecoflow_mqtt_messages_receive_total total MQTT messages
# TYPE ecoflow_mqtt_messages_receive_total counter

The app can access the device.

I tried so far:

Can anyone confirm this currently working?

mzielinskim commented 1 year ago

My Delta2 often looses wifi connection and then it show up in the app but not via mqtt. Try to reconnect to your WiFi . You could also try if your app still shows the Delta2 when away from home ...

Sprinterfreak commented 1 year ago

Still no data. To simulate an "away from home" condition, I disabled Wifi and Bluetooth on the phone. The ecoflow app can communicate with the device while the exporter don't.

Firmware versions on my Delta 2 V1.0.0.64 V1.0.3.18(Wi-Fi)

Sprinterfreak commented 1 year ago

Works now after just sitting hours and hours. Seems like always, cloud services are not an option if reliability is required :( No cloud service provider is different. Memo to me: Buy stuff which does not need external services.

berezhinskiy commented 1 year ago

Unfortunately, this is the official response to my query regarding the possibility of communicating with EcoFlow devices via a private IP address:

Our customer are concerned about privacy disclosure caused by it, so the access to it has been closed.

I am curious if they are aware that the device is consistently accessible through Bluetooth without requiring any authorization. I despise such a mindset 🤦🏻‍♂️

Sprinterfreak commented 1 year ago

The best solution would be if one could just configure the broker to connect to. No open ports required during operation. Also this is by far the most secure method possible in terms of disclosure due to open management connections into a the blue.