Rest Sensor receiving JSON - Astralpool - connectmypool.com.au

Is all a few posts above

To get rid of the error I added a default of zero to the integers

Just out of interest, what hardware do you need to be able to do basic home assistant integration?
We’re getting a pool installed in the next 12 months and will be getting an Astral Viron p320 pump + an Astral Viron V25 chlorinator. Do I also need viron connect or is there an easier method?

I basically just want to control lights + pump on/off.

I see you have a drop down for active favourites…how do you code that as an input select?..

would you mind sharing the config yaml…mine shows up as just a number 255 or 3 etc…Ive decided this is the best way to automate, since channels are pretty annoying…also see you have an All Auto and Daily filter switch…interested what you have done there to make them work…

im not too far off

you need a Connect10…the lights could probably be done with an RF blaster…V25 Chlorinator has bluetooth and an app…so maybe some opportunity there? not sure

Cheers mate.

Gee, there’s been some activity here since I was here last!

Anyhow it’s a little ugly, but I use input_select to create the drop down that then fires the command via automations - I basically put all the code in the post earlier in this thread ie: Rest Sensor receiving JSON - Astralpool - connectmypool.com.au - #24 by zagnuts

One minor issue with this, other than the time required to create the list and associated automation(s) is it does not show the actual state if you change it somewhere else ie if you change the favourite via the remote or wall control panel, the active favourite does not change in the drop down. There are no doubt ways to do this better, and some discussions about potential options above, but for me it’s good enough. :wink:

With those I hardwired a D1mini with a two channel relay to the controller - described that here: Rest Sensor receiving JSON - Astralpool - connectmypool.com.au - #59 by zagnuts. Personally I wouldn’t bother unless you just want to do it for the heck of it. The only real advantage to it rather than using the api is it does not go through the cloud. It only lets you choose between two favourites though.

actually minor update - I forgot to mention that (as it’s in the same general area anyhow) I’m also planning to use the D1 mini to monitor the HCL level via a non contact liquid sensor. Basically, my plan is to stick one (search for XKC-Y25 if interested) on the side of the container that’s feeding the chlorinator and setup an alert when it starts getting low. You could even stick a few on eg to let you know when it’s 75%, 50%, 25% but frankly a warning at 25% I suspect is good enough. FWIW - Have put the info here: Low HCL warning for automated salt water pool chlorinator system

Hi team, thought you’d be interested in this - have added these buttons into lovelace dashboard to control and show the status of the Pool Mode (All Off, All Auto, Pool Mode, etc).

Initially I was calling the REST command directly and bypassing the automation as above, but the 30 sec delay in updating the status was no good. Have found I can call the automation directly from the custom button card - and this is working well.

image

You need the custom button card to do it.

Code for lovelace card (once you’ve loaded the custom button card through HACs and then remember to add it through integrations as well)

title: Pool Mode
square: true
columns: 4
type: grid
cards:
  - type: custom:button-card
    icon: mdi:power
    entity: sensor.pool_active_favourite
    name: 'Off'
    show_name: true
    show_icon: true
    show_state: false
    styles:
      card:
        - height: 100px
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.pool_favourite_all_off
    state:
      - value: All Off
        operator: '=='
        color: yellow
        icon: mdi:power
      - operator: default
        icon: mdi:power
  - type: custom:button-card
    icon: mdi:refresh-auto
    entity: sensor.pool_active_favourite
    name: Auto
    show_name: true
    show_icon: true
    show_state: false
    styles:
      card:
        - height: 100px
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.pool_favourite_all_auto
    state:
      - value: All Auto
        operator: '=='
        color: yellow
        icon: mdi:refresh-auto
      - operator: default
        icon: mdi:refresh-auto
  - type: custom:button-card
    icon: mdi:pool
    entity: sensor.pool_active_favourite
    name: Pool
    show_name: true
    show_icon: true
    show_state: false
    styles:
      card:
        - height: 100px
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.pool_favourite_pool
    state:
      - value: Pool Mode
        operator: '=='
        color: yellow
        icon: mdi:pool
      - operator: default
        icon: mdi:pool
  - type: custom:button-card
    icon: mdi:hot-tub
    entity: sensor.pool_active_favourite
    name: Spa
    show_name: true
    show_icon: true
    show_state: false
    styles:
      card:
        - height: 100px
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.pool_favourite_spa
    state:
      - value: Spa Mode
        operator: '=='
        color: red
        icon: mdi:hot-tub
      - operator: default
        icon: mdi:hot-tub
