Water Guru Integration

VERY Helpful. Thank you. I’ve been using ChatGPT to check my formatting and ask all the other questions I had. It’s surprisingly helpful in this space. I’m getting there.

So close… Apparently I’m missing something:

Any thoughts or nudges in the right direction?

Is it a single gauge? The example I posted is part of a vertical stack.

Here is a UI based configuration for a gauge card, maybe that helps…

I got the gauges working fine. It’s the mushroom cards I’m tripping over. I got this far:

Now I’m sure it has something to do with my lack of experience with the proper formatting of the lovelace card. When I add the other code blocks under the raw code that generates the gauges, it all goes haywire.

adding just the Mushroom Row code (above) makes my raw config look like this:

views:
  - title: WaterGuru
    badges: []
    cards:
      - type: gauge
        entity: sensor.waterguru_ph
        name: PH
        needle: true
        severity:
          green: 7.5
          yellow: 0
          red: 8
        min: 6
        max: 9
      - type: gauge
        needle: true
        severity:
          green: 2
          yellow: 0
          red: 6
        max: 10
        entity: sensor.waterguru_cl
        name: Free Chlorine Level
      - type: gauge
        entity: sensor.waterguru_water_temperature
        name: Temperature
        needle: false
        min: 65
        max: 100
        unit: F
type: horizontal-stack
cards:
  - type: custom:mushroom-template-card
    primary: '{{states(''sensor.waterguru_ph'')}}'
    secondary: pH
    icon: mdi:ph
    icon_color: '{{(state_attr(''sensor.waterguru_ph'',''status'')|lower)}}'
    card_mod:
      style: |
        ha-card {
          --card-primary-font-size: 18px;
          --card-secondary-font-size: 12px;
          --icon-size: 1.7em;
        }
        :host {
          --mush-icon-symbol-size: 1.2em;
        }     
  - type: custom:mushroom-template-card
    primary: '{{states(''sensor.waterguru_cl'')}}'
    secondary: Chlorine
    icon: mdi:beaker
    icon_color: '{{(state_attr(''sensor.waterguru_cl'',''status'')|lower)}}'
    card_mod:
      style: |
        ha-card {
          --card-primary-font-size: 18px;
          --card-secondary-font-size: 12px;
          --icon-size: 1.7em;
        }
        :host {
          --mush-icon-symbol-size: 1.2em;
        } 
  - type: custom:mushroom-template-card
    primary: '{{states(''sensor.pool_scg_salt'')}} ppm'
    secondary: Salt
    icon: mdi:shaker
    icon_color: |-
      {%set saltlvl = states('sensor.pool_scg_salt')|int%}
      {%if saltlvl < 3001%}
      yellow
      {%elif saltlvl > 3000 and saltlvl <4001%}
      green
      {%elif saltlvl > 4000%}
      red
      {%endif%}
    card_mod:
      style: |
        ha-card {
          --card-primary-font-size: 18px;
          --card-secondary-font-size: 12px;
          --icon-size: 1.7em;
        }
        :host {
          --mush-icon-symbol-size: 1.2em;
        }

That yields nothing new:
Same screen as above

Adding in the Message Card code block above then looks like this:

  - title: WaterGuru
    badges: []
    cards:
      - type: gauge
        entity: sensor.waterguru_ph
        name: PH
        needle: true
        severity:
          green: 7.5
          yellow: 0
          red: 8
        min: 6
        max: 9
      - type: gauge
        needle: true
        severity:
          green: 2
          yellow: 0
          red: 6
        max: 10
        entity: sensor.waterguru_cl
        name: Free Chlorine Level
      - type: gauge
        entity: sensor.waterguru_water_temperature
        name: Temperature
        needle: false
        min: 65
        max: 100
        unit: F
