Skip to content

Pool Math for Home Assistant

License

Notifications You must be signed in to change notification settings

rsnodgrass/hass-poolmath

Repository files navigation

Pool Math for Home Assistant

release_badge release_date hacs_badge License

Buy Me A Coffee Donate

Creates sensors for pools being managed with Trouble Free Pools's Pool Math apps including Pool Math iOS and Pool Math Android. From the Trouble Free Pool website:

  • Pool Math makes swimming pool care, maintenance and management easy by tracking chlorine, pH, alkalinity and other levels to help calculate how much salt, bleach and other chemicals to add.
  • Pool Math performs all the calculations you need to keep your chlorine, pH, calcium, alkalinity, and stabilizer levels balanced.
  • Trouble Free Pool is a registered 501(c)3 non-profit who displays NO advertising on our site nor is our advice compromised by financial incentives.

Supported Pool Math Values

  • pH
  • Free Chlorine (FC)
  • Combined Chlorine (CC)
  • Total Alkalinity (TA)
  • Calcium Hardness (CH)
  • Cyanuric Acid (CYA)
  • Salt
  • Borates
  • Calcite Saturation Index (CSI)
  • Temperature
  • Pressure
  • Flow Rate
  • SWG Cell Percentage

Note: this requires a Trouble Free Pool Pool Math Premium subscription to access your pool or spa's data from the Pool Math cloud service.

Support

Community Support

Installation

Make sure Home Assistant Community Store (HACS) is installed, then add the repository: rsnodgrass/hass-poolmath

Configuration

Under Settings of the Pool Math iOS or Android application, find the Sharing section. Turn this on, which allows anyone with access to the unique URL to be able to view data about your pool. Your pool's URL will be displayed. The Share ID from the URL will be used to configure the poolmath service.

Example URL: https://troublefreepool.com/mypool/7WPG8yL

Example Share ID: 7WPG8yL

Configure Pool Math (Trouble Free Pool) via integrations page or press the blue button below.

Open your Home Assistant instance and start setting up a new integration.

NOTE: This updates the state from PoolMath every 2 minutes to keep from overwhelming their service, as the majority of Pool Math users update their data manual after testing rather than automated. The check interval can be changed in yaml config by adding a 'scan_interval' for the sensor.

Example Lovelace UI

entities:
  - entity: sensor.pool_fc
    name: Free Chlorine
  - entity: sensor.pool_ph
    name: pH
  - entity: sensor.pool_ta
    name: Total Alkalinity
  - entity: sensor.pool_cya
    name: CYA
  - entity: sensor.pool_ch
    name: Hardness
type: entities
title: Pool
show_header_toggle: false

Lovelace Example

Another single line Lovelace example using multiple-entity-row:

entities:
  - entity: sensor.pool_ph
    type: 'custom:multiple-entity-row'
    name: Pool
    state_header: pH
    secondary_info: last-changed
    entities:
      - entity: sensor.pool_fc
        name: FC
      - entity: sensor.pool_cc
        name: CC
      - entity: sensor.pool_ta
        name: TA
  - entity: sensor.hot_tub_ph
    type: 'custom:multiple-entity-row'
    name: Hot Tub
    state_header: pH
    secondary_info: last-changed
    entities:
      - entity: sensor.hot_tub_fc
        name: FC
      - entity: sensor.hot_tub_cc
        name: CC
      - entity: sensor.hot_tub_ta
        name: TA
type: entities

Lovelace Example

Feature Requests

  • move all communication/interfaces to Pool Math into separate pypoolmath package that can be maintained separately
  • on HA start, if the Pool Math cloud service is not available, no sensors are created (they get created later when service returns); ideas how to improve this:
    1. if Pool Math service is down, just create ALL sensors hardcoded in POOL_MATH_SENSOR_SETTINGS (or check to see if RestoreEnttiy has entries for those) ... this might be easiest, and could just be standard startup procedure
    2. update PoolMathServiceSensor to also use RestoreEntity and recreate all sensors that were saved in its state
  • add @berniedp's calculation to suggest SWG % setting
  • add Total Chlorine (TC) calculation
  • make the HA yaml configuration for this a platform, rather than a sensor config...e.g.:
poolmath:
  sources:
    - url: https://api.poolmathapp.com/share/AbC123.json
      name: "Swimming Pool"
    - url: https://api.poolmathapp.com/share/7WPG8yL.json
      name: "Spa"

See Also