berezhinskiy / ecoflow_exporter

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

Stops receiving metrics from queue until open Ecoflow App #67

Open KulykDmytro opened 1 month ago

KulykDmytro commented 1 month ago

Ecoflow River PRO

Exporter started and connected to api, started to acquire metrics and stops receiving ones with message

Message queue is empty. Assuming that the device is offline

in case you open an app (Android in my case) and open device status - everything back to normal

...
2024-07-19 20:06:03,999 INFO    Processing 2 event(s) from the message queue
2024-07-19 20:06:09,000 INFO    Processing 4 event(s) from the message queue
2024-07-19 20:06:14,001 INFO    Message queue is empty. Assuming that the device is offline
...
2024-07-19 20:08:59,012 INFO    Message queue is empty. Assuming that the device is offline
2024-07-19 20:09:04,012 INFO    Processing 2 event(s) from the message queue
2024-07-19 20:09:09,013 INFO    Processing 3 event(s) from the message queue
...
KulykDmytro commented 1 month ago

Exporter restart hepls a bit but not much - till next app open

2024-07-19 20:12:56,861 INFO    Created new metric from payload key bmsMaster.maxChargeSoc -> ecoflow_bms_master_max_charge_soc
2024-07-19 20:12:56,861 INFO    Created new metric from payload key bmsMaster.openBmsIdx -> ecoflow_bms_master_open_bms_idx
2024-07-19 20:13:01,861 INFO    Message queue is empty. Assuming that the device is offline
2024-07-19 20:13:06,861 INFO    Processing 9 event(s) from the message queue
2024-07-19 20:13:11,864 INFO    Processing 6 event(s) from the message queue
2024-07-19 20:13:16,866 INFO    Processing 5 event(s) from the message queue
2024-07-19 20:13:21,867 INFO    Message queue is empty. Assuming that the device is offline
2024-07-19 20:13:26,868 INFO    Message queue is empty. Assuming that the device is offline
2024-07-19 20:13:31,868 INFO    Message queue is empty. Assuming that the device is offline
2024-07-19 20:13:36,868 INFO    Message queue is empty. Assuming that the device is offline

after lock the phone in 2 minutes sharp exporter "catches" Message queue is empty

KulykDmytro commented 1 month ago

When exporter falls into empty queue mode, try to restart it. after restart metrics starts to collect within 30 seconds, and then looping back into the same state:

2024-07-22 11:00:20,721 INFO    Login to EcoFlow API https://api.ecoflow.com/auth/login
2024-07-22 11:00:21,118 INFO    Successfully logged in: Kotyara
2024-07-22 11:00:21,118 INFO    Requesting IoT MQTT credentials https://api.ecoflow.com/iot-auth/app/certification
2024-07-22 11:00:21,442 INFO    Successfully extracted account: app-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2024-07-22 11:00:21,723 INFO    Connecting to MQTT Broker mqtt-e.ecoflow.com:8883 using client id ANDROID_xxxxxxxxxxxxxxxx-xxxxxxxxx
2024-07-22 11:00:21,830 INFO    Subscribed to MQTT topic /app/device/property/xxxxxxxxxxxxx
2024-07-22 08:20:05,935 INFO    Processing 3 event(s) from the message queue
2024-07-22 08:20:10,953 INFO    Processing 4 event(s) from the message queue
2024-07-22 08:20:15,955 INFO    Processing 6 event(s) from the message queue
2024-07-22 08:20:20,959 INFO    Processing 2 event(s) from the message queue
2024-07-22 08:20:25,963 INFO    Processing 5 event(s) from the message queue
2024-07-22 08:20:30,967 INFO    Message queue is empty. Assuming that the device is offline
2024-07-22 08:20:35,969 INFO    Message queue is empty. Assuming that the device is offline
2024-07-22 08:20:40,971 INFO    Message queue is empty. Assuming that the device is offline
KulykDmytro commented 1 month ago

looks like 2.1.0 fixes it (i believe due to upgrade of mqtt lib) at least for River Pro