type: horizontal-stack
cards:
  - type: custom:mushroom-template-card
    primary: '{{states(''sensor.waterguru_ph'')}}'
    secondary: pH
    icon: mdi:ph
    icon_color: '{{(state_attr(''sensor.waterguru_ph'',''status'')|lower)}}'
    card_mod:
      style: |
        ha-card {
          --card-primary-font-size: 18px;
          --card-secondary-font-size: 12px;
          --icon-size: 1.7em;
        }
        :host {
          --mush-icon-symbol-size: 1.2em;
        }     
  - type: custom:mushroom-template-card
    primary: '{{states(''sensor.waterguru_cl'')}}'
    secondary: Chlorine
    icon: mdi:beaker
    icon_color: '{{(state_attr(''sensor.waterguru_cl'',''status'')|lower)}}'
    card_mod:
      style: |
        ha-card {
          --card-primary-font-size: 18px;
          --card-secondary-font-size: 12px;
          --icon-size: 1.7em;
        }
        :host {
          --mush-icon-symbol-size: 1.2em;
        } 
  - type: custom:mushroom-template-card
    primary: '{{states(''sensor.pool_scg_salt'')}} ppm'
    secondary: Salt
    icon: mdi:shaker
    icon_color: |-
      {%set saltlvl = states('sensor.pool_scg_salt')|int%}
      {%if saltlvl < 3001%}
      yellow
      {%elif saltlvl > 3000 and saltlvl <4001%}
      green
      {%elif saltlvl > 4000%}
      red
      {%endif%}
    card_mod:
      style: |
        ha-card {
          --card-primary-font-size: 18px;
          --card-secondary-font-size: 12px;
          --icon-size: 1.7em;
        }
        :host {
          --mush-icon-symbol-size: 1.2em;
        }
      type: custom:mushroom-template-card
      primary: 'Last Measured: {{(state_attr(''sensor.waterguru_ph'',''measure_time_human''))}}'
      secondary: >-
        {{(as_timestamp(strptime(state_attr('sensor.waterguru_ph','measure_time')[:19],'%Y-%m-%dT%H:%M:%S'))|float
        -14400)|timestamp_custom('%m-%d-%Y %H:%M', local=True)}}
      
        {%if state_attr('sensor.waterguru_ph','advice') != 'all clear'%}PH:
        {{state_attr('sensor.waterguru_ph','advice')}}{%endif%}
      
        {%if state_attr('sensor.waterguru_cl','advice') != 'all clear'%}Chlorine:
        {{state_attr('sensor.waterguru_cl','advice')}}{%endif%}
      
        Battery: {{states('sensor.waterguru_battery')}}%
      
        Cassette: {{states('sensor.waterguru_cassette')}}% -
        {{state_attr('sensor.waterguru_cassette','measurements_left')}} Measurements
      icon: mdi:pool
      badge_icon: >-
        {%if 'alerts' in (state_attr('sensor.waterguru_raw','measurements')[0]) or
        'alerts' in (state_attr('sensor.waterguru_raw','measurements')[1])%} mdi:alert
        {%else%}
      
        {%endif%}
      badge_color: red
      multiline_secondary: true
      icon_color: |2-
          {%if 'alerts' in (state_attr('sensor.waterguru_raw','measurements')[0]) or
          'alerts' in (state_attr('sensor.waterguru_raw','measurements')[1])%}
          yellow
          {%else%}
           green
          {%endif%}
      card_mod:
        style: |
          ha-card {
            --card-primary-font-size: 14px;
            --card-secondary-font-size: 15px;
            --icon-size: 2em;
          }
          :host {
            --mush-icon-symbol-size: 1.7em;
          }

and still no change. As if the lovelace file isn’t loading unless I use the visual editor…

Then I edit out the references to the Salt components since I don’t have that and assume it’s whats causing the hub-bub, and I then it all goes kerplooie…

I will look in a little bit. At a first glance, it looks like the indentation is not correct. Try this version:

