Using Anker Solix Solarbank E1600 in HA

One more comment to the existing API Repositories. They are all Javascript based and to my knowledge, the only way to intergrate them easily to HA would be via an addon that runs the docker image and instlls all js libs via npm that are required by the API. You will have to maintain and update Javascript API, and ideally enhance it to send additional MQTT using HA autodiscovery structures for each sensor you want to extract. I think that’s extra overhead and a python API that can be implemented as HACS custom integration is much more straight forward

Actually, that’s exactly what I did:-) It’s not ment to be public but If you can make any use it, fell free to have a look at my code: homeassistant-addons/solix2mqtt at main · markusmauch/homeassistant-addons · GitHub
It just runs the solix2mqtt stuff in a container so that you can grab the values in HA.

Would you mind to share your findings here since I would also like to retrieve more information?

Hi Markus,
I just tried your ha integration via hacs. the entities are announced and visible in HA but they are all on status unknown.

here are some logs, is there sth wrong?

Announcing entity: ‘Solarbank E1600 Charging Power’ with payload
{“name”:“Solarbank E1600 Charging Power”,“state_topic”:“solix/site/Balkonsolar/scenInfo”,“value_template”:“{{ value_json.solarbank_info.total_charging_power | float }}”,“device_class”:“power”,“unit_of_measurement”:“W”,“unique_id”:“solarbank_e1600_charging_power”}
Done.

Announcing entity: ‘Solarbank E1600 Last Update’ with payload
{“name”:“Solarbank E1600 Last Update”,“state_topic”:“solix/site/Balkonsolar/scenInfo”,“value_template”:“{{ value_json.solarbank_info.updated_time }}”,“unique_id”:“solarbank_e1600_last_update”}
Done.

Announcing entity: ‘Solarbank E1600 Charging Status’ with payload
{“name”:“Solarbank E1600 Charging Status”,“state_topic”:“solix/site/Balkonsolar/scenInfo”,“value_template”:“{{ value_json.solarbank_info.charging_status }}”,“unique_id”:“solarbank_e1600_charging_status”}
Done.

