Closed pellenbeck closed 4 months ago
Hi,
thanks for your feedback.
By unsing the Husqvarna Developer Portal and creating an own application you have the following parameters:
I guess "GARDENA_USER" and "GARDENA_PASSWORD" are the Portal credentials. For oauth the application credentials are needed - or am I wrong?
"GARDENA_USER" and "GARDENA_PASSWORD" are the Portal credentials : yes And then you need the "Application key" in GARDENA_APIKEY : Don't need the Application secret
Okay, fine. I used exactly those values in the composer file. So the problem is not related to my values.
do you still have the issue? Could you then give it a try with the docker line instead of the compose for testing purpose?
Yes, the logging is the same.
Do you have both API connected to your app?
Yes. Both APIs are active in my account.
I played around with Gardena credentials and updated password for API etc. but the problem is still the same. @Domochip should I open an issue on https://github.com/py-smart-gardena/py-smart-gardena ?
I think so because the authentication is done in this library yes
@Domochip I have now been able to do some debugging. The current version of the Husqvarna/Gardena API only works with authorization via "application key" and "application secret". This is also already considered in the current version of smart_system.py.
I have entered "client_id" and "client_secret" in line 208 of gardena2mqtt.py with the correct values and when starting the newly created image, the authorization runs through - no errors in the log file.
Unfortunately, the next error is now found in the log files in line 221:
05:31:33: ===== gardena2mqtt v1.0.2 =====
05:31:33: ===== Prepare MQTT Client =====
05:31:33: ===== Prepare SmartSystem Client =====
05:31:33: - create
05:31:33: - authenticate
/app/gardena2mqtt.py:212: RuntimeWarning: coroutine 'SmartSystem.authenticate' was never awaited
smart_system.authenticate()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
05:31:33: - update location list
/app/gardena2mqtt.py:214: RuntimeWarning: coroutine 'SmartSystem.update_locations' was never awaited
smart_system.update_locations()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "/app/gardena2mqtt.py", line 221, in <module>
for device in location.devices.values():
^^^^^^^^
NameError: name 'location' is not defined
I will stop my attempts now. I don not know Python well enough to continue debugging here. I hope you find time to look at the necessary changes ... Good luck!
Hey, sorry for the late reply 😄
I've adjusted the code for the new authentication and asynchronous methodology. remark : I removed the location in the topic structure too
The new version is now available as "domochip/gardena2mqtt:latest-dev" It would be great if you can test it before I release.
thanks
I am using a compose file to start docker container.
Compose file here on github is:
Questions on that:
If I try to start a docker container with the above compose file (without device information) and I got the following log response:
Without providing the application secret that can not work I guess ...