views:
  - title: WaterGuru
    badges: []
    cards:
      - type: gauge
        entity: sensor.waterguru_ph
        name: PH
        needle: true
        severity:
          green: 7.5
          yellow: 0
          red: 8
        min: 6
        max: 9
      - type: gauge
        needle: true
        severity:
          green: 2
          yellow: 0
          red: 6
        max: 10
        entity: sensor.waterguru_cl
        name: Free Chlorine Level
      - type: gauge
        entity: sensor.waterguru_water_temperature
        name: Temperature
        needle: false
        min: 65
        max: 100
        unit: F
			- type: horizontal-stack
				cards:
				  - type: custom:mushroom-template-card
				    primary: '{{states(''sensor.waterguru_ph'')}}'
				    secondary: pH
				    icon: mdi:ph
				    icon_color: '{{(state_attr(''sensor.waterguru_ph'',''status'')|lower)}}'
				    card_mod:
				      style: |
				        ha-card {
				          --card-primary-font-size: 18px;
				          --card-secondary-font-size: 12px;
				          --icon-size: 1.7em;
				        }
				        :host {
				          --mush-icon-symbol-size: 1.2em;
				        }     
				  - type: custom:mushroom-template-card
				    primary: '{{states(''sensor.waterguru_cl'')}}'
				    secondary: Chlorine
				    icon: mdi:beaker
				    icon_color: '{{(state_attr(''sensor.waterguru_cl'',''status'')|lower)}}'
				    card_mod:
				      style: |
				        ha-card {
				          --card-primary-font-size: 18px;
				          --card-secondary-font-size: 12px;
				          --icon-size: 1.7em;
				        }
				        :host {
				          --mush-icon-symbol-size: 1.2em;
				        } 
				  - type: custom:mushroom-template-card
				    primary: '{{states(''sensor.pool_scg_salt'')}} ppm'
				    secondary: Salt
				    icon: mdi:shaker
				    icon_color: |-
				      {%set saltlvl = states('sensor.pool_scg_salt')|int%}
				      {%if saltlvl < 3001%}
				      yellow
				      {%elif saltlvl > 3000 and saltlvl <4001%}
				      green
				      {%elif saltlvl > 4000%}
				      red
				      {%endif%}
				    card_mod:
				      style: |
				        ha-card {
				          --card-primary-font-size: 18px;
				          --card-secondary-font-size: 12px;
				          --icon-size: 1.7em;
				        }
				        :host {
				          --mush-icon-symbol-size: 1.2em;
				        }

Definitely indentation. I deleted all the tabs, and re-entered them (counting the way to the left, and then retabbing back).

Now I see this:

Headway!!! Thanks,

Now I need to see why it isn’t stacking correctly, and why I can’t get the Message Block.

Also, if you used my code, the temperature is in Centigrade. Based on your screenshot, you could almost go ice skating

Change this line in the config.yaml:

{{"%.1f"|format((state_attr('sensor.waterguru_raw','waterTemp')|float -32)*5/9)}}

to

{{"%.1f"|format(state_attr('sensor.waterguru_raw','waterTemp')|float)}}

Well it’s MUCH warmer NOW. :slight_smile:

So, the Message card works fine in a different view all by itself, so clearly the code works fine. It must be my lack of skill in the formatting. I’ll keep working on it and hope GPT-4 is smarter than ME…

