thomluther / anker-solix-api

Python library for Anker Solix API
MIT License
85 stars 17 forks source link

Explore usage of new device_attrs endpoints #107

Open thomluther opened 4 months ago

thomluther commented 4 months ago

There are new endpoints with Solarbank 2 / Smartmeter / Smart plugs support that needs to be explored for capability and usability:

print(json.dumps((await myapi.request("post", "power_service/v1/app/device/get_device_attrs",json={"device_sn": deviceSn, "attributes": []})), indent=2))
print(json.dumps((await myapi.request("post", "power_service/v1/app/device/set_device_attrs",json={"device_sn": deviceSn, "attributes": []})), indent=2))

The get_device_attrs endpoint is included now in the export_system tool, but it is not clear which keywords can/should be specified for the mandatory attributes list.

thomluther commented 4 months ago

There are no device attributes returned when the list is empty in the request. Someone will have to try various elements (strings) for potential attributes or device types or whatever? Eventually the SB2 Light setting or Output limit setting is returned in the response? Might also have the temperature? Get creative to find parameters that may return something... NOTE: This must be explored with the Owner account, otherwise this will not work.

Lenoirio commented 4 months ago

I did a test with my SB2 (with the request as in your start-post) and this is the response:

{"code":0,"msg":"success!","data":{"device_sn":"APCGQ80E20300662","attributes":{}},"trace_id":"540b02b85b05ec6cb8aebe33b279e276"}

For now I've no time to dig further (e.g. playing with the request parameters) but atleast we know that for the SB2 there's nothing sent out with an "empty" request.

thomluther commented 4 months ago

OK thanks, yes that is what I have seen also in other system exports. I think the query needs in the list specific attributes to query. My hope was that this endpoint may reveal other device specific settings, like light, temperature unit or others that are possible with the app but not available with any of the existing endpoints

thomluther commented 2 months ago

@Lenoirio have you got some time to explore further with various attributes you may think of? Temperature, unit, energy, state, type, anything that might match to data that you see in the App? It will also have to be tested against smart meter and smart plugs. I hope this can be used to query and set the smart plug switch state or maybe other attributes that are supported. Unfortunately there is no error message indicating which attribute may be required/supported... I also assume the attribute name is case sensitive, but typically parameters start with lower case.

Krosty0712 commented 2 months ago

Can anyone help me figure out what to do for the two print commands in front of it?

To read out my SB2, I used the following: https://github.com/thomluther/anker-solix-api And for every error I received, I searched the internet. I had to install some things.

Is there a guide or someone who can help me with a meeting? Or is it possible not to give @thomluther the account information publicly so that he can set that up?

Krosty0712 commented 1 month ago

New Version of Integration has the Export Service. Really Great move.

petxx_2024-09-25_1407.zip