v3nko commented 1 month ago

I still see this issue in 2.1.0.

2024-07-22 12:36:54,620 WARNING Skipping unsupported metric mppt.res: [0, 0, 0, 0, 0]
2024-07-22 12:37:04,620 INFO    Message queue is empty. Assuming that the device is offline
2024-07-22 12:37:14,622 INFO    Message queue is empty. Assuming that the device is offline
2024-07-22 12:37:24,624 INFO    Processing 3 event(s) from the message queue
2024-07-22 12:37:24,624 WARNING Skipping unsupported metric bms_bmsStatus.cellTemp: []
2024-07-22 12:37:24,624 WARNING Skipping unsupported metric bms_bmsStatus.cellVol: [3323, 3323, 3322]
2024-07-22 12:37:34,625 INFO    Message queue is empty. Assuming that the device is offline
2024-07-22 12:37:44,626 INFO    Message queue is empty. Assuming that the device is offline
2024-07-22 12:37:54,628 INFO    Message queue is empty. Assuming that the device is offline
2024-07-22 12:38:04,629 INFO    Processing 2 event(s) from the message queue
2024-07-22 12:38:04,630 WARNING Skipping unsupported metric bms_bmsStatus.cellTemp: []
2024-07-22 12:38:04,630 WARNING Skipping unsupported metric bms_bmsStatus.cellVol: [3317, 3318, 3322, 3318, 3318, 3318, 3317, 3318]
2024-07-22 12:38:14,630 INFO    Message queue is empty. Assuming that the device is offline
KulykDmytro commented 1 month ago

@v3nko are metrics appear after mobile app started?

v3nko commented 1 month ago

Exactly.

vpikus commented 1 month ago

Hi, I encountered the same issue after updating the internal EcoFlow software to version 4.1.3.07 on River 2 series. I can't recall the previous version, but everything was functioning properly before this upgrade. Now, it requires the opened application on iOS/Android for stable metrics scraping.

yee379 commented 3 weeks ago

same here on delta pro's: one on v1.0.1.97 and the other on 1.0.1.84 - i receive metrics only after i log into the app now - using device sharing and using the shared account to gather metrics.

Sharp3r commented 3 weeks ago

The issue appears for Delta 2 with software v. 1.0.1.134.

_ecoflowexporter log:

2024-08-14 21:47:49 2024-08-14 18:47:49,627 INFO    Message queue is empty. Assuming that the device is offline
2024-08-14 21:47:59 2024-08-14 18:47:59,629 INFO    Message queue is empty. Assuming that the device is offline
2024-08-14 21:48:09 2024-08-14 18:48:09,631 INFO    Message queue is empty. Assuming that the device is offline
2024-08-14 21:48:13 2024-08-14 18:48:13,034 ERROR   No messages received for 60 seconds. Reconnecting to MQTT
2024-08-14 21:48:13 2024-08-14 18:48:13,049 INFO    Connecting to MQTT Broker mqtt-e.ecoflow.com:8883 using client id ANDROID_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_XXXXXXXXXXXXXXXXX
2024-08-14 21:48:13 2024-08-14 18:48:13,142 INFO    Reconnection successful, continuing
2024-08-14 21:48:13 2024-08-14 18:48:13,192 ERROR   Unexpected MQTT disconnection: Unspecified error. Will auto-reconnect
2024-08-14 21:48:19 2024-08-14 18:48:19,370 INFO    Subscribed to MQTT topic /app/device/property/XXXXXXXXXXXXX
2024-08-14 21:48:19 2024-08-14 18:48:19,632 INFO    Message queue is empty. Assuming that the device is offline
t000x commented 3 weeks ago

the same for me - exporter service restart is not helping - only opening the iOS app is fixing the missing data. right after the screen locks or after the app is closed the data is missing again with error messages like: ecoflow_exporter | 2024-08-14 18:36:14,241 INFO Message queue is empty. Assuming that the device is offline ecoflow_exporter | 2024-08-14 18:36:24,246 INFO Message queue is empty. Assuming that the device is offline

