tomquist / solix2mqtt

CLI tool to poll the Solix API for the latest sample data from all devices and publish them to an MQTT broker.
MIT License
28 stars 8 forks source link

solix2mqtt

CLI tool to poll data for an Anker SOLIX Solarbank E1600 Balcony Power Storage and publish it to an MQTT broker.

Description

This is a thin bridge between the API used by the Anker App and MQTT. Although the project is currently read-only, adding support for updates should be relatively straightforward. Feel free to open a PR.

Prerequisites

Before you begin, ensure you have met the following requirements:

Software

Setup

  1. Clone the repository: Clone this repository to your local machine using git clone https://github.com/tomquist/solix2mqtt.git.
  2. Navigate to the project directory: cd solix2mqtt.
  3. Install dependencies: Run npm install to install all the project dependencies.

With these steps, you will have set up the necessary environment to run and use solix2mqtt.

Usage

Locally

npm install && npm run build
  S2M_USER=*** \
  S2M_PASSWORD=*** \
  S2M_COUNTRY=DE \
  S2M_MQTT_URI=mqtt://localhost:1883 \
  npm run start

Docker

docker run -d \
  -e S2M_USER=*** \
  -e S2M_PASSWORD=*** \
  -e S2M_COUNTRY=DE \
  -e S2M_MQTT_URI=mqtt://localhost:1883 \
  tomquist/solix2mqtt:latest

Configuration

The app can be configured using the following environment variables:

Auth

The App utilizes an advanced version of the auth mechanism known from Eufy. The Anker App employs a two-step authentication scheme: first, keys are exchanged, and second, the full login payload is encrypted. However, it turns out the original Eufy mechanism still works, so we're using that in this project (credits to eufy-security-client for inspiration). This might break at some point!

For a "READ-ONLY" access to the data, an account with which the "System" has been shared can be used. By this the main account can still be used in the app to control everything and the shared account can be used for the API access.

Note: Anker currently permits only one simultaneous login at a time. When you log in from another device, all previously generated auth tokens become invalidated.

Disclaimer

This project is the result of some work I did to integrate my Solix into my home automation. I no longer own an Anker Solix Solarbank due to disappointment with the product, so this project will not receive any updates. However, I'm happy to accept pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements