Vistapool Integration

I’d try a clean install of another VM instance and see if that works…

When I type your path, I get this:

Logger: homeassistant.components.command_line.sensor
Source: components/command_line/sensor.py:101
Integration: command_line ([documentation](https://www.home-assistant.io/integrations/command_line), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+command_line%22))
First occurred: 13:23:32 (1 occurrences)
Last logged: 13:23:32

Command failed: python3 /home/homeassistant/.homeassistant/config/python_scripts/vista.py

When I input my path, I get no error like above, though I have “empty JSON data”.

Do you have python_script folder under config?

Sure.
I have python_scripts folder under config
and I have
python_script:
in my configuration.yaml

@kajmaj
You mentioned that you installed via python_exec a library reuqests.
Maybe the origin of my issue

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 196, in execute
    exec(compiled.code, restricted_globals)
  File "vista.py", line 6, in <module>
ImportError: __import__ not found

lies within the problem of library installation?
How did you install this lib in Hassio?

Regarding library I cannot remember, sorry :woozy_face:

Nonetheless Command failed: .... I have as well at the moment, it is related to the switched off VistaPool wifi module (winterized swimming pool)
I can verify it once it is full and running again.

I excluded everything except this in configuration.yaml:

  - platform: command_line
    name: Aquascenic
    scan_interval: 600
    command_timeout: 30
    command: "python3 /config/python_scripts/vista.py"
    value_template: '{{ value_json.temp }}'

Now my Sensor with the name ‘Aquascenic’ shows ‘Unknown’ figure.
Regardless of what parameter I mention (RX,PH, whatever)…
It means it can’t parse JSON correctly?

But JSON is correct in case I utilize ‘file’ platform.
Strange…

Finally it works!
I was using wrong output in vista.py.
Now JSON is working correctly.
Thanks everybody for endowment!

I’ve created a plugin for this compatible with HACS. Try it out! https://github.com/tellerbop/havistapool

If anybody is interested, Vistapool Hidrolife is possible to control directly through MODBUS/TCP IP converter ( I use this one ) or it can be any other available, so there is no need of Vistapool cloud anymore :slight_smile:

My working config file is below.

#---------------------------------------------------#
#   HIDROLIFE control via MODBUS (no cloud)         #
#---------------------------------------------------#

input_boolean:
  modbus:
  filtrace_mb_auto:
  cycle1_on:
  cycle2_on:
  cycle3_on:

sensor:

  - platform: modbus
    registers:
    - name: MBF_MEASURE_PH #  pH mb 
      hub: bazen
      slave: 1
      register: 258
      register_type: holding
      data_type: uint
      scale: 0.01
      precision: 1
    - name: MBF_PAR_PH1 #-  horni hranice pH
      hub: bazen
      slave: 1
      register: 1284
      register_type: holding
      data_type: uint
      scale: 0.01
      precision: 1
    - name: MBF_PAR_PH2  #   dolni hranice pH
      hub: bazen
      slave: 1
      register: 1285
      register_type: holding
      data_type: uint
      scale: 0.01
      precision: 1
    - name: MBF_MEASURE_TEMPERATURE # MBF_MEASURE_TEMPERATURE
      hub: bazen
      slave: 1
      register: 262
      register_type: holding
      data_type: uint
      unit_of_measurement: °C
      scale: 0.1
      precision: 1
    - name: MBF_PH_STATUS # MBF_PH_STATUS - AL3, stav pH, peristaltika 
      hub: bazen
      slave: 1
      register: 263
      register_type: holding
      data_type: uint
    - name: MBF_PAR_FILTRATION_STATE # MBF_PAR_FILTRATION_STATE /-READ ONLY / stav filtrace zap/vyp
      hub: bazen
      slave: 1
      register: 1057
      register_type: holding
      data_type: uint
    - name: MBF_PAR_FILT_MANUAL_STATE # MBF_PAR_FILT_MANUAL_STATE-stav filtrace zap/vyp
      hub: bazen
      slave: 1
      register: 1043
      register_type: holding
      data_type: uint
    - name: MBF_PAR_HEATING_TEMP # MBF_PAR_HEATING_TEMP cilova teplota vody pro vyhrivani
      hub: bazen
      slave: 1
      register: 1046
      register_type: holding
      data_type: uint
      unit_of_measurement: °C
    - name: MBF_PAR_FILT_MODE #  režim filtrace
      hub: bazen
      slave: 1
      register: 1041
      register_type: holding
      data_type: uint
    - name: MBF_RELAY_STATE # MBF_RELAY_STATE stav jednotlivych rele
      hub: bazen
      slave: 1
      register: 270
      register_type: holding
      data_type: uint

      
  - platform: template
    sensors:
      rezim_filtrace:
        friendly_name: "Režim filtrace"
        value_template: >-
          {% if is_state('sensor.MBF_PAR_FILT_MODE', '0' ) %}
              Manual
          {% elif is_state('sensor.MBF_PAR_FILT_MODE', '1' ) %}
              Auto
          {% elif is_state('sensor.MBF_PAR_FILT_MODE', '2' ) %}
              Topeni
          {% elif is_state('sensor.MBF_PAR_FILT_MODE', '3' ) %}
              Smart
          {% elif is_state('sensor.MBF_PAR_FILT_MODE', '4' ) %}
              Intelligent
          {% else %}
              ???
          {% endif %}
          
      peristaltika:
        friendly_name: "Peristaltika mb"
        value_template: "{{ states('sensor.MBF_RELAY_STATE')|int // 1 % 2 }}"
      filtrace:
        friendly_name: "Filtrace mb"
        value_template: "{{ states('sensor.MBF_RELAY_STATE')|int // 2 % 2 }}"
      ohrev:
        friendly_name: "Ohrev mb"
        value_template: "{{ states('sensor.MBF_RELAY_STATE')|int // 64 % 2 }}"

      stav_ph_1:
        friendly_name: "stav ph 1"
        value_template: "{{ states('sensor.MBF_PH_STATUS')|int // 1 % 2 * 1 }}"
      stav_ph_2:
        friendly_name: "stav ph 2"
        value_template: "{{ states('sensor.MBF_PH_STATUS')|int // 2 % 2 * 2}}"
      stav_ph_3:
        friendly_name: "stav ph 3"
        value_template: "{{ states('sensor.MBF_PH_STATUS')|int // 4 % 2 * 4}}"
      ph1_ph2:
        value_template: "{{ states('sensor.stav_ph_1')|int + states('sensor.stav_ph_2')|int + states('sensor.stav_ph_3')|int }}"
      stav_ph:
        friendly_name: "Stav ph"
        value_template: >-
          {% if is_state('sensor.ph1_ph2', '0' ) %}
              OK
          {% elif is_state('sensor.ph1_ph2', '1' ) %}
              vysoké
          {% elif is_state('sensor.ph1_ph2', '2' ) %}
              nízké
          {% elif is_state('sensor.ph1_ph2', '3' ) %}
              AL3
          {% elif is_state('sensor.ph1_ph2', '4' ) %}
              vyšší
          {% elif is_state('sensor.ph1_ph2', '5' ) %}
              nižší
           {% else %}
              ???
          {% endif %}

      filtrace_mb_num:
        friendly_name: “Filtrace zap-vyp”
        value_template: >
          {% if is_state('input_boolean.filtrace_mb_auto', 'on') %} 1 {% else %} 0 {% endif %}
          
      tepelne_cerpadlo_mb_num:
        friendly_name: “Tepelne cerpadlo zap-vyp”
        value_template: >
          {% if is_state('input_boolean.filtrace_mb_auto', 'on') %} 3 {% else %} 4 {% endif %}

      timer_1_mb:
        value_template: "{{ states('input_select.cycle1_time') }}"
      timer_2_mb:
        value_template: "{{ states('input_select.cycle2_time') }}"
      timer_3_mb:
        value_template: "{{ states('input_select.cycle3_time') }}"
      delay_1_mb:
        value_template: "{{ states('input_select.cycle1_duration') | int * 60  }}"
      delay_2_mb:
        value_template: "{{ states('input_select.cycle2_duration') | int * 60 }}"
      delay_3_mb:
        value_template: "{{ states('input_select.cycle3_duration') | int * 60 }}"

      mb_teplota_vody:
        value_template: "{{states('sensor.MBF_MEASURE_TEMPERATURE') | round(1)}}"


binary_sensor:
  - platform: template
    sensors:
      peristaltika:
        friendly_name: "Peristaltika mb"
        value_template: "{{ states('sensor.MBF_RELAY_STATE')|int // 1 % 2 == 1}}"
      filtrace:
        friendly_name: "Filtrace mb"
        value_template: "{{ states('sensor.MBF_PAR_FILTRATION_STATE')|int == 1 }}"
      ohrev:
        friendly_name: "Ohrev mb"
        value_template: "{{ states('sensor.MBF_RELAY_STATE')|int // 64 % 2 == 1 }}"
      filtrace_mb_auto:
        value_template: "{{ is_state('input_boolean.filtrace_mb_auto', 'on') }}"
        
input_select:
  cycle1_time:
    name: Cyklus 1 - začátek
    options:
      - '05:00'
      - '06:00'
      - '07:00'
      - '07:30'
      - '08:00'
      - '09:00'
      - '10:00'
  cycle2_time:
    name: Cyklus 2 - začátek
    options:
      - '11:00'
      - '12:00'
      - '13:00'
      - '14:00'
      - '15:00'
  cycle3_time:
    name: Cyklus 3 - začátek
    options:
      - '16:00'
      - '17:00'
      - '18:00'
      - '19:00'
      - '20:00'
  cycle1_duration:
    name: Cyklus 1 - trvání
    options:
      - '1'
      - '2'
      - '3'
      - '4'
      
  cycle2_duration:
    name: Cyklus 2 - trvání
    options:
      - '1'
      - '2'
      - '3'
      - '4'
  cycle3_duration:
    name: Cyklus 3 - tvání
    options:
      - '1'
      - '2'
      - '3'
      - '4'


automation:
- alias: Fitration - run_cycle_1
  initial_state: 'on'
  trigger:
  - platform: template
    value_template: >
      {{ states('sensor.time') == states('sensor.timer_1_mb') }}
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: input_boolean.bazen
      state: 'on' 
    - condition: state
      entity_id: input_boolean.cycle1_on
      state: 'on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.filtrace_mb_auto

    - service: script.run_a_cycle_mb
      data_template:
        cycle: '1'

- alias: Fitration - run_cycle_2
  initial_state: 'on'
  trigger:
  - platform: template
    value_template: >
      {{ states('sensor.time') == states('sensor.timer_2_mb') }}
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: input_boolean.bazen
      state: 'on' 
    - condition: state
      entity_id: input_boolean.cycle2_on
      state: 'on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.filtrace_mb_auto
    - service: script.run_a_cycle_mb
      data_template:
        cycle: '2'

- alias: Fitration - run_cycle_3
  initial_state: 'on'
  trigger:
  - platform: template
    value_template: >
      {{ states('sensor.time') == states('sensor.timer_3_mb') }}
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: input_boolean.bazen
      state: 'on' 
    - condition: state
      entity_id: input_boolean.cycle3_on
      state: 'on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.filtrace_mb_auto
    - service: script.run_a_cycle_mb
      data_template:
        cycle: '3'

#-----------------------------
# Ovladani filtrace pres MODBUS
#-----------------------------

script:
  heating_mb_toggle:
    sequence:
    - service: modbus.write_register
      data:
        hub: bazen
        unit: 1
        address: <s>1152</s>      1252 *      
        value: [16384]
    - service: modbus.write_register
      data:
         hub: bazen
         unit: 1
         address: 1241
      data_template:
        value: ["{{states('sensor.tepelne_cerpadlo_mb_num') | int}}"]
    - service: modbus.write_register
      data:
        hub: bazen
        unit: 1
        address: 752
        value: [1]
    - delay: 00:00:01
    - service: modbus.write_register
      data:
        hub: bazen
        unit: 1
        address: 757
        value: [1]
        
  filtration_mb_toggle:
    sequence:
    - service: modbus.write_register
      data:
        hub: bazen
        unit: 1
        address: 1041
        value: [0]
    - service: modbus.write_register
      data:
        hub: bazen
        unit: 1
        address: 1043
      data_template:
        value: ["{{states('sensor.filtrace_mb_num') | int}}"]
    - service: modbus.write_register
      data:
        hub: bazen
        unit: 1
        address: 752
        value: [1]
    - delay: 00:00:01
    - service: modbus.write_register
      data:
        hub: bazen
        unit: 1
        address: 757
        value: [1]

  run_a_cycle_mb:
    sequence:
      - service: homeassistant.turn_off
        data:
          enity_id: switch.filtration
      - service: script.filtration_mb_toggle
      - service: script.heating_mb_toggle
      - delay: 
           minutes: "{{states('sensor.delay_' + cycle + '_mb')}}"
      - service: input_boolean.turn_off
        data:
          entity_id: input_boolean.filtrace_mb_auto
      - delay: 00:00:01
      - service: script.heating_mb_toggle
      - delay: 00:00:03
      - service: script.filtration_mb_toggle
 
  stop_a_cycle_mb:
    sequence:
      - service: input_boolean.turn_off
        data:
          entity_id: input_boolean.filtrace_mb_auto
      - delay: 00:00:01
      - service: script.heating_mb_toggle
      - delay: 00:00:03
      - service: script.filtration_mb_toggle

WARNING: Testing on your own risk. Improper write (value, register) could cause that Hidrolife may be bricked or would require authorised repair.

*Corrected my typo >> register 1152 should be 1252

4 Likes

Vista Pool integration is now default repo in HACS. Try it out! :slight_smile:

To control you still have to use cloud i.e. VistaPool mobile app or their web UI.
I like to have it “off cloud”, that’s why I use modbus. Wifi module is not needed anymore in this case.

The plugin in prepared for actions to control pumps etc, please let me know what you want to be able to control and I’ll try to impleement that asap. That doesn’t help keeping it “off cloud” but it removes the requirement to use the app or their webUI.

I have it already solved as I described above (target was to cut off cloud)
But generally would be great to have ability to control essential stuff like timers, filtration, temperature and AUX relays are.

Ahoj, mohl by si mi prosím poslat kontakt. Rád bych s tebou probral možnost integrace Albixon Oxilife do Loxone. Děkuji

Hi kajmaj how did you manage to connect the hf2211 gateway to the hydrolysis equipment so that the internet tab would appear in the equipment menu and configure the hydrolysis equipment?
I have connected A + A- and B + B- and I have configured the module with modbus protocol, but I cannot get the internet menu after restarting the electrolysis.

Regards,

Hi jiiins,

Can you pass me the document that the Vista pool technicians sent you?

I am trying to connect the hf2211 to the Hidrolife team.

Regards.

Here: https://www.dropbox.com/s/jpj0ld8uskddrpq/MODBUS%20PARA%20CLIENTES%20(ENG).pdf?dl=0

Modbus description here
You must have in mind that in the document are register addresses in HEX and HA sensors work in DEC => conversion is needed.

!! I would like to stress:
Before you started to play with MODBUS control of Vistapool Hidrolife please read the bottom sentence of 50. There is not so much space for a try/error approach.

HF2211 is RS232/RS422/RS485 to Ethernet/Wi-Fi Convertor (let say a bridge between Hidrolife and, in our case, HomeAssistant)
HF2211 is in itś user guide.
You won´t see Hidrolife menu if connected, everything will be done via MODBUS sensors and MODBUS write.
To do some test reading, to understand data structure of MODBUS registers, you need any MODBUS SW (I use AVReporter Modbus Communication Tester).

If you go through my config in 50 there is my previous version of control. I did some updates later on if you are interested.

Thank you!!!