1 Like

When you configure your Connect 10 using the touch screen, there is an option for each channel - “Allow Times to use this channel” - if you select “No” for this option is disables Auto mode. Basically auto = timer mode.

Has anyone been able to get a Thermostat going to control Temp? That would work really well with the HA → Homekit integration.

This thread talks about some reliability issues with their cloud service. How’s it been lately? Both outages and general latency in turning things on/off?

I have worked out how to get the Generic Thermostat working. My first attempt at coding in HA so please suggest any improvements.

Here is my Generic Thermostat Template:

- platform: generic_thermostat
  name: Pool Temperature Gauge
  heater: switch.pool_heater
  target_sensor: sensor.pool1_temperature
  min_temp: 10
  max_temp: 32
  precision: 1.0
  target_temp: 14
  ac_mode: false

I added 4 Automations.

  1. To set the temperature of the Thermostat based on the current pool temp:
- id: '1664278805395'
  alias: Set Pool Temp Thermostat
  trigger:
    platform: state
    entity_id: sensor.pool1_heaters0_settemp
  action:
    service: climate.set_temperature
    target:
      entity_id: climate.pool_temperature_gauge
    data:
      temperature: '{{ states.sensor.pool_status.attributes["heaters"][0]["set_temperature"]|float
        }}'

  1. To set the target temperature of the pool when you change the Temperature on the Thermostat:
- id: '1664287705395'
  alias: Pool Temp Thermostat moved
  trigger:
    platform: state
    entity_id: climate.pool_temperature_gauge
    attribute: temperature
  condition: []
  action:
    service: rest_command.poolaction
    data:
      action_code: 5
      device_number: 1
      value: '{{ state_attr(''climate.pool_temperature_gauge'', ''temperature'') |
        int }}'
      delay: 2
  1. Update the Thermostat to show the Heater is off when the Pool heater gets turned off:
- id: '1167287705395'
  alias: Pool Heater Turned Off
  trigger:
  - platform: state
    entity_id: sensor.pool1_heaters0_mode
    from: 'On'
    to: 'Off'
  action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: 'off'
    target:
      entity_id: climate.pool_temperature_gauge
  mode: single
  1. Finally, update the Thermostat to show the Pool heater as on when the Pool Heater gets turned on:
- id: '1267287705395'
  alias: Pool Heater Turned On
  trigger:
  - platform: state
    entity_id: sensor.pool1_heaters0_mode
    from: 'Off'
    to: 'On'
  action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
      entity_id: climate.pool_temperature_gauge
  mode: single

Works Great. Integrated into Homekit as well so I can control it from Siri!

.

2 Likes

After being so popular this thread seems to have gone quiet.

Did anyone get a nice pool dashboard working? I started last year but the problem I kept running into is not being able to send a command for a state. i.e. Auto > High > Med > Low… because the Connect10 couldn’t accept the command you needed to toggle through each one to get the setting you wanted, which was useless.

Also, suddenly I no longer get pool temperature, it just shows 0 c. What is reporting your temperature, is it the spa heater?

Did anyone ever work this out and could you share your code?

Thank you!

Have been reading this whole thread with great interest, and am currently setting up favourites so I can jump to direct “modes” eg. only pump on, only light on etc rather than cycling through a channel.

What I cannot work out is how (if even possible) to select ALL AUTO via the API. I note that when in ALL AUTO mode, my pool_status sensor has the active_favourite state attribute as 255, but if I try to set it to that via a rest_command / API then it won’t set it to that.

I am thinking you can’t do it and that could then mean the only way is to use the hardware option and something like a D1 to do it.

