Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection of Solarbank 2 system exports #115

Open
thomluther opened this issue Jun 29, 2024 · 47 comments
Open

Collection of Solarbank 2 system exports #115

thomluther opened this issue Jun 29, 2024 · 47 comments
Labels
config_example JSON output files for a configuration help wanted Extra attention is needed

Comments

@thomluther
Copy link
Owner

thomluther commented Jun 29, 2024

Please provide your solarbank 2 system export examples here.
You can extract all data with the system_export tool and zip the output files.
You can add a text file to the zip containing info about some specifics when the export was taken, for example the components of your setup.
Before you provide an export, make sure that the solarbank_info structure in api_sites.json does show:
"is_display_data": true,
and not
"is_display_data": false,

The power values in the site scene_info response are wrong when is_display_data is false. This field seems to be an indicator to the app to skip the display of the response and delay home screen update until next refresh.
The reason and work around for this problem is not understood yet and is to be documented in issue #114

@thomluther thomluther added help wanted Extra attention is needed config_example JSON output files for a configuration labels Jun 29, 2024
@stephan-l
Copy link

I just packaged two exports and a system description
dev2024063019.zip

Something I wonder about. Is it possible that the extension battery is not yet visible? The app shows both but in the api there is only 1600 Wh.

@nicolinuxfr
Copy link

Here's my export, I have the same setup as @stephan-l (meaning, one Solarbank 2 E1600Pro, one battery expansion and one smart meter).

nicolinux.zip

Let me know if you need more.

@stephan-l
Copy link

I made another export especially for reference in the status thread:
dev2024070113.zip

@thomluther
Copy link
Owner Author

Here's my export, I have the same setup as @stephan-l (meaning, one Solarbank 2 E1600Pro, one battery expansion and one smart meter).

nicolinux.zip

Let me know if you need more.

Thanks for the data. The export looks like being done with the shared account, since many responses have no data.

In general, when providing exports to get a full picture of what is possible with the devices, you need to run the export tool with the main account.

@nicolinuxfr
Copy link

Thanks for the data. The export looks like being done with the shared account, since many responses have no data.

Indeed, I thought it was already useful that way, but for science™, I can do another export using my main Anker account.

@thomluther
Copy link
Owner Author

Something I wonder about. Is it possible that the extension battery is not yet visible? The app shows both but in the api there is only 1600 Wh.

It was visible, but not properly considered for the cap and energy calculation of the battery. This is fixed now, also update the solarbank monitor and export tool based on recent data.
Pls use the latest versions before doing another export.

@stephan-l
Copy link

I made a full dump with the owner account.
The system was running at 140W of battery. 0 from grid and solar.
ste20240701222735.zip

@thomluther
Copy link
Owner Author

thomluther commented Jul 2, 2024

@stephan-l thanks for the new dump. That looks much more useful. First observations:

  • OTA update info is not working anymore. It was working for Solarbank 1, not sure what the issue is to query a flag whether a firmware update is available
  • get_upgrade_record for the site is empty. I'm pretty sure everybody does firmware upgrades after setup. But maybe they are not reported by the site report if done prior adding the devices to the site. This is no problem since not used in the Api cache data
  • new Energy statistics: I need to review them and compare to understand which of the values is returned only as total for the queries interval. Those queries have to be repeated to get specific total statistics for previous day. Maybe the mechanism to query daily statistics for today and yesterday must be changed and optimized to reduce the min. required Api requests.
  • Solarbank 2 device load schedule: There is non defined yet. We need exports of various Solarbank 2 schedule definitions. Even if they are not used with AI mode, they can probably be defined and will be included in exports. We need examples of which parameters/fields can be available in the new schedules and how the various weekday configuration structure will be used in the schedule structure. This is most likely pretty much different to Solarbank 1
  • device_attrs does not show any data. More testing and exploration of possible/required json parameters for those endpoints is required. see Explore usage of new device_attrs endpoints #107. We need to understand which devices are supported by this endpoint and what can be changed with the set_device_attrs endpoint (and how)
  • Scene Info is already prepared for a smart_plug device list structure, which is coming probably later this year. So smart plugs may be additional devices to be added to Api caches
  • The Solarbank data time stamp is now always valid even if the data itself seems to be valid. This is strange, since my assumption was that correct cloud update time is presented typically when data is valid. So this timestamp cannot really be used to understand how often data is sent to the cloud by Solarbank 2?
  • In the dumped data there is no indication which mode is used by the Solarbank. Also nothing in regards to the light mode settings or other Solarbank 2 specific settings. Either this is all provided via the new device_attrs endpoints which we don't know yet, or not supported at all via Cloud Api (like Temperature info and Temp Unit Setting is not supported). It would be very helpful if someone can figure out how to make use of this new endpoint with the Solarbank 2 and/or Smartmeter.

@thomluther
Copy link
Owner Author

