Blue Connect pool measurements

I have a Blue Connect plus by Riiot Labs that measures temperature, pH, etc in the pool water. I was not able to find any API integration with home assistant, but I have developed a small email integration. Seems to work fine for me. I have created an automatic rule in my inbox that moves all emails from [email protected], and with the correct title, to a separate email folder called Feeds\Blue_connect. A further improvement would be to find a way to automatically delete old emails from this folder. The email text includes some html code but by using various string functions it is possible to extract the relevant measurements.

This is what I have included in configuration.yaml:

  - platform: imap_email_content
    server: outlook.office365.com
    name: 'email_blueconnect'
    port: 993
    username: <USERNAME>
    password: <PWD>
    folder: 'Feeds/Blue_connect'
    senders:
      - [email protected]

  - platform: template
    sensors:
      pool_temp:
        friendly_name: 'Pool temp'
        unit_of_measurement: °C
        value_template: >-
          {{states.sensor.email_blueconnect.attributes.body.split('<td>')[2].split()[0]|float()|round(1)}}

      pool_ph:
        friendly_name: 'pH'
        value_template: >-
          {{states.sensor.email_blueconnect.attributes.body.split('<td>')[4].split('<')[0]|float()|round(1)}}

      pool_orp:
        friendly_name: 'ORP'
        unit_of_measurement: mV
        value_template: >-
          {{states.sensor.email_blueconnect.attributes.body.split('<td>')[6].split()[0]|int}}

      pool_salthalt:
        friendly_name: 'Salthalt'
        unit_of_measurement: 'g/l'
        value_template: >-
          {{states.sensor.email_blueconnect.attributes.body.split('<td>')[8].split()[0]|float()|round(1)}}

Can you post your code properly please? Instructions are here How to help us help you - or How to ask a good question

Thanks for the instructions. I have edited my original post.

Hi @HA_jr

I’m thinking of getting a blue connect to monitor my pool and I’m an avid HA user. Are you happy with the device?

Also, I saw on their website that they support IFTTT - https://riiotlabs.zendesk.com/hc/en-us/articles/360000305357-Is-Blue-compatible-with-IFTTT-

I wonder if this is an alternative to scraping the emails - you could make HA webhooks be updated by IFTTT possibly?

Thanks

Hi @danps

I am very happy with the Blue Connect Plus. It was quite easy to install. And it works perfect! I can truely recommend this product. I have made an integration with the salt chlorinator with help of Home Assistant, i.e., when ORP level gets low, the salt chlorinator starts automatically.

I have changed from email scraping to IFTTT. The drawback with email scraping was that every time I restart Home Assistant, it starts reading the old emails and it takes a while until status has been updated to the latest email. IFTTT integration works fine, but there is up to 1,5 hours delay from the Blue Connect measurement until it reaches IFTTT and Home Assistant. I suppose this is a problem on the Blue Connect side. It seems to go much faster from IFTTT to Home Assistant.

Thanks @HA_jr!

That’s exactly my plan with the chlorinator as well. I’ll use a Sonoff R2 to control the chlorination process based on readings from the Blue Connect. It’s a shame that the readings aren’t coming to IFTTT for quite a while but I suppose the chlorine level doesn’t change that quickly on a moderately-sized swimming pool. How often does the data update? Hourly maybe?

Thanks again

For anyone else with a Blue Connect, I did just get one as well, and I’m using IFTTT to POST JSON to a webhook which I then catch with an Automation in Home Assistant, and update an “Input Number” which in turn is the basis of my sensors. So my config looks like this…

First the input_numbers…

pool_temperature:
  name: Pool Temperature
  min: 0
  max: 100
  step: 0.1
  unit_of_measurement: '°C'
pool_ph:
  name: Pool pH
  min: 1
  max: 15
  step: 0.1
pool_orp:
  name: Pool ORP
  min: 0
  max: 2000
  step: 1
  unit_of_measurement: 'mV'
pool_salinity:
  name: Pool Salinity
  min: 0
  max: 10
  step: .001
  unit_of_measurement: 'ppt'
pool_conductivity:
  name: Pool Conductivity
  min: 0
  max: 10000
  step: 1

These are my sensors…

- platform: template
  sensors:
    pool_temperature:
      friendly_name: "Pool Temperature"
      unit_of_measurement: '°C'
      value_template: "{{ states('input_number.pool_temperature') }}"
    pool_ph:
      friendly_name: "Pool pH"
      value_template: "{{ states('input_number.pool_ph') }}"
    pool_orp:
      friendly_name: "Pool ORP"
      unit_of_measurement: 'mV'
      value_template: "{{ states('input_number.pool_orp') }}"
    pool_salinity:
      friendly_name: "Pool Salinity"
      unit_of_measurement: 'ppm'
      value_template: "{{ states('input_number.pool_salinity') | float * 1000 }}"
    pool_conductivity:
      friendly_name: "Pool Conductivity"
      value_template: "{{ states('input_number.pool_conductivity') }}"

And my automation…

- id: blue_connect_data_update
  alias: Blue Connect Data Update
  trigger:
  - platform: webhook
    webhook_id: blueconnect
  action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.pool_temperature
      value: '{{trigger.json.temperature | float}}'
  - service: input_number.set_value
    data_template:
      entity_id: input_number.pool_ph
      value: '{{trigger.json.ph | float}}'
  - service: input_number.set_value
    data_template:
      entity_id: input_number.pool_orp
      value: '{{trigger.json.orp | float}}'
  - service: input_number.set_value
    data_template:
      entity_id: input_number.pool_salinity
      value: '{{trigger.json.salinity | float}}'
  - service: input_number.set_value
    data_template:
      entity_id: input_number.pool_conductivity
      value: '{{trigger.json.conductivity | float}}'

And finally the JSON message body in IFTTT…

{"temperature":"{{TemperatureCelsius}}", "ph":"{{Ph}}", "orp":"{{Orp}}", "salinity":"{{Salinity}}", "conductivity":"{{Conductivity}}"}

Thanks for sharing! Do you also experience delays of ~1 hrs before receiving blue connect measurements from IFTTT?

Yeah it seems to vary quite a bit…

I’ve been trying to use the automation to record what the delay is, but I don’t have the code quite right yet and haven’t had the time to fix it. This is what I’ve been experimenting with, bit didn’t work…

   - service: input_number.set_value
     data_template:
       entity_id: input_number.blue_connect_time_delay
       value: '{{((as_timestamp(utcnow())-as_timestamp(strptime("trigger.json.time","%d/%m/%Y
         %H:%M:%S")))/60)|float -600}}'

I’ve also noticed fewer than 20 readings per day. Did you notice the same?

Yes, I have more like 10-15 measurements per day. However, I have my pool on a timer 9 am - 9 pm, also registered in Blue Connect so I thought this was the reason. Is it also your experience that the delay is from Blue Connect to IFTTT, but not from IFTTT to HA?

Hi folks,

I’m looking at buying a second hand unit, looks like it could be a fit for me. I’m really only after stats.

How did efforts with integration go? Able to iron out frequency issues?

Does this unit require calibration or something at some point?

I have not spent more time looking into the delays. It works really well, but gives more like 10 readings per day and with delays up to an hour. For me that is not a big concern.