fredericvl / py-agua-iot

py-agua-iot provides controlling heating devices connected via the IOT Agua platform of Micronova
Apache License 2.0
31 stars 16 forks source link

Change API_LOGIN_APPLICATION_VERSION #49

Closed gjvanhalem closed 1 year ago

gjvanhalem commented 1 year ago

Since a week I have a new piazzetta stove. And after some experimentation I found that I needed to change API_LOGIN_APPLICATION_VERSION to 1.9.0 to be able to use py-agua-iot with this stove. Locally I have this working. But I do not know how to get that working in my Home Asisstant instance. Can anyone give me some pointers?

eternalpolo commented 1 year ago

Hi, i changed the version in _init.py__ but it don't work for me. Can you describe with more precision what did you do to connect the API?

Normaly you when you add the repository in "custom_component", restart HA. After you can go to "integration", "add integration" and choose "micronova" in the list. You select it and you'll have a windows with the different information (API URL, login url, email, password, etc...) and after enter these information, your stove will appear as a climate. You can add directly this repository from hacs by adding the adress and download it in hacs.

gjvanhalem commented 1 year ago

Hi @eternalpolo, I did indeed follow all the steps to use it in HA. But the connection to my Piazzetta P943 could not be established. I got different kinds of errors. After fiddling around and trying different things I figured out that the application version had changed from 1.6.0 to 1.9.0. And that the login url had changed to https://piazzetta-iot.app2cloud.it/api/bridge/endpoint/. To test I tried it outside of HA just witht the "bare" py_agua_iot module. Changing the API_LOGIN_APPLICATION_VERSION variable (hardcoded) to 1.9.0 and using the new login url I was able to make a connection My struggle is with getting that in HA correctly. I assume that a new version of py_agua_iot is needed. For now I changed the local py_agua_iot module in my HA instance to use the new application version and with that I am able to use it in HA. But I would like to do it more nicely. Maybe have the application version variable as well?

Donder24 commented 1 year ago

Hi @gjvanhalem I think this issue is similar to the issues in https://github.com/fredericvl/py-agua-iot/issues/44

Where do you adjust the version? I can't seem to find a variable API_LOGIN_APPLICATION_VERSION...

It's already a long time quiet in this repo, the more recent changes are done in a fork by @vincentwolsink https://github.com/vincentwolsink/py-agua-iot There is no possibility to open issues but you can open a PR...

gjvanhalem commented 1 year ago

I made the change in line 31 in this file py_agua_iot/init.py

Donder24 commented 1 year ago

Thx! but... where is this file in Home Assistant :-) Sorry!!!

gjvanhalem commented 1 year ago

ah, sorry for the confusion. In your HA instance find it with this command pip show py_agua_iot that will give you the file location among other info. Do not forget to remove the __pycache__ directory and restart HA after the change

Sylle99 commented 1 year ago

Hi @Donder24 I ended up using the files from yet another subfork based on the one you linked above: https://github.com/thetux07/py-agua-iot That fixed the dependencies errors I was getting with the original files from fredericvl

Hello @gjvanhalem Thank you so much for posting the updated login URL for Piazzetta stoves. That solved the error 500 I was getting. I managed now to add the stove tom my Home Assistant setup. Would it be possible to explain us in a bit more detail about your experimentation procedure that revealed the new link?

Best regards, Sylvain

gjvanhalem commented 1 year ago

Hi @Sylle99 , it was more luck than anything else :-). While investigating I stumbled on this website https://lefilliatre.github.io/lefilliatre-documentation/PoeleAgua/fr_FR/. Never heard of it before but they use the same py-agua-iot base to build a plugin for the jeedom platform. And that gave me a hint to use the different URL. It also gave me the hint to look at the application version.

I will see if I can make the application version a parameter for the HA plugin. Never made a plugin for HA before so it might take me a while to figure it out

Sylle99 commented 1 year ago

Sounds great!

I must say all this is waaaay above my head as I have no IT or programming knowledge. But I'm quickly picking up as we go and learn by looking at code made by others... :)

I installed this custom micronova integration by manually creating the folders and uploading files to Home assistant as described here https://github.com/fredericvl/py-agua-iot/blob/master/examples/home-assistant/README.md. I notice however that most of you guys are adding a custom repository instead and find all the files that way?! Does the command "pip show py_agua_iot" also work on a X86 version of Home assistant OS? Is there a benefit doing it that way compared to the manual upload I did??

Sorry for the questions - I appreciate all the help! Sylvain

gjvanhalem commented 1 year ago

OK, got it working locally and opened a pull request for https://github.com/vincentwolsink/py-agua-iot since that repo is more up-to-date as mentioned by @Donder24

My change will give you the option in HA to also enter the application version when configuring the integration

gjvanhalem commented 1 year ago

@Sylle99 you did it the right way. Finding and fiddling with the py_agua_module in the way I described should only be done on a local instance to do some test. If you have no experience with programming do not try to do this. It will break stuff. You will have to wait for my pull request to be merged for it to work

vincentwolsink commented 1 year ago

@gjvanhalem I merged your PR in v0.0.10. Thanks!

eternalpolo commented 1 year ago

Hi all,

I've tried the upgrade of @vincentwolsink and it's work for me by changing the Login API version.

I've changed the separate login URL by like @gjvanhalem said. Is it possible to change this information in the description of the repository ?

Thanks a lot @gjvanhalem and @vincentwolsink for your help.

gjvanhalem commented 1 year ago

I installed this custom micronova integration by manually creating the folders and uploading files to Home assistant as described here https://github.com/fredericvl/py-agua-iot/blob/master/examples/home-assistant/README.md. I notice however that most of you guys are adding a custom repository instead and find all the files that way?! Does the command "pip show py_agua_iot" also work on a X86 version of Home assistant OS? Is there a benefit doing it that way compared to the manual upload I did??

Just to give some background on this. The code that you add manually to HA is the integration that takes care of thh setup and running your integration. I made some changes to this to be able to add an extra parameter (application version). The module that you will find with pip show is imported by HA the first time you trigger the integration. You do not have to upload that manually. I made some changes to it to do some tests. But normally you shouldn't touch it

Hope that helps

gjvanhalem commented 1 year ago

@eternalpolo I created a pull request to change the description in the repository

gjvanhalem commented 1 year ago

all merged