Delta 2 Firmware 1.0.1.134 Wi-Fi 1.0.6.39

EcoFlow App version V5.5.0.88

lonexus commented 3 weeks ago

It started happening to me too yesterday morning, a few days after I updated my Delta Pro to FW version 1.0.1.97 (and App version 5.5.0.24)

scamianbas commented 2 weeks ago

Same issue here with my Delta 2 :/

antongorodezkiy commented 1 week ago

Faced the same issue on River Max 2 4.1.3.02

antongorodezkiy commented 1 week ago

Seems like a widespread issue now, found similar feedback on the hassio-ecoflow-cloud app, particularly - https://github.com/tolwi/hassio-ecoflow-cloud/issues/283#issuecomment-2304116922

antongorodezkiy commented 1 week ago

So for my purposes I had to add authorization through the official (they call it "open"?) Ecoflow API and it works no matter what happened with the Ecoflow App.

I created some simple Official Ecoflow API wrapper - https://bitbucket.org/antongorodezkiy/ecoflow-notificator/src/main/app/ecoflow/api.py

Replaced authorization in main

For the Open API I used accessKey and secretKey from the Developers dashboard.

And added new MQTT subscription topic /open/{self.username}/{self.device_sn}/quota to receive data I need and then process

Response of the /open/{self.username}/{self.device_sn}/quota has the similar format:


2024-08-26 20:42:09,436 DEBUG   Processing params: {'soc': 57, 'num': 0, 'minCellVol': 3221, 'tagChgAmp': 20000, 'sysVer': 50397534, 'remainTime': 0, 'outputWatts': 97, 'type': 1, 'maxCellVol': 3221, 'inputWatts': 0, 'f32ShowSoc': 56.6, 'errCode': 0, 'bmsFault': 0, 'openBmsIdx': 1, 'remainCap': 9781}
2024-08-26 20:42:09,436 DEBUG   Recived payload: {"moduleType":1,"needAck":0,"id":23741542,"time":23741542,"params":{"beepMode":0,"usb2Watts":0,"invUsedTime":1077663,"carWatts":0,"standbyMin":30,"soc":57,"wattsOutSum":66,"remainTime":150,"chgDsgState":0,"brightLevel":100,"qcUsb2Watts":0,"ext4p8Port":0,"extRj45Port":0,"typec2Watts":0,"lcdOffSec":300,"dcOutState":0,"ext3p8Port":0,"usb1Watts":0,"qcUsb1Watts":0,"carState":0,"typec1Watts":0,"wattsInSum":0},"version":"1.0","typeCode":"pdStatus"}
2024-08-26 20:42:09,436 DEBUG   Processing params: {'beepMode': 0, 'usb2Watts': 0, 'invUsedTime': 1077663, 'carWatts': 0, 'standbyMin': 30, 'soc': 57, 'wattsOutSum': 66, 'remainTime': 150, 'chgDsgState': 0, 'brightLevel': 100, 'qcUsb2Watts': 0, 'ext4p8Port': 0, 'extRj45Port': 0, 'typec2Watts': 0, 'lcdOffSec': 300, 'dcOutState': 0, 'ext3p8Port': 0, 'usb1Watts': 0, 'qcUsb1Watts': 0, 'carState': 0, 'typec1Watts': 0, 'wattsInSum': 0}
2024-08-26 20:42:09,436 DEBUG   Recived payload: {"moduleType":2,"needAck":1,"id":23742462,"time":23742462,"params":{"soc":57,"num":0,"tagChgAmp":20000,"sysVer":50397534,"remainTime":0,"outputWatts":102,"type":1,"inputWatts":0,"f32ShowSoc":56.6,"errCode":0,"bmsFault":0,"openBmsIdx":1,"remainCap":9780},"version":"1.0","typeCode":"bmsStatus"}
normtomlins commented 1 day ago

I also see this issue on firmware version 3.1.3.10 on my River 2 unit. If the app is open, the metrics are updated.