Well GPT-4 can code HA pretty well. Better than me for sure. For anyone else struggling with implementing this on a single dashboard here ya go:

  - title: WaterGuru & Home
    badges: []
    cards:
      - type: vertical-stack
        cards:
          - type: horizontal-stack
            cards:
              - type: gauge
                entity: sensor.waterguru_ph
                name: PH
                needle: true
                severity:
                  green: 7.5
                  yellow: 0
                  red: 8
                min: 6
                max: 9
              - type: gauge
                needle: true
                severity:
                  green: 2
                  yellow: 0
                  red: 6
                max: 10
                entity: sensor.waterguru_cl
                name: Free Chlorine Level
              - type: gauge
                entity: sensor.waterguru_water_temperature
                name: Temperature
                needle: false
                min: 65
                max: 100
                unit: F
          - type: horizontal-stack
            cards:
              - type: custom:mushroom-template-card
                primary: '{{states(''sensor.waterguru_ph'')}}'
                secondary: pH
                icon: mdi:ph
                icon_color: '{{(state_attr(''sensor.waterguru_ph'',''status'')|lower)}}'
                card_mod:
                  style: |
                    ha-card {
                      --card-primary-font-size: 18px;
                      --card-secondary-font-size: 12px;
                      --icon-size: 1.7em;
                    }
                    :host {
                      --mush-icon-symbol-size: 1.2em;
                    }
              - type: custom:mushroom-template-card
                primary: '{{states(''sensor.waterguru_cl'')}}'
                secondary: Chlorine
                icon: mdi:beaker
                icon_color: '{{(state_attr(''sensor.waterguru_cl'',''status'')|lower)}}'
                card_mod:
                  style: |
                    ha-card {
                      --card-primary-font-size: 18px;
                      --card-secondary-font-size: 12px;
                      --icon-size: 1.7em;
                    }
                    :host {
                      --mush-icon-symbol-size: 1.2em;
                    }
          - type: custom:mushroom-template-card
            primary: >-
              Last Measured:
              {{(state_attr('sensor.waterguru_ph','measure_time_human'))}}
            secondary: >-
              {{(as_timestamp(strptime(state_attr('sensor.waterguru_ph','measure_time')[:19],'%Y-%m-%dT%H:%M:%S'))|float
              -14400)|timestamp_custom('%m-%d-%Y %H:%M', local=True)}}

              {%if state_attr('sensor.waterguru_ph','advice') != 'all
              clear'%}PH:
              {{state_attr('sensor.waterguru_ph','advice')}}{%endif%}

              {%if state_attr('sensor.waterguru_cl','advice') != 'all
              clear'%}Chlorine:
              {{state_attr('sensor.waterguru_cl','advice')}}{%endif%}

              Battery: {{states('sensor.waterguru_battery')}}%

              Cassette: {{states('sensor.waterguru_cassette')}}% -
              {{state_attr('sensor.waterguru_cassette','measurements_left')}}
              Measurements

Thanks for all your help.

One more thing. How often does the api refresh? I think I saw it was 21600 - is that seconds?

Yes, this is seconds. I am trying to find a better way to just pull the data once a day after the results of teh test are posted.

Regarding the measurements: The number indicated the measurement pads available. Each cassette has 180 pads and uses 3 per measurement.

For Pentair, are you using IntelliCenter or something else? If so, what are you able to control from IntelliCenter? I’m potentially getting IntelliCenter lite and I’m super excited!

I have the older IntelliControl + Screenlogic system. It does work and I managed to automatically control the salt cell based on waterguru readings. Not perfect due to only once-per-day measurements but it keeps it stable. Screenlogic has a core integration.

I know there is some work for IntelliCenter in HACS. I am following this development since I am considering upgrading to IntelliCenter next pool season.

This is awesome work guys tanks for this.

Awesome work. Make sure the sensors all get a unique ID, and then it works out of the box!

@sarahmva: considering this solution but I am struggling to understand the setup. How does the data get from the sensor into HA? Waterguru works with an app on an android device. Docker works on a Unix machine … Do you run Docker on your HA server? How does the data get from the app (which I assume runs on a phone or tablet) into the server?

This thread is awesome, I was thinking about buying a WaterGuru soon and was hoping I could integrate - seems like some of you have pulled this off. Thinking about implementation a bit - it feels like maybe the simplest thing to do would be to take the Docker image that’s being passed around (GitHub - bdwilson/waterguru-api: WaterGuru API) and build a local/custom add-on. I’ve never done that before, but seems like it should work… Has anyone taken that path? If not, I’ll try to share back whatever I end up building. If someone in this thread has already done this, can you share it?

1 Like

Thank you!!! Stumbled here via the Google and managed to come up with this using the Docker / Lovelace card info in this thread:

EDIT: Switched 3rd gauge from temp to CYA:

I am struggling to get this installed…have googled a ton about Docker in HA and cannot seem to find the right install instructions. Appreciate if you can share steps to get this integrated into HA…I am running HA on a Raspberry Pi and not in a Docker. Can I still get this to work? Thanks in advance.