Here is an actual extract of owner data from export in the monitor after I implemented another workaround for a missing field value in scene_info for the smartmeter wireless_type. I assume now this to be 1 if there is only 1 network in the list for the site and smartmeter reports an online wifi state. In that case it must be using the same network (don't want to make assumptions for anything else, since there could also be smartmeters without solarbank in a site).

Solarbank Monitor (refresh 60 s, details refresh 600 s):
Using input source folder: /workspaces/core/anker-solix-api/exports/SB2onwer_1
Sites: 1,  Devices: 2
--------------------------------------------------------------------------------
Device         : Solarbank 2 E1600 Pro   Alias         : Solarbank 2 E1600 Pro
Serialnumber   : OY7WE1AOZVGS1RLX        Admin         : YES
Site ID        : 38cac050-0128-0eff-c9ba-61dabb1f3df1
Wifi SSID      : wifi-network-1         
Wifi state     : Online                  Signal        :   92 %
SW Version     : v1.0.4.4                Auto-Upgrade  : Disabled
Cloud-Updated  : 1970-01-01 00:00:00     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   44 %                  Min SOC       :   10 %
Battery Energy : 1408 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W
Solar Power    :    0 W                  Output Power  :  140 W
Solar Ch_1     :    0 W                  Solar Ch_2    :    0 W
Solar Ch_3     :    0 W                  Solar Ch_4    :    0 W
Charge Power   : -140 W                  Device Preset :  200 W
Schedule  (Now): 19:28:58 UTC +0200      System Preset :  200 W
ID Start End   Export Output ChargePrio    SB1    SB2  Mode Name
--------------------------------------------------------------------------------
Device         : Smart Meter             Alias         : Smart Meter
Serialnumber   : FYGDVE1ZXEJ6OJAM        Admin         : YES
Site ID        : 38cac050-0128-0eff-c9ba-61dabb1f3df1
Wifi SSID      : wifi-network-1         
Wifi state     : Online                  Signal        :   92 %
SW Version     : v0.0.0.27               Auto-Upgrade  : Unknown
Cloud Status   : online                  Status code   : 1
Grid Status    : ok                      Status code   : 0
Grid Import    :    0 W                  Grid Export   :    0 W
--------------------------------------------------------------------------------

Since both Grid values were 0W, it is difficult to relate them to the new "to_home_load": "140" field which was showing 140 W.
I assume that could actually be the calculated home consumption value, but would need to be proven with other snapshots showing values for more fields. So an export while little Solar power is coming in, there is bypass to the house + discharge from battery + grid is not showing 0 W would be good to correlate all power fields properly.
Please also observe grid_status code, I haven't seen anything else than 0 yet, now describing this as OK state for the grid. I would assume there is another code on power outage, maybe others too ?

@stephan-l
Copy link

Grid status for a power outage will be difficult to obtain. the smart meter is powered by the voltage sensing ports. so it will go offline on power loss. any idea what I shall test next week when I am onsite next time?

I gave it a new try (full dump: ste202407022222303.zip )

Solarbank Monitor (refresh 30 s, details refresh 300 s):
Sites: 1,  Devices: 2
--------------------------------------------------------------------------------
Device         : Solarbank 2 E1600 Pro   Alias         : Solarbank 2 E1600 Pro
Serialnumber   : APCGQ80Exxxx        Admin         : YES
Site ID        : 99e
Wifi SSID      : xxx       
Wifi state     : Online                  Signal        :   90 %
SW Version     : v1.0.4.4                Auto-Upgrade  : Disabled
Cloud-Updated  : 2024-07-02 22:23:03     Valid Data    : YES (Requeries: 3)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   64 %                  Min SOC       :   10 %
Battery Energy : 1024 Wh                 Capacity      : 1600 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W
Solar Power    :    0 W                  Output Power  :    0 W
Solar Ch_1     :    0 W                  Solar Ch_2    :    0 W
Solar Ch_3     :    0 W                  Solar Ch_4    :    0 W
Charge Power   :    0 W                  Device Preset :  200 W
Schedule  (Now): 22:22:50 UTC +0200      System Preset :  200 W
ID Start End   Export Output ChargePrio    SB1    SB2  Mode Name
--------------------------------------------------------------------------------
Device         : Smart Meter             Alias         : Smart Meter
Serialnumber   : AUJS020xxxx        Admin         : YES
Site ID        : 99e3a
Wifi SSID      : xxx       
Wifi state     : Online                  Signal        :   90 %
SW Version     : v0.0.0.27               Auto-Upgrade  : Unknown
Cloud Status   : online                  Status code   : 1
Grid Status    : ok                      Status code   : 0
Grid Import    :  132 W                  Grid Export   :    0 W
--------------------------------------------------------------------------------

My grid meter was at approx 140W. So input is right.

Also the Capacity is broken again. Before todays git pull it was 3200Wh for my setup:

Cloud-Updated  : 2024-07-02 21:57:12     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   65 %                  Min SOC       :   10 %
Battery Energy : 2080 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W

Somehow the battery is charged but now output to the home. I need to understand when it is charged by solar power. Today there wasn't any output only charging.

@stephan-l
Copy link

After another try I got the correct capacity again. Kind of confusing.

Wifi state     : Online                  Signal        :   88 %
SW Version     : v1.0.4.4                Auto-Upgrade  : Disabled
Cloud-Updated  : 2024-07-02 23:04:22     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   64 %                  Min SOC       :   10 %
Battery Energy : 2048 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W

@tagauch1
Copy link

tagauch1 commented Jul 2, 2024

Over the last ~23 hours I have collected some data every 15min via cron, see attachment. Unfortunately most of them are with "is_display_data"="false". I have attached my interpretation of the values in a screenshot of the Anker app.
solix.zip

@thomluther
Copy link
Owner Author

thomluther commented Jul 3, 2024

I made a full dump with the owner account. The system was running at 140W of battery. 0 from grid and solar. ste20240701222735.zip

@stephan-l thanks for the many extracts, they help to get a better picture on various situations after sorting out the invalid data extracts.

One situation puzzles me however to correlate the values properly:

    "solarbank_info": {
      "solarbank_list": [
        {
          "device_pn": "A17C1",
          "device_sn": "VKYPTREWMTYU48Q5",
          "device_name": "Solarbank 2 E1600 Pro",
          "device_img": "https://public-aiot-fra-prod.s3.dualstack.eu-central-1.amazonaws.com/anker-power/public/product/2024/05/24/iot-admin/5iJoq1dk63i47HuR/picl_A17C1_normal%281%29.png",
          "battery_power": "10",
          "bind_site_status": "",
          "charging_power": "0",
          "power_unit": "W",
          "charging_status": "6",
          "status": "1",
          "wireless_type": "1",
          "main_version": "",
          "photovoltaic_power": "0",
          "output_power": "0",
          "create_time": 1718909497,
          "set_load_power": "",
          "sub_package_num": 0,
          "output_cutoff_data": 10,
          "is_display": true
        }
      ],
      "total_charging_power": "0",
      "power_unit": "W",
      "charging_status": "0",
      "total_battery_power": "0.10",
      "updated_time": "2024-07-02 21:14:53",
      "total_photovoltaic_power": "0",
      "total_output_power": "0.00",
      "display_set_power": false,
      "battery_discharge_power": "0",
      "ac_power": "0",
      "to_home_load": "0",
      "is_display_data": true,
      "solar_power_1": "0",
      "solar_power_2": "1",
      "solar_power_3": "1",
      "solar_power_4": "1"
    },
    "retain_load": "200W",
    "scene_mode": 1,
    "home_load_power": "0",
    "updated_time": "01-01-0001 00:00:00",
    "power_site_type": 5,
    "site_id": "5e6f13ae-93f7-83bf-d119-b41c4bdc41ba",
    "powerpanel_list": [],
    "grid_info": {
      "grid_list": [
        {
          "device_pn": "A17X7",
          "device_sn": "HVCNROR98JH6W3SG",
          "device_name": "Smart Meter",
          "device_img": "",
          "create_time": 1719137035,
          "status": "1",
          "bind_site_status": "",
          "wireless_type": ""
        }
      ],
      "photovoltaic_to_grid_power": "0",
      "grid_to_home_power": "423",
      "grid_status": 0,
      "has_history_data": true
    },

Generated Solar power is 3 W from all, but this is not reflected somehow in any of the other fields.
grid_to_home_power is 423 W (ok that is the grid import)
The solarbank charging_status = 6 which probably means full_bypass (as for Solarbank 1)
Soc is 10% in the evening at 21:00. Seems weird, but explains the full bypass with 3 W remaining Solar power.
"charging_power": "0", => Nothing is loaded to empty battery, another indication that it is doing full bypass and BMS is not actively used.
"output_power": "0", => Weird, where are the 3W Solar power gone? Maybe output_power not provided when doing full bypass without active BMS?

How is the display in the App in the morning with little solar power and empty battery when this full bypass mode is used without charge and discharge? Is the solar power reflected somewhere else in the figures going to home?

@thomluther
Copy link
Owner Author

thomluther commented Jul 3, 2024

@stephan-l Following is another weird situation making it difficult to correlate the values accurately. It appears the individual fields are not used consistently (same as with Solarbank 1), which makes it pretty difficult to extract them properly for correct monitoring. I built some work arounds for such fields, where e.g. the SB totals do not match the usage of individual solarbank device fields, or the wrong device charging power field. But I'm reluctant to break anything with those workarounds for anything that does not match with Solarbank 2 reporting.

    "solarbank_info": {
      "solarbank_list": [
        {
          "device_pn": "A17C1",
          "device_sn": "YL5C48EDP7UZ108S",
          "device_name": "Solarbank 2 E1600 Pro",
          "device_img": "https://public-aiot-fra-prod.s3.dualstack.eu-central-1.amazonaws.com/anker-power/public/product/2024/05/24/iot-admin/5iJoq1dk63i47HuR/picl_A17C1_normal%281%29.png",
          "battery_power": "15",
          "bind_site_status": "",
          "charging_power": "800",
          "power_unit": "W",
          "charging_status": "1",
          "status": "1",
          "wireless_type": "1",
          "main_version": "",
          "photovoltaic_power": "597",
          "output_power": "800",
          "create_time": 1718909497,
          "set_load_power": "",
          "sub_package_num": 0,
          "output_cutoff_data": 10,
          "is_display": true
        }
      ],
      "total_charging_power": "0",
      "power_unit": "W",
      "charging_status": "0",
      "total_battery_power": "0.15",
      "updated_time": "2024-07-02 08:30:13",
      "total_photovoltaic_power": "597",
      "total_output_power": "800.00",
      "display_set_power": false,
      "battery_discharge_power": "203",
      "ac_power": "20",
      "to_home_load": "780",
      "is_display_data": true,
      "solar_power_1": "210",
      "solar_power_2": "206",
      "solar_power_3": "87",
      "solar_power_4": "94"
    },
    "retain_load": "200W",
    "scene_mode": 1,
    "home_load_power": "2419",
    "updated_time": "01-01-0001 00:00:00",
    "power_site_type": 5,
    "site_id": "9a7e3ee0-c6d7-67c0-d1bf-3ea08747bcea",
    "powerpanel_list": [],
    "grid_info": {
      "grid_list": [
        {
          "device_pn": "A17X7",
          "device_sn": "PQP04MMR9VCGO3DG",
          "device_name": "Smart Meter",
          "device_img": "",
          "create_time": 1719137035,
          "status": "1",
          "bind_site_status": "",
          "wireless_type": ""
        }
      ],
      "photovoltaic_to_grid_power": "0",
      "grid_to_home_power": "1619",
      "grid_status": 0,
      "has_history_data": true
    },

For example the Api reports for devices in scene_info response:
"battery_power": "15", => SOC
"charging_power": "800", => Api does not provide correct value here, this is typically 0 or output power, therefore I built in a work around for the Api site cache structure. This work around also uses negative values for discharge power, which is taken from the SB total_discharge_power (seems to be the only trustable field, but shows discharge of all solarbanks only). Therefore this vlue must also be adjusted to multiple solarbank setups based on their output_power percentage of the reported total_output_power. Its complicated, but the only way to get reliable charge and discharge values per Solarbank 1 device.
"charging_status": "1", => This is Bypass for Solarbank 1 (neither charge nor discharge), looks to be the similar for SB2, but here bypass can mean also adding discharge power, a mode that is not supported by Solarbank 1. I think that can be distinguished with a pseudo code and dedicated description for bypass_discharge
"output_power": "800", => Valid Max demand as requested from smartmeter upon high house consumption of 2419 W
SB totals:
"total_photovoltaic_power": "597", => OK, sum of all solar channels
"total_output_power": "800.00", => OK, same as device output power
"battery_discharge_power": "203", => Only valid discharge value provided. This will be taken by the library to put -203 W into the invalid 'charging_power' field of a solarbank device.
"ac_power": "20", => Why are there 20 W on the AC socket? Is there anything connected that draws AC socket power?
"to_home_load": "780", => That means from 800 W output, 20 W go to the AC socket (true?) and 780 W into house?
Grid total:
"photovoltaic_to_grid_power": "0", => OK, no grid export at this time
"grid_to_home_power": "1619", => OK, required import for high house consumption. Assuming this is valid as reported from smartmeter, then we have 2419 -1619 = 800 W. And here is the big questionmark: Since we have only 780 W to the house, where are the 20 W? Reported incorrectly to the AC power, which is not used (to be confirmed)? Or if the 20 W AC power correct, then the house consumption value is calculated incorrectly by the appliance and 20 W too high (since it does not consider the AC output in the calculation and using total_output_power instead of to_home_load)?
"grid_status": 0,
Site total:
"home_load_power": "2419", => Questionable value as per previous comments...

@thomluther
Copy link
Owner Author

After another try I got the correct capacity again. Kind of confusing.

Wifi state     : Online                  Signal        :   88 %
SW Version     : v1.0.4.4                Auto-Upgrade  : Disabled
Cloud-Updated  : 2024-07-02 23:04:22     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   64 %                  Min SOC       :   10 %
Battery Energy : 2048 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W

This might be related to the capacity and energy calculation. If the initial response is invalid, the battery packs are 0 too, Maybe the calculations are not refreshed properly afterwards. The code also needs to make sure, that re-calculation is not done when the response contains invalid data, so it must cover both special cases:

  • initially invalid but calculated fields must be generated (potentially with a value), otherwise HA integration would not generate entities.
  • updates must ignore re-calculation with invalid data

@stephan-l
Copy link

I think I will do some measurements onsite next week to verify the theses. I can monitore questionable values and test different scenarios then.

@thomluther
Copy link
Owner Author

Can someone explain this situation?
I don't remember who provided the T2 system export... There is home demand and import from grid, but SB2 is not delivering in the evening even if SOC is 64%
Can home delivery be disabled somehow or why is there no discharge?

--------------------------------------------------------------------------------
Device         : Solarbank 2 E1600 Pro   Alias         : Solarbank 2 E1600 Pro
Serialnumber   : IDT679D215D635EA        Admin         : YES
System         : T2  (Site ID: c316e3a9-befc-47c9-a8bf-c211dd37d31b)
Wifi SSID      : wifi-network-1         
Wifi state     : Online                  Signal        :   90 %
SW Version     : v1.0.4.4                Auto-Upgrade  : Disabled
Cloud-Updated  : 2024-07-02 22:23:03     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   64 %                  Min SOC       :   10 %
Battery Energy : 2048 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W
Solar Power    :    0 W                  Output Power  :    0 W
Solar Ch_1     :    0 W                  Solar Ch_2    :    0 W
Solar Ch_3     :    0 W                  Solar Ch_4    :    0 W
Charge Power   :    0 W                  Device Preset :  200 W
Home Demand    :  132 W                  SB Home Load  :    0 W  (-)
Schedule  (Now): 07:19:51 UTC +0200      System Preset :  200 W
ID Start End   Export Output ChargePrio    SB1    SB2  Mode Name
--------------------------------------------------------------------------------
Device         : Smart Meter             Alias         : Smart Meter
Serialnumber   : 9Q4CSMNJLAPJORP7        Admin         : YES
System         : T2  (Site ID: c316e3a9-befc-47c9-a8bf-c211dd37d31b)
Wifi SSID      : wifi-network-1         
Wifi state     : Online                  Signal        :   90 %
SW Version     : v0.0.0.27               Auto-Upgrade  : Unknown
Cloud Status   : online                  Status code   : 1
Grid Status    : ok                      Status code   : 0
Grid Import    :  132 W                  Grid Export   :    0 W
--------------------------------------------------------------------------------

@thomluther
Copy link
Owner Author

thomluther commented Jul 4, 2024

Here is another interesting example, showing kind of charge_priority in the morning even if in detection mode, since SOC is just at 7%. I don't think this should get a different pseudo state since it is charging code 0, and all kind of charging states typically have 3.
But clearly it shows that demand is higher than solar and even then not all is bypassed to home to 'enforce' charging of low battery.

--------------------------------------------------------------------------------
Device         : NoName                  Alias         : Solarbank 2 E1600 Pro
Serialnumber   : AXKI2U6VS8IQ7NZS        Admin         : NO
System         : Maison  (Site ID: adb7f7c0-c8c0-dcdc-ebc6-6e0a7a7b3ec1)
Wifi SSID      :                        
Wifi state     : Unknown                 Signal        :  --- %
SW Version     : Unknown                 Auto-Upgrade  : Unknown
Cloud-Updated  : 1970-01-01 00:00:00     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:    7 %                  Min SOC       :    5 %
Battery Energy :  224 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W
Solar Power    :  573 W                  Output Power  :  467 W
Solar Ch_1     :  144 W                  Solar Ch_2    :  141 W
Solar Ch_3     :  147 W                  Solar Ch_4    :  141 W
Charge Power   :  106 W                  Device Preset :    0 W
Home Demand    :  624 W                  SB Home Load  :  467 W  (-)
--------------------------------------------------------------------------------
Device         : NoName                  Alias         : Smart Meter
Serialnumber   : 3SJSUU0Z3W0VXQKZ        Admin         : NO
System         : Maison  (Site ID: adb7f7c0-c8c0-dcdc-ebc6-6e0a7a7b3ec1)
Wifi SSID      :                        
Wifi state     : Unknown                 Signal        :  --- %
SW Version     : Unknown                 Auto-Upgrade  : Unknown
Cloud Status   : online                  Status code   : 1
Grid Status    : ok                      Status code   : 0
Grid Import    :  157 W                  Grid Export   :    0 W
--------------------------------------------------------------------------------

Still thinking about it. Maybe it might be useful to have historical visibility when and how long home demand was partially ignored due to enforced charging. But this pseudo state for code 0 (detection_charge ? or enforced_charge ?) will be used only for code 0 under specific conditions: Charge > 0 and output < demand, because typically when output < demand, there should never be charge unless enforced by BMS

@stephan-l
Copy link

Can someone explain this situation? I don't remember who provided the T2 system export... There is home demand and import from grid, but SB2 is not delivering in the evening even if SOC is 64% Can home delivery be disabled somehow or why is there no discharge?

--------------------------------------------------------------------------------
Device         : Solarbank 2 E1600 Pro   Alias         : Solarbank 2 E1600 Pro
Serialnumber   : IDT679D215D635EA        Admin         : YES
System         : T2  (Site ID: c316e3a9-befc-47c9-a8bf-c211dd37d31b)
Wifi SSID      : wifi-network-1         
Wifi state     : Online                  Signal        :   90 %
SW Version     : v1.0.4.4                Auto-Upgrade  : Disabled
Cloud-Updated  : 2024-07-02 22:23:03     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   64 %                  Min SOC       :   10 %
Battery Energy : 2048 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W
Solar Power    :    0 W                  Output Power  :    0 W
Solar Ch_1     :    0 W                  Solar Ch_2    :    0 W
Solar Ch_3     :    0 W                  Solar Ch_4    :    0 W
Charge Power   :    0 W                  Device Preset :  200 W
Home Demand    :  132 W                  SB Home Load  :    0 W  (-)
Schedule  (Now): 07:19:51 UTC +0200      System Preset :  200 W
ID Start End   Export Output ChargePrio    SB1    SB2  Mode Name
--------------------------------------------------------------------------------
Device         : Smart Meter             Alias         : Smart Meter
Serialnumber   : 9Q4CSMNJLAPJORP7        Admin         : YES
System         : T2  (Site ID: c316e3a9-befc-47c9-a8bf-c211dd37d31b)
Wifi SSID      : wifi-network-1         
Wifi state     : Online                  Signal        :   90 %
SW Version     : v0.0.0.27               Auto-Upgrade  : Unknown
Cloud Status   : online                  Status code   : 1
Grid Status    : ok                      Status code   : 0
Grid Import    :  132 W                  Grid Export   :    0 W
--------------------------------------------------------------------------------

T2 is my system. That was a situation I couldn’t explain either. It got deflated to 10% the night before and there was low solar power during day. So it charged until next day when solar power was bigger than house demand.

@thomluther
Copy link
Owner Author

OK, so just a firmware flaw, nothing to be considered for the field interpretation.

@thomluther
Copy link
Owner Author

thomluther commented Jul 4, 2024

I updated the api with new charging states and the monitor accordingly. #104
I also added the new house demand and SB_home_load fields to the monitor. This is what is new on the SB2 systems in the home screen of the app.
The house demand ("Zuhause") is a new system field (home_load_power) and the SB home load is a solarbank devices total field (to_home_load). The house demand does not reflect the house consumption all the time. When the solarbank is on standby, it is 0. So it must not be confused with a value that can be used for permanent house consumption.
The former SB output total refers to all power that is going out from the solarbanks. The new SB to home load is the same, but subtracted by the AC socket power. So for SB2, only the new field is reflecting what is going into the house.
The smartmeter values seem to provide also data when SB2 is in standby.

However, someone needs to confirm with the monitor whether the smartmeter values are valid when the SB data is invalid. Right now I consider them invalid too, but they are 0W most of the time also with valid SB data, so it is difficult to recognise that in a snapshot.
It must be monitored when the solarbank is empty to ensure the grid should show values. When it does while SB data is flagged invalid, then the invalid data refer only to the Solarbank section in the scene info.

@thomluther
Copy link
Owner Author

thomluther commented Jul 5, 2024

Some notes to make here to the new SB2 related power fields:

  • The new SB to_home_load field is not used by Solarbank 1 (always 0). In fact I think it reflects the AC power from the inverter that goes into the house, so it is SB output power (used by SB1 and SB2) - AC power field which is likely the AC socket.
  • That means without Socket (SB2 Plus and later SB2) should always reflect same values for old SB output power and new to_home_load fields.
  • The system power field home_load_power is the AC power house demand for the solarbank. This is the consumption of the house, while the Solarbank is ON. When OFF the demand seems to reflect 0 W. I assume that is the value used as target for the Solarbank regulation
  • All power values sum up to same totals typically including the solar power channels. That means they cannot be real, since AC and DC power is mixed an no inverter efficiency loss is factored into the values. I assume the DC power values which cannot be really proven (solar, Battery etc) are adoped / decreased? to match the AC power values used for smartmeter/grid and house.
  • The AC power values could be easily compared with other metering tools, but I understood they seem to be pretty accurate. Therefore I believe all DC power values would need to be 5-10% higher in reality to consider inverter loss etc. So tracking the DC values for energy measurements might me too conservative, but therefore providing optimized calculations in terms of efficiency for the solarbank 2 when comparing them with the AC energy output to the house...

@stephan-l
Copy link

I made an export with active AC-socket output and the new firmware:
ste20240711212700.zip

@nicolinuxfr
Copy link

Sorry, my knowledge is too limited to really help. I can do more exports, but I'm not sure it's useful ? Here's one I just did using my admin account this time :

nicolinux.zip

@stephan-l
Copy link

I'll try to help as much as possible but my system is installed in a remote location so I need to drive there for physical tests.

@thomluther
Copy link
Owner Author

Sorry, my knowledge is too limited to really help. I can do more exports, but I'm not sure it's useful ? Here's one I just did using my admin account this time :

nicolinux.zip

Would already help to define various schedules and export then to see various interval setting and weekday settings.

@thomluther
Copy link
Owner Author

@nicolinuxfr I have seen you have already a basic schedule defined.
Can you let me know which options can be defined in SB2 schedule intervals?
Please also create some additional intervals and different schedules for a subset of weekdays, we need to see how the schedule structure will change then and whether there come new fields with the SB2 intervals....

@thomluther
Copy link
Owner Author

PS: The new api version has been refactored to have smaller files in the library. I separated also all type definitions of the Api, therefore I also renamed _API_ENDPOINTS to API_ENDPOINTS to avoid code checker warnings for accessing internal variables.
In case you used them in you test modules, you have to rename them.
I also added the energy exports for each PV channel in the Api and the solarbank monitor.
However, I have not seen their structure yet, so could be that the display in the monitor is not working yet, in case the structure is different than for other energy stats.
A new system_export with the additional solar production energy files per PV channel will be usefull to verify their structure.

@nicolinuxfr
Copy link

Yes, only one to stop the system to send electricity during the night, when I have off-peak prices.

Can you let me know which options can be defined in SB2 schedule intervals?

Here are some screenshots from the app, I can't export more systems right now. If I understand what you need, I should create more complex schedules and then ask for an export for each variation ?

IMG_2697
IMG_2698
IMG_2699
IMG_2700
IMG_2701

@thomluther
Copy link
Owner Author

OK, so not much parameters in the App, but the same as for SB1 are still in the schedule structure.
What is new however are the weekdays. Pls create intervals for subset of weekdays and export the system again with the main account using the latest api version and export tool.
This will also give an example of the PV1-4 energy stats queries that I added.

@nicolinuxfr
Copy link

Here is an export after setting this schedule inside the app :
schedule.zip

IMG_2714
IMG_2715

Let me know if you need a different setup next.

@thomluther
Copy link
Owner Author

@nicolinuxfr
Thanks, just figured out that the current request parameter cannot be used to get SB2 schedule formats.
See #109
I need to adopt the system export tool to use also dev_parm=6 in the collection, that should provide the correct format of the schedule. Seems the set and get device_load endpoints are not suitable for SB2 at all....

@thomluther
Copy link
Owner Author

@nicolinuxfr
I updated the system export to get now device parm for type 4 & 6, so should now extract the new schedule structure.
I assume the user mode setting could be part of the schedule structure although it appears as separate setting in the App.
So please extract with user mode active as well as with AI mode active to see whether the schedule structure is different between the 2 exports.
Thanks

@nicolinuxfr
Copy link

@thomluther here you go ! (automatic for AI mode, Manuel for a schedule)

automatic.zip
manuel.zip

@thomluther
Copy link
Owner Author

@nicolinuxfr Please see my update in the schedule structure issue.
If you can validate the changes in the monitor and comment/confirm the questions that would be great.

@thomluther
Copy link
Owner Author

thomluther commented Jul 15, 2024

@stephan-l @tagauch1
If you have a smartmeter installed, please see update in the schedule structure issue.
Would be helpfull if you can confirm that Api schedule extraction now works and is displayed correctly in the monitor.
You need to run the monitor with the main account to see the schedule. Please also run it with energy stats and validate that the extracted numbers for today and yesterday reflect all daily stats that you can find in the App with same values. I added also the stats for each PV channel. Don't know if there are more stats in the app that I did not find yet.
PS: For the energy stats, you can run the monitor with the shared account and compare with the App values using the main account there.

When using the monitor with main account, please also what all other relevant values are there. If you miss anything compared to the app, please let me know (The temperature or the new light settings are still just a device details, that was not found yet with any of the cloud endpoints, maybe it is available with the new device_attrs endpoint that still need to be explored #107 )

Once we have the basic structure validated and confirmed, I would need some latest exports again that can be used as examples for HA Integration development and testing.

Edit:
One more thing to confirm. The Api responses only show a single SOC for the SB2. Is that value an average across all battery packs and the main module? I assume this is what the SOC on the home page is reflecting. When you go into the details, I believe you see a granular SOC breakdown per battery and maybe even more information on the batteries. However, I haven't found an endpoint that may return such 'device' details like pack SOC and SN or Model Type etc. Eventually this is also why the device_attrs endpoint was added? The only information about battery packs available for now is the qty of installed packs.
I use that in the Api to calculate the overall SB2 battery capacity and energy. Those 2 values should no longer switch to 0 when invalid responses are received since I ignore those responses for updated calculations.

Edit2: I also disabled the work around for requeries again since that does not help and only delays query cycles unnecessarily.So the monitor will only show requeries 0 also for invalid data.

@stephan-l
Copy link

I tried it and it looks legit:

Running site refresh...
Running device details refresh...
Running energy details refresh...
Solarbank Monitor (refresh 30 s, details refresh 300 s):
Sites: 1,  Devices: 2
--------------------------------------------------------------------------------
Device         : Solarbank 2 E1600 Pro   Alias         : Solarbank 2 E1600 Pro
Serialnumber   : AP        Admin         : YES
System         : T2  (Site ID: 99e3)
Wifi SSID      : xxxx
Wifi state     : Online                  Signal        :   90 %
SW Version     : v1.0.5.4                Auto-Upgrade  : Disabled
Cloud-Updated  : 1970-01-01 00:00:00     Valid Data    : YES (Requeries: 0)
Cloud Status   : online                  Status code   : 1
Charge Status  : detection               Status code   : 0
State Of Charge:   73 %                  Min SOC       :   10 %
Battery Energy : 2336 Wh                 Capacity      : 3200 Wh
Exp. Batteries :    1 Pcs                AC socket     :    0 W
Solar Power    :    0 W                  Output Power  :  138 W
Solar Ch_1     :    0 W                  Solar Ch_2    :    0 W
Solar Ch_3     :    0 W                  Solar Ch_4    :    0 W
Charge Power   : -138 W                  Device Preset :  200 W
Home Demand    :  138 W                  SB Home Load  :  138 W
Schedule  (Now): 21:50:38 UTC +0200      System Preset :  200 W
Usage Mode     : Automatic (1)           Sched. Preset :  200 W
ID Start End   Output Weekdays
--------------------------------------------------------------------------------
Device         : Smart Meter             Alias         : Smart Meter
Serialnumber   : AUJ        Admin         : YES
System         : T2  (Site ID: 99e3)
Wifi SSID      : xxx
Wifi state     : Online                  Signal        :   90 %
SW Version     : v0.0.0.29               Auto-Upgrade  : Unknown
Cloud Status   : online                  Status code   : 1
Grid Status    : ok                      Status code   : 0
Grid Import    :    0 W                  Grid Export   :    0 W
--------------------------------------------------------------------------------
Energy details for System T2 (Site ID: 99e3):
Today          : 2024-07-15              Yesterday     : 2024-07-14
Solar Energy   :  4.94 kWh               Solar Energy  :  4.58 kWh
Solar Ch 1/2   :  2.47 / 2.47 kWh        Solar Ch 1/2  :  2.29 / 2.29 kWh
Solar Ch 3/4   :  0.00 / 0.00 kWh        Solar Ch 3/4  :  0.00 / 0.00 kWh
SB Charged     :  3.07 kWh               SB Charged    :  2.40 kWh
SB Discharged  :  1.43 kWh               SB Discharged :  1.24 kWh
House Feed     :  1.41 kWh               House Feed    :  1.23 kWh
House Usage    :  3.39 kWh               House Usage   : 16.17 kWh
Grid Import    :  0.12 kWh               Grid Import   : 12.77 kWh
Grid Export    :  0.02 kWh               Grid Export   :  0.01 kWh
AC Socket      :  0.00 kWh               AC Socket     :  0.00 kWh
Smartplugs     :  0.00 kWh               Smartplugs    :  0.00 kWh
Sol/Bat/Gri %  :  38/ 62/  0 %           Sol/Bat/Gri % :  48/ 52/  0 %
--------------------------------------------------------------------------------

Statistics look fine and the state of charge is the average of my internal and external battery.
Latest export:
ste20240715215000.zip

@thomluther
Copy link
Owner Author

Hello
Can someone provide me an actual export as owner account when NO schedule is defined (everything cleared in your schedule settings). Please upload this to #108 to discuss follow on activities there.

I need to see what the minimal schedule structure looks like and if that is something to be usable as template for composing a minimal response to change any schedule related settings (usage mode or actual output preset).

Once I know the minimal structure, I will provide examples of possible structures to apply a change, and someone need to verify them what works and what won't work.
The helper method required for the SB2 schedule need to be able to modify a single setting also when no schedule is defined yet.
For the usage mode this will be simple, since it is not tight to the schedule itself. But for the output preset, a rate plan and a range interval will have to be created from scratch if none exists for actual time. Will have to think how to deal with different days in that case since some could already be defined and just a range for an actual time gap needs to be created to apply the actual output preset.

@stephan-l
Copy link

New dump with pending OTA-update:
ste20240729160515.zip

@thomluther
Copy link
Owner Author

@stephan-l did you use the latest release of the export tool?
Your output does not contain the OTA file without SN...

@stephan-l
Copy link

@stephan-l did you use the latest release of the export tool? Your output does not contain the OTA file without SN...

Yes it is the current main branch.
Just tried again:
Saved JSON to file /Users/sl/PycharmProjects/anker-solix-api/./exports/ste20240729190900/device_fittings_X9K0XWK8P04DRHR9.json Exporting load... (10004) Anker Api Error: Failed to request. Response Text: {"code":10004,"msg":"Failed to request.","trace_id":"4f311ef1dd9dff7f8e9241f6ba284f5f"} Exporting OTA update info for device... Saved JSON to file /Users/sl/PycharmProjects/anker-solix-api/./exports/ste20240729190900/ota_update_X9K0XWK8P04DRHR9.json Exporting device attributes...
I just tried to find the change in the code but didn't found it. Which commit do you refer to?

@Krosty0712
Copy link

krostysun.zip
in the app a OTA Update is available

in the ota files the request is failed.
anything i can, test ?
My linux skills are not the best, but i will try my what i can.

@thomluther
Copy link
Owner Author

@Krosty0712 the OTA requests do not work for the SB2 and smartmeter, don't know why. For SB1 they are also not reliably showing an available OTA update.
I have no clue how to query that and what would be valid versions, don't think this is provided via the cloud api.

What you can test with your setup are new information that can be queried via Api. See #107

@amor20git
Copy link

Please provide your solarbank 2 system export examples here. You can extract all data with the system_export tool and zip the output files.

Where can I find the "system_export" tool? I do have an Anker Solix2 E1600 System and could provide information requested
Thx

@Krosty0712
Copy link

The new Version of the HomeAssistant Addon has a Service integrated.

See here for Usage.

https://github.com/thomluther/ha-anker-solix/releases/tag/2.1.2

i used it and it worked for me.
I think the Information in Release notes are easy.

@thomluther
Copy link
Owner Author

@amor20git
Standard SB2 exports are not longer required if you do not have unsupported devices or settings in your system,
Please refer to following required exports:

Beside the exports for smart plugs, the community has to provide more Api Endpoint testing with the smart plugs to see whether they can also be controlled via Api (Switch on / off, change their schedule, basically anything what is possible via App needs to be evaluated via Api endpoints as well).
It is also questionable and unknown, what the #107 device_attrs endpoints can be used for?
They have been implemented with SB2 support. I haven't found any attribute name yet that provides any data with SB1, but maybe that is working only with SB2, Smart Meter or Smart plugs which I cannot test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config_example JSON output files for a configuration help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants