Ondilo integration with Home Assistant

Hey Guys,

hope you are well.
I’m a proud owner of an Ondilo device which have been using since Feb2020 with great results. By that time, the company was working to create an API https://interop.ondilo.com/docs/api/customer/v1/?fbclid=IwAR06pLhvdVqdD8Jh4pc5G9lxGWsDawRb55569sYF1BUxqxNflsUc7E1NScY...and today they announced the existence of one that could be used to connect to the device and resquest the data via JSON. My ask is did someone tried this\or has interest on developing something? As well looking for recommendations to retrieve the data. Was wondering using Rest API to get the data I need from the device.

Looking forward for the community feedback!
Thanks,
Paulo Azevedo

4 Likes

Hi there !
I’m going to receive my Ico device in a few days, and am also willing to integrate it with HA. I’m currently looking at the API documentation and will see if I can get something to work, but this might take a long time !

Hi
i’ve managed to get my ICO in HA as a custom component (Temp sensor with Redox, PH, and Salt attributes)
It’s almost my first work on python, it must be an “hideous” script but it (almost) works.
2 issues :

  • the pool ID is hardcoded in the sensor.py (I planned to fix that)
  • I use the refresh token, which as a lifetime of 2 weeks => need to change the refresh token and restart ha every two weeks (I deal with it)

I although wrote a ondilo_query script which retrieves the pool id and the refresh token, based on ondlio user credentials. I did not tried to add this part to the sensor.py but It should although works (then no need to update the refresh token every 2 weeks)

If it helps, here are the files i use : https://1drv.ms/u/s!ArSXMT9e_hEeaFUlZPRGzBNDUTg?e=56oo7P

Alexa just told me the pool is at 24,1°C, it’s swimming time ! :o)

2 Likes

That’s great thanks!
I planned to build an integration for that but I already know this will take ages, so your scripts will be a perfect start! :+1:

@topilouff appreciate your work mate, this is precisly what I was looking for, but unfortunately didn’t had time to work on it:) I’m able to run the script sucessfully, can you give more details on how did you create the sensor within HA? I already had all the files within my custom components folder as well updated the sensor.py with my token (retrieved from the query python script :slight_smile: ) but now I was looking into how you create the sensor within the configuration.yaml can you give some guidelines?

image

Really appreciate your contribution :slight_smile:

You don’t need to update the sensor.py with the token, only change the pool_id with yours.
(line 121 : last_url = “https://interop.ondilo.com/api/customer/v1/pools/1234/lastmeasures”, replace 1234)
I see you have another value tds replacing salt in my config. you can modify the ‘salt’ attribute in line 103 by yours.
You can although modify the date attribute, i’ve configured it to suit my need, in french format (lines 105 to 107)

Then you need to create a sensor in the configuration file :

  - platform: ondilo_ico
    token: your_token  

And create an ondilo_ico folder in the custom component with the 3 files

It creates a sensor : sensor.ondilo

You can although change the default name by adding a new one in the sensor configuration (name: …)

1 Like

@topilouff cool, I’m able to see the sensor on HA already :slight_smile: Had some issues with the token…I noticed the token was refresh after a while not 2 weeks any comments here? Still this is a huge work :slight_smile:

Nice !
i did not have any issues with the refresh token, I have the sensor running for more than a month and had to update the token 2 times only
i although have generated few tokens with the query script, without any impact on the HA token lifetime.
What the error message you have with the query script ? Refresh token has expired ?

According to the API documentation, Refresh tokens are non-expiring. Considering that this API is quite new, maybe they experienced issues or changes on their side which invalidated existing tokens?
We’ll see in the future how it goes…

I’ve although read about the non expiry, and was surprised the first Time I had to renew it. I so noted the renewal Time, and New expiry occured exactly 2weeks After.
I didn’t try to change the retrieval interval (15 minutes) maybe it’s related

@topilouff noticed that I wasn’t even able to see the the sensor after HA reboot. When I checked the logs, noticed, enable to set sensor. On that moment I jumped again to the .py query and I saw I got a new token but so far is working fine :slight_smile:

1 Like

Hello!

I am going to get an Ondilo ICO wireless for an Spa pool we are getting in October. I have began to investigate the recommended wireless pool water analyzer and found this thread!

Have you considered making an HACS community integration of this code? I have done this with an integration for a lawnmower during the last year. And I hope that I can contribute to this integration.

/Jens

Any inputs, @topilouff?

/J

Hi,

I had a go at an Ondilo component implementation. It seems to be working…
I still have to publish the Ondilo lib to pypi but if you want to have a look, my code is here: https://github.com/JeromeHXP/core/tree/Ondilo_ICO_integration.

Feedbacks welcome!

@dartdoka the link points to the root of your github instance. I confess I didn’t had much time to explore. Can you please tell us how to “install”“run” your component into HA. I’m glad to test it :slight_smile:

@psadeazevedo I’m new to HA development so I’m not sure how it can be tested without getting the full build.
The component is here (https://github.com/JeromeHXP/core/tree/Ondilo_ICO_integration/homeassistant/components/ondilo_ico) but as the integration is from the UI, I think “ondilo_ico” should also be added to homeassistant/generated/config_flows.py.
I’ll try to document a proper way to test that on a production system…

@dartdoka I tried your integration, but it’s currently only refreshing the values when I restart HA.

Any ideas ?

@devbobo The allowed number of API calls is limited. To be able to handle multiple ICO with a single account, I’ve set the refresh rate to 1/h. Is that not even refreshing once per hour?
I’m away for the week so can’t re-check that right now but I’ll try to look into that next week.

Hi,
The refresh rate is generally more than an hour (+2 or 3 minutes at each measure), so configuring a query per hour was not sufficient in my case.
I first had to renew the refresh token every two weeks, but it’s now works since mid July with the same token, and a query every 15 minutes.
If it can helps…
Cheers