tolwi / hassio-ecoflow-cloud

EcoFlow Cloud Integration for Home Assistant
394 stars 71 forks source link

(('accessKey is invalid',), {}) #343

Open pookexvi opened 1 month ago

pookexvi commented 1 month ago

ive tried setting up API for my account. i have gone though IoT Developer Platform for ecoflow. have set up a code. when i input it in to HA (both codes) all i get is

(('accessKey is invalid',), {})

tried deleting the old code making a new one. making sure its copy and pasting the right code. still showing the same error.

tensor5g commented 1 month ago

I am getting the same error. I even set up a test script to test my key against ecoflow's API

ACCESS_KEY=""   # Replace with your access key
SECRET_KEY=""   # Replace with your secret key
NONCE=$(( RANDOM % 900000 + 100000 ))  # Random 6-digit number
TIMESTAMP=$(date +%s%3N)  # UTC timestamp in milliseconds

PARAMS="accessKey=$ACCESS_KEY&nonce=$NONCE&timestamp=$TIMESTAMP"
SIGN=$(echo -n "$PARAMS" | openssl dgst -sha256 -hmac "$SECRET_KEY" | sed 's/^.* //')

curl -X GET "https://api-a.ecoflow.com/iot-open/sign/device/list" \
-H "accessKey:$ACCESS_KEY" \
-H "timestamp:$TIMESTAMP" \
-H "nonce:$NONCE" \
-H "sign:$SIGN"

You should be able to run this from any Linux system. For me, this works, which tells me there isn't a problem with my API key.

mattpeufpeuf commented 1 month ago

Same problem. :/

Cette erreur provient d'une intégration personnalisée

Enregistreur: custom_components.ecoflow_cloud.api.ecoflow_mqtt Source: custom_components/ecoflow_cloud/api/ecoflow_mqtt.py:63 intégration: EcoFlow-Cloud (documentation, problèmes) S'est produit pour la première fois: 18 septembre 2024 à 16:45:47 (985 occurrences) Dernier enregistrement: 17:21:18

Unexpected MQTT Socket disconnection : <ssl.SSLSocket fd=24, family=2, type=1, proto=6, laddr=('192.168.1.9', 43631), raddr=('18.159.239.78', 8883)> Unexpected MQTT Socket disconnection : <ssl.SSLSocket fd=24, family=2, type=1, proto=6, laddr=('192.168.1.9', 54641), raddr=('18.159.239.78', 8883)> Unexpected MQTT Socket disconnection : <ssl.SSLSocket fd=24, family=2, type=1, proto=6, laddr=('192.168.1.9', 37755), raddr=('18.159.239.78', 8883)> Unexpected MQTT Socket disconnection : <ssl.SSLSocket fd=39, family=2, type=1, proto=6, laddr=('192.168.1.9', 36659), raddr=('18.159.239.78', 8883)> Unexpected MQTT Socket disconnection : <ssl.SSLSocket fd=48, family=2, type=1, proto=6, laddr=('192.168.1.9', 55347), raddr=('18.159.239.78', 8883)>

walderston commented 1 month ago

@mattpeufpeuf your issue is different.. Assume you've restarted HA or the integration app? I deleted my key from the developer portal, generated a new key and its been stable for 4 days so far.

Issue is the client_id value is limited to 10 per day - but I can't workout when it resets.

dltccf commented 1 month ago

This is very frustrating. I have 2 delta pros and a unique issue which may or may not help with figuring out the issue. Interestingly one had to be returned for replacement a few months ago and somehow the serial numbers didn't get updated in the database so when I try to use the public API to add a device it shows one of my current delta pros and the old one I returned. Neither of these two work using either the public API or the private. This morning I went through deleting the old accesskey and then rebooting my machine and restarting HA. Then creating a new accesskey. I get (('accessKey is invalid',), {}) when I try to use the public key. When I use the private API it says it worked, but just reports all zeros.

The really interesting part however, is that the other delta pro which is the replacement that EF appears to have forgotten to register to me, works perfectly and has worked perfectly the whole time using the private API. So somehow a properly registered machine doesn't work and one not properly registered does.

dltccf commented 1 month ago

interesting, I ran your test script, thanks @tensor5g. and I get success on both my devices with the proper sn. So it would appear the problem is not with the key, but with the current public API code.

AlirezaHafez commented 1 month ago

the problem is with the region, if your product is setup within EU base URI is "api-e.ecoflow.com" if North America is "api-a.ecoflow.com", it is for regulatory reasons. adding a dialogue box that user can select the region before inputting the access key can help to solve this issue.