[2024-01-22T12:08:23.456Z] {“username”:““,“password”:”“,“country”:“AT”,“loginStore”:“auth.data”,“pollInterval”:30,“mqttUrl”:“mqtt://192.168.3.2:1883”,“mqttClientId”:“solix2mqtt”,“mqttUsername”:“mqtt”,“mqttPassword”:”“,“mqttRetain”:false,“mqttTopic”:“solix”,“verbose”:true}
[2024-01-22T12:08:23.460Z] Fetching data
(node:60) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
[2024-01-22T12:08:23.474Z] {“ab”:“AT”,“client_secret_info”:{“public_key”:“04c05e1f9edf7594da00f0129dc610a16299045af862ffeb1cf0646504a431e62c1d4f0cfa28fb453723df2c4f4051267948267a95ac8300d16ade425eee4df104”},“enc”:0,“email”:”
*****”,“password”:“TUaAucn7Ic9jhjB6JVH3kw==”,“time_zone”:3600000,“transaction”:“1705925303474”}
[2024-01-22T12:08:23.804Z] 490e29601ebff8aa4954a92a60ec6a4c26c1b0d0
[2024-01-22T12:08:23.806Z] {}
[2024-01-22T12:08:24.015Z] {“site_id”:“02e823e8-fa80-4eb7-92dd-aa63f8fe7abc”}
[2024-01-22T12:08:24.350Z] Published.
[2024-01-22T12:08:24.351Z] Sleeping for 29109ms…
[2024-01-22T12:08:53.473Z] Fetching data
[2024-01-22T12:08:53.482Z] Using cached auth data
[2024-01-22T12:08:53.483Z] 490e29601ebff8aa4954a92a60ec6a4c26c1b0d0
[2024-01-22T12:08:53.483Z] {}
[2024-01-22T12:08:53.636Z] {“site_id”:“02e823e8-fa80-4eb7-92dd-aa63f8fe7abc”}

username+pw was ***** out.

Nice work with the Add-on.
For my python API I plan to put it on github once it is in a more stable state. I still change to much right now while working on a small python program that utilizes some of the endpoints to extract the configuration in an anonymized way into files.
This will allow to gather an example for most of the data that can be provided during poll interval, not only from the solarbank, but also from other devices.
The sceninfo has already most of the required data and its a single query.
Running the API again a ‘shared’ account has the advantage that you can continue to use the APP with the system owner account.
A shared account does not get output with the homepage query however. So the API must first query the available sites, then use the scen_info query per site to get available data. (The homepage query basically returns the site data and scen info in a single query, but cannot be used by shared accounts).

Furthermore, additional endpoints for OTA upgrade settings, Power Cutoff settings & bind devices may also provide info only for the owning account, but not for the shared account.

There are 2 endpoints that sound interesting for the solarbank, but I have no glue what parameters they require:
app/device/get_device_home_load
app/device/set_device_home_load
There is one more that could be interesting for SolarPanels/Inverter, but I have none to test and required parameters are not clear
app/compatible/get_compatible_solar_info

Hi, how to integrate the add-on in HA?
When I use hacs with https://github.com/markusmauch/homeassistant-addons/tree/main/solix2mqtt
Hacs says : [
The repository does not seem to be a integration, but an add-on repository. HACS does not manage add-ons.

When I try with add-on, system says: Cmd(‘git’) failed due to: exit code(128) cmdline: git clone -v --recursive --depth=1 --shallow-submodules – https://github.com/markusmauch/homeassistant-addons/tree/main/solix2mqtt /data/addons/git/7a5c634d stderr: 'Cloning into ‘/data/addons/git/7a5c634d’… fatal: repository ‘https://github.com/markusmauch/homeassistant-addons/tree/main/solix2mqtt/’ not found

CAN you help a French user please ?

FYI, I published a first version of an python API as general purpose usage to query data from Anker cloud. The link can be found in the integration feature request thread.

If you got the chance, would be nice if you can test it. Should run on any platform that has python installed. You may just need to install 2 more python libs as mentioned in the repo.
With python and the test_api.py exec module it provides a easy way to test queries with various endpoints documented in the api.py module.
The solarbank_monitor.py gives you a quick overview of your solarbank data and continues to refresh the output.
I’m still missing a query that provides the temperature of the solarbank as shown in the app. That data would still have to be added to the api.devices dict once known.

I encounter the same problem when I try to add the add-on in HA. An idea of ​​the problem ?

hi tholu, i executed the export.py. how can I provide it to you? the solarbank.py works like a charm, and I would love to see it in HA soon.

regards florian

Hi, just add the URL GitHub - markusmauch/homeassistant-addons: Add-On Repository for Home Assistant without the rest of the URL. this worked for me.
regards florian

Thanks it works but all entities are unknown

I shouldn’t have done it correctly… but now it works perfectly. THANKS.

Hi, now that I have the add-on working in my HA and reporting my Solix battery information with MQTT, is it possible to modify the family charging power by publishing on MQTT. If so, how?

There is no easy way to modify home load directly. Neither the App nor the API allows that. It can only be changed with a schedule and that is not so easy to implement.
And Do not expect to realize some sort of continous changes to the home load to avoid grid chargeback. The Solar is far to slow for this. It needs up to 3 minutes to complete a home load change

Hi Florian, can you add it to the github repo when opening an issue?

1 Like

hi tholu,
I guess you have sold your Solarbank, because in the meanwhile with the latest fw updates it really changes quickly when you change the amount to inject into the grid. currently I do this with the smartphone (because there is no HA plugin :smiley: ) and the changes are applied in max. 5 seconds.
regards florian

may I ask you how you did it? I just get “unknown” values?

Good evening, could someone explain to me why my entities are unknown? My broker retrieves the Solix topic with 2 lines but the mqtt integration does not show the battery. I just have entities but none of them give a value. Thanks

  • I installed the add-on.
  • Entered my username, password and country in the configuration.
  • Started the add-on.
  • With MQTTexplorer I searched for the data that interests me.
  • Created mqtt sensors in my yaml.

Here are my mqtt sensors for my two Powerbank:

# Anker Solix1
  - name: "Puissance de sortie"
    state_topic: "solix/site/Solix1/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_output_power }}"
    unit_of_measurement: "W"
    unique_id: "puissance_sortie_solix_1"
    icon: "mdi:lightning-bolt"
    device_class: "power"
    state_class: "measurement"
  - name: "Puissance d'entrée"
    state_topic: "solix/site/Solix1/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_photovoltaic_power | float }}"
    unit_of_measurement: "W"
    unique_id: "puissance_entree_solix_1"
    icon: "mdi:lightning-bolt"
    device_class: "power"
    state_class: "measurement"
  - name: "Puissance de charge"
    state_topic: "solix/site/Solix1/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_charging_power | float }}"
    unit_of_measurement: "W"
    unique_id: "puissance_charge_solix_1"
    icon: "mdi:lightning-bolt"
    device_class: "power"
    state_class: "measurement"
  - name: "Capacité batterie"
    state_topic: "solix/site/Solix1/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_battery_power | float * 100 }}"
    unit_of_measurement: "%"
    unique_id: "capacite_solix_1"
    icon: "mdi:car-battery"
    device_class: "power_factor"
    state_class: "measurement"
  - name: "Statut charge"
    state_topic: "solix/site/Solix1/scenInfo"
    value_template: "{{ value_json.solarbank_info.solarbank_list.0.charging_status }}"
    unique_id: "statut_charge_solix_1"
  - name: "Energie"
    state_topic: "solix/site/Solix1/scenInfo"
    value_template: "{{ value_json.statistics[0].total | float }}"
    unit_of_measurement: "kWh"
    unique_id: "energie_solix_1"
    device_class: "energy"
    state_class: "total_increasing"
    icon: "mdi:transmission-tower-import"
  - name: "Paramètre puissance sortie"
    state_topic: "solix/site/Solix1/scenInfo"
    value_template: "{{ value_json.retain_load }}"
    unique_id: "parametre_puissance_sortie_solix_1"

# Anker Solix2
  - name: "Puissance de sortie 2"
    state_topic: "solix/site/Solix2/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_output_power }}"
    unit_of_measurement: "W"
    unique_id: "puissance_sortie_solix82"
    icon: "mdi:lightning-bolt"
    device_class: "power"
    state_class: "measurement"
  - name: "Puissance d'entrée 2"
    state_topic: "solix/site/Solix2/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_photovoltaic_power | float }}"
    unit_of_measurement: "W"
    unique_id: "puissance_entree_solix_2"
    icon: "mdi:lightning-bolt"
    device_class: "power"
    state_class: "measurement"
  - name: "Puissance de charge 2"
    state_topic: "solix/site/Solix2/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_charging_power | float }}"
    unit_of_measurement: "W"
    unique_id: "puissance_charge_solix_2"
    icon: "mdi:lightning-bolt"
    device_class: "power"
    state_class: "measurement"
  - name: "Capacité batterie 2"
    state_topic: "solix/site/Solix2/scenInfo"
    value_template: "{{ value_json.solarbank_info.total_battery_power | float * 100 }}"
    unit_of_measurement: "%"
    unique_id: "capacite_solix_2"
    icon: "mdi:car-battery"
    device_class: "power_factor"
    state_class: "measurement"
  - name: "Statut charge 2"
    state_topic: "solix/site/Solix2/scenInfo"
    value_template: "{{ value_json.solarbank_info.solarbank_list.0.charging_status }}"
    unique_id: "statut_charge_solix_2"
  - name: "Energie 2"
    state_topic: "solix/site/Solix2/scenInfo"
    value_template: "{{ value_json.statistics[0].total | float }}"
    unit_of_measurement: "kWh"
    unique_id: "energie_solix_2"
    device_class: "energy"
    state_class: "total_increasing"
    icon: "mdi:transmission-tower-import"
  - name: "Paramètre puissance sortie 2"
    state_topic: "solix/site/Solix2/scenInfo"
    value_template: "{{ value_json.retain_load }}"
    unique_id: "parametre_puissance_sortie_solix_2"

image

image

1 Like

Many thanksˋ

Hi, thanks for that post.
I also installed the Add on and followed your sensor code in configuration.yaml.
I get data in MQTT Explorer but the sensors do not update. The Add on is running - I can see no errors. MQTT is updated every 30 sec, but the sensors in HA do not update. Any idea?!