Closed josy1024 closed 1 year ago
Maybe you forgot to call the quickstart()
function. See the talk2solmatelocally example: https://github.com/eet-energy/solmate-sdk/blob/bbf37a945c1d07050df0c214a2fb78214156d9bd/examples/talk2solmatelocally.py#L18
I also cannot get a connection via LocalSolMateAPIClient
, I'm sure it has to do with a missing auth_token
which gets saved for the online-version in .conf/solmate-sdk/authstore.json
. But I have no idea, how this has to be done for a local connection. Running the sample in the readme in this repo asked for my SolMate password, which is not asked for the local connection...
Doing this seems to work:
client = LocalSolMateAPIClient("SERIALNO")
client.quickstart()
print(client.get_live_values())
But this does NOT:
client = LocalSolMateAPIClient("SERIALNO")
client.uri = "ws://192.168.X.Y:9124/"
client.quickstart()
print(client.get_live_values())
Leads to:
{'id': 1, 'data': {'success': False}}
{'id': 2, 'error': {'type': 'BadRequest', 'message': 'Not authenticated.'}}
{'id': 3, 'error': {'type': 'BadRequest', 'message': 'Not authenticated.'}}
Yes, that is an issue. At the moment if you use the SolMateAPIClient or LocalSolMateAPIClient with different uris, this won't work. We will fix this. At the moment the workaround is to delete the .conf/solmate-sdk/authstore.json
file if you use another uri as before.
@felix-pilgram When will the API updated to fix this? It would also be nice to finally deliver changelogs for SolMate software versions btw. 🥇.
When will the API updated to fix this?
Version 0.1.6 includes a fix for this issue. Do get it working properly, please delete the .conf/solmate-sdk/authstore.json
config file before you use it.
sn = "S1K0506A0000xxxx" solclient = solmate_sdk.LocalSolMateAPIClient(sn) solclient.uri = "ws://sun2plug.local:9124/"
solclient.list_wifis() {'id': 2, 'error': {'type': 'BadRequest', 'message': 'Not authenticated.'}} Traceback (most recent call last): File "", line 1, in
File "/usr/local/lib/python3.9/dist-packages/solmate_sdk/apiclient.py", line 232, in list_wifis
return self.request("list_wifis", {})
wie läuft die authentifizierung mit LocalSolMateAPIClient? (Parallel zur online)
serial number bereits für "online" requests verwendet (/.config/solmate-sdk/authconfig.json ist bereits vorhanden)