npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ecoflow_mqtt_credentials

v1.0.1

Published

Retrieve login credentials for an MQTT client via ecoflow API.

Downloads

19

Readme

ecoflow_mqtt_credentials

NPM Version Downloads License

Node JS module to retrieve login credentials for an MQTT client via ecoflow API.

The Ecoflow PowerStations come with an excellent APP for SmartPhones, which allows to read the status of the storage, consumption of the connections and make configurations. In the background, this app uses the MQTT protocol known from IOT communication, whereby the communication always runs via the Ecoflow servers. For the connection to a smart-home system or an energy management system, the MQTT broker can be used. Unfortunately, this requires access data that are not identical to those that were originally specified in the APP. _

This node module performs exactly the same steps that are used by the APP to use any MQTT client to access the Ecoflow PowerStation.

Install (to use in your module/project)

npm install --save ecoflow_mqtt_credentials

Usage (in your code)


const ecoflowmqttcredentials = require("ecoflow_mqtt_credentials");

// Define a settings object
let settings = {
    email:"[email protected]",
    password:"APP Password",
    serial_number:"R611ZEB1AB1234567" // this is optional - but gives you some topics to use in MQTT if given
}

ecoflowmqttcredentials.retrieve(settings).then(function(mqttsettings) {
        console.log(mqttsettings);
});

// Alternative if in async function :
// let mqttsettings = await ecoflowmqttcredentials.retrieve(settings)

Output

If successfull it returns a quite large JSON object you could use in your code.

{
  api_userid: '1234567890',
  api_token: 'eyJ...long....JWT-Token...',     
  mqtt_protocol: 'mqtts',
  mqtt_server: 'mqtt-e.ecoflow.com',
  mqtt_port: '8883',
  mqtt_username: 'app-12345678901235567',
  mqtt_password: 'abcd12345677890abcdef',
  mqtt_client_ids: [
    'ANDROID_4a1f9208-2fa4-485f-9c5f-04845778db97_1234567890',
    'ANDROID_fbbc69d0-8e45-42f0-99b1-22af756d67b7_11234567890',
    'ANDROID_afd7925f-1a7d-4dae-bdfa-9e5c0cde9c35_1234567890'
  ],
  mqtt_topics: [
    { topic: '/app/device/property/R611ZEB1AB1234567', subject: 'status' },
    {
      topic: '/app/1234567890/R611ZEB1AB1234567/thing/property',
      subject: 'get/set configuration'
    }
  ]
}

Hints

Ecoflow MQTT servers require you to set your MQTT client library to use a clientId that follows a schema. Samples are given in the mqttclient_ids array of the result.

Catch execptions and handle them. This module throws exceptions that are human readable and could be handled.

Credit

Based on the great work of @mmiller7 at https://github.com/mmiller7/ecoflow-withoutflow/blob/main/cloud-mqtt/ecoflow_get_mqtt_login.sh

Maintainer / Imprint

LICENSE

Apache-2.0