Hi,
Newish to HA and no coding experience to coding. This looks great and now know part of how I will be spending my summer!
But also wondering if anyone has tried setting it so the heat pump turns on if solar generation is exceeding consumption for the rest of the house?
Wish I thought of this during the Vic lockdowns! (is when I started with HA)
Thanks

How did you integrate to HomeKit?

Juste export the sensor in the HomeKit config.

It will just show up

I have included everything in the Climate domain in my Homekit configuration, so the Pool Thermostat came up automatically.

If you haven’t got HomeKit integrated to HomeAssistant, you need the Homekit Bridge: HomeKit Bridge - Home Assistant

Has someone makde a light template for the pool light?

I’ve made a switch to turn it on/off and an input_select to change the colour. But not something that look&feel like your usual light settings.

Would be nice if someone did already, if not I’ll wrap something.

Sorry it has been a while since you posted this - but only just saw it! Although I have a d1 mini connected to my system as described much earlier in this thread I don’t bother using it now. Instead I have the following in my ‘switches.yaml’ file:

  - platform: template
    switches:
      pool_fave_filter:
        value_template: "{{ is_state('sensor.pool1_active_favourite', '2') }}"
        friendly_name: Pool Favourite Filter only
        turn_on:
         - service: rest_command.poolaction
           data: 
             action_code: 8 # Set favourite
             device_number: 2 # Filter only= 2, filter and heat pump = 3, all off = 128, all auto = 129, none = 255 - find using api test utility downloaded from connectmypool
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status
        turn_off:
         - service: rest_command.poolaction
           data: 
             action_code: 8
             device_number: 255
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status
      pool_fave_filterheat:
        value_template: "{{ is_state('sensor.pool1_active_favourite', '3') }}"
        friendly_name: Pool Favourite Filter and Heatpump
        turn_on:
         - service: rest_command.poolaction
           data: 
             action_code: 8
             device_number: 3 
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status
        turn_off:
         - service: rest_command.poolaction
           data: 
             action_code: 8
             device_number: 255
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status
      pool_fave_allauto:
        value_template: "{{ is_state('sensor.pool1_active_favourite', '129') }}"
        friendly_name: Pool Favourite All Auto
        turn_on:
         - service: rest_command.poolaction
           data: 
             action_code: 8
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status
        turn_off:
         - service: rest_command.poolaction
           data: 
             action_code: 8
             device_number: 255
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status
      pool_fave_alloff:
        value_template: "{{ is_state('sensor.pool1_active_favourite', '128') }}"
        friendly_name: Pool Favourite All Off
        turn_on:
         - service: rest_command.poolaction
           data: 
             action_code: 8 
             device_number: 128 
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status
        turn_off:
         - service: rest_command.poolaction
           data: 
             action_code: 8
             device_number: 255
         - delay: 2
         - service: homeassistant.update_entity
           entity_id: sensor.pool_status

I have basically setup the favourites as follows:

  • “Filter Only” that has everything off except for the filter pump on medium. For me, using the api tool from connectmypool, this resolves to device number 2
  • “Filter and Heatpump” that has the filter AND my electric heat pump on. For me, this resolves to device number 3.

In addition to those there is the “All Auto” (device 129), “All Off” (device 128). There is also a “none” which is device 255. It seems you can use either 128 or 255 to turn everything off.

With these switches, rather than having to cycle through the settings I can jump straight to what I need. For example, I have an automation that turns on the filter & heat pump (by selecting “Filter and Heatpump”) and sets the target water temp to 26 when my solar panels are generating more than 4kW.

alias: Pool - turn on heat pump if solar > 4kW
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.symo_15_0_3_m_1_ac_power
    for:
      hours: 0
      minutes: 20
      seconds: 0
    above: 4000
condition:
  - condition: state
    entity_id: sensor.pool1_heaters1_mode
    state: "Off"
