milanmeu / aioaseko

Async Python package for the Aseko Pool Live API
https://pypi.org/project/aioaseko/
GNU Lesser General Public License v3.0
4 stars 2 forks source link

Log Out after 15 minutes #1

Closed ChristianLoacker closed 1 year ago

ChristianLoacker commented 2 years ago

Hi Milan, I love the Aseko integration - unfortunatley doesn't work consistent at the moment. After a (re-)install of the integration all works perfectly fine for 15 minutes. Then the integration stops working. A re-installation sorts the issue - for another 15 minutes.

From the log:

Logger: homeassistant.components.aseko_pool_live Source: components/aseko_pool_live/init.py:75 Integration: Aseko Pool Live (documentation, issues) First occurred: 3. Mai 2022, 16:55:01 (495 occurrences) Last logged: 09:46:51

Unexpected error fetching PoolLoacker data: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/components/aseko_pool_live/init.py", line 75, in _async_update_data await self._unit.get_state() File "/usr/local/lib/python3.9/site-packages/aioaseko/unit.py", line 119, in get_state resp = await self._account._request("get", f"units/{self._serial_number}") File "/usr/local/lib/python3.9/site-packages/aioaseko/mobile.py", line 66, in _request raise InvalidAuthCredentials aioaseko.exceptions.InvalidAuthCredentials

Latest HA Core installation via Docker and Aseko integration.

Any help would be highly appreciated! Best regards, Christian

robpow commented 2 years ago

Looking at the traffic in a browser debugger it seems that the Aseko web service returns an authentication token and and expiry timestamp which is a Unix time epoch in exactly 15 minutes from the point of logging in. So the client code would need to catch the timeout and re-authenticate.

ChristianLoacker commented 2 years ago

@robpow - thank you for providing further information! Just to bring up another path / by accessing the Aseko locally you end up at the interface of the Serial Ethernet Converter. I tried to re-configure and catch the UDP package in my case on Loxone. Went very well / only problem is to understand how to parse the values from the Hex buffer that I would like to monitor. Originally that module sends the data to ipool.aseko.com. Any idea how to parse that data? Would be the most stable solution as all data stays locally.

robpow commented 2 years ago

@ChristianLoacker A local solution would be the ideal way forward. I can't think of any quick solution, just to capture as much data as possible and then try to spot patterns while comparing with the data displayed on the web site. Slow and boring work for sure.

Where did you tap into for the raw hex data?

ChristianLoacker commented 2 years ago

@robpow - any chance I can send you a private message?

robpow commented 2 years ago

@ChristianLoacker Sure, I have the same username on Telegram.

jirkapas commented 2 years ago

@ChristianLoacker @robpow Bypassing the ASEKO server all together would be ideal. Have you tried to contact ASEKO about how the serial commination with the server works? I know our installer was able to get some documentation about the RS232 communication between the unit and their touch screen display. I'm from the same country as the company, maybe they would be more likely to share information when they don't have to translate it to English.

buekliev commented 1 year ago

@ChristianLoacker @robpow Bypassing the ASEKO server all together would be ideal. Have you tried to contact ASEKO about how the serial commination with the server works? I know our installer was able to get some documentation about the RS232 communication between the unit and their touch screen display. I'm from the same country as the company, maybe they would be more likely to share information when they don't have to translate it to English.

Apparently their units have this serial to tcp module which connects to pool.aseko.com:47524 and sends the real time data, you can adjust the server host (just try opening http://UNIT_LOCAL_IP admin:admin default creds) to your machine and use the data the unit sends.

ChristianLoacker commented 1 year ago

Dear @buekliev - thank you for your information. I am fetching the data internally in the meantime and parse them with the help of NodeRed. Works excellent - it just took me some hours to analyse the data. Actaully I am pushing the information to the Loxone System to visualize them for me. But it is a very custom setup. I changed the pool.aseko.com:47524 to the IP of my Node-Red (which runs as a Docker on Synology). There I am parsing the data and push the information to my Loxone Miniserver. Works perfectly well - I am reading PH, Water Temp, Redox, Waterflow and water level. Thank you for sharing! Looks like @milanmeu stopped supporting the PlugIn - unfortunatley.

buekliev commented 1 year ago

Thanks a lot for the info on Node-Red approach, @ChristianLoacker. This can definitely be used with the home assistant that I am ultimately trying to get the data to. I would really appreciate if you could provide more info on the data structure the units transmit to the Node-Red instance, maybe you have some part of this on github already.

Speaking of the current library, the https://pool.aseko.com/api/v1/ API this lib is using supports some version of oauth protocol and with JWT accessToken (which has 15 min TTL) /login call returns a refreshToken (this will probably be valid for a bit longer than 15 min). POST to /refresh with the refreshToken (JSON) will generate another pair of valid tokens. Hope this can be done at some point by @milanmeu.

hopkins-tk commented 1 year ago

@milanmeu I tried to prepare the fix, if you find some time to have a look at the pull request it would be appreciated.

tipofthesowrd commented 1 year ago

Dear @buekliev - thank you for your information. I am fetching the data internally in the meantime and parse them with the help of NodeRed. Works excellent - it just took me some hours to analyse the data. Actaully I am pushing the information to the Loxone System to visualize them for me. But it is a very custom setup. I changed the pool.aseko.com:47524 to the IP of my Node-Red (which runs as a Docker on Synology). There I am parsing the data and push the information to my Loxone Miniserver. Works perfectly well - I am reading PH, Water Temp, Redox, Waterflow and water level. Thank you for sharing! Looks like @milanmeu stopped supporting the PlugIn - unfortunatley.

I'm currently also capturing the data via wireshark to spot the patterns. Do you have any more information I can use already? If I know the pattern I'm willing to invest some time into making this into a local integration iso cloud polling

ChristianLoacker commented 1 year ago

@ChristianLoacker @robpow Bypassing the ASEKO server all together would be ideal. Have you tried to contact ASEKO about how the serial commination with the server works? I know our installer was able to get some documentation about the RS232 communication between the unit and their touch screen display. I'm from the same country as the company, maybe they would be more likely to share information when they don't have to translate it to English.

@ChristianLoacker @robpow Bypassing the ASEKO server all together would be ideal. Have you tried to contact ASEKO about how the serial commination with the server works?

no - I didn’t. If you could support ur that would be fantastic! A documentation would be super useful! If you could please forward the document from the installer you mentioned that would be great! Thank you @jirkapas

schraegervogel commented 1 year ago

Hello, I have a Aqua Salt, I got some information about the RS485 Protokoll, hope this will help.

RS485 communication protocol - ASIN Aqua x.pdf