action:
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_fave_filterheat
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: 26
    target:
      entity_id: climate.pool_electric_heater_thermostat
  - data:
      title: Pool - Solar greater than 4kW so turning on heatpump! 🌊🏊
      message: |
        Pool - Solar greater than 4kW so turning on heatpump! 🌊🏊
        The pool is currently: {{states('sensor.pool1_temperature') }}
    action: persistent_notification.create
  - data:
      message: Pool - Solar greater than 4kW so turning on heatpump! 🌊🏊
      title: Pool - Solar greater than 4kW so turning on heatpump! 🌊🏊
    action: notify.mobile_app_google_pixel_watch
  - metadata: {}
    data:
      message: >-
        Pool - Solar greater than 4kW so turning on heatpump! Water temp is
        currently {{states('sensor.pool1_temperature')}} 🌊🏊
      title: Pool - Solar greater than 4kW so turning on heatpump! 🌊🏊
      target: [email protected] <- change this
    action: notify.test_gmail_com <- change this
mode: single

I also have another automation that, when the solar generation drops to below 3.5kW it turns off the heater but leaves the filter pump running (by selecting “Filter Only”) then ten mins later (the delay is important - if you turn off the heater AND filter pump at the same time, you risk damaging your water pipes by causing a vacuum as the water cools) it switches the system to “All Auto”

alias: Pool - turn off heater if Solar < 3.5kW
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.symo_15_0_3_m_1_ac_power
    for:
      hours: 0
      minutes: 20
      seconds: 0
    below: 3500
condition:
  - condition: state
    entity_id: sensor.pool1_heaters1_mode
    state: "On"
action:
  - action: switch.turn_on
    target:
      entity_id: switch.pool_fave_filter
    data: {}
  - delay:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_fave_allauto
  - data:
      title: Pool - Solar less than 3.5kW so turning off heatpump! 🌊🏊
      message: >
        Pool - Solar less than 3.5kW so turning off heatpump and switching to
        auto! Note that need to keep filter running for at least 5 mins after
        switching off heater So will turn off heater, but keep filter running on
        medium for ten mins Then will change to 'auto' The pool is currently:
        {{states('sensor.pool1_temperature') }}
    action: persistent_notification.create
  - data:
      message: Pool - Solar less than 3.5kW so turning off heatpump! 🌊🏊
      title: Pool - Solar less than 3.5kW so turning off heatpump! 🌊🏊
    action: notify.mobile_app_google_pixel_watch
  - metadata: {}
    data:
      message: >-
        Pool - Solar less than 3.5kW so turning off heatpump! Water temp is
        currently {{states('sensor.pool1_temperature')}} 🌊🏊
      title: Pool - Solar less than 3.5kW so turning off heatpump! 🌊🏊
      target: [email protected] <- change this
    action: notify.test_gmail_com <- change this
mode: single

I have put a delay between when the solar trigger (high or low) is seen and when the automations start, to try to minimise ‘flapping’. FWIW We have a gas water heater as well - so basically combined with a pool blanket we can keep the pool water temp close to 26 most of the time mainly using solar so it’s free (well I am losing a little bit by not feeding it back into the grid, but the amount we get paid for that is minimal so no huge loss), which is on the cold side of acceptable for general swimming. If people want it hotter, we can manually use the gas to quickly bump the temperature up as required pretty quickly.

Word to the wise - I noted above:

Ask me how I know. OK, I’ll tell you. If you turn the heater off using the control panel, the system automatically prompts you to say the pump should be left running to avoid damage. If you continue, it will keep the pump running for a few minutes after turning off the heater unless you choose to shut everything off immediately (perhaps because of an emergency such as a water leak).

We discovered that the system did NOT provide that automatic cool down feature if you used the remote control. Astral were not aware of this either, and initially did not believe me when I told them that the remote immediately turned everything off without the safety delay. But basically one day we found that one of the water pipes had collapsed into itself and needed to be replaced. This was a month or two after we installed the second (gas) heater so perhaps because the gas heats the water much more than the electric heat pump the risk of damage is higher. Don’t know. Anyhow, Astral were able to confirm what I told them so they told me that - at least from now on - they were going to warn people about this issue but personally after that I just hid the remote.

I discovered all this before I worked out how to actually control the pool infrastructure via the api, before you ask, but that is why I thought I should mention it being important to keep the filter pump running for a few minutes (I’d suggest 10 minutes) after turning off the heater…