Vistapool Integration

How did you read the data via HASSIO modbus sensor? By using this I can’t get anything at all:

modbus:
  type: tcp #(or rtuovertcp, no difference)
  host: 192.168.10.159
  port: 23
  name: modbus_pool

and in sensors:

- platform: modbus
 scan_interval: 600
 registers:
   - name: pH
     slave: 5
     register: 0x0102
     hub: modbus_pool
   - name: free chlorine
     unit_of_measurement: ppm
     slave: 5
     register: 0x0104
     hub: modbus_pool
     scale: 0.01
     precision: 2

I used the same configuration as you.
You should have converter properly set and wired (A to A and B to B), are you sure about slave: 5 and port number?

Nonetheless for me obtained values had been different to the description from vistapool manual.

I’m connecting to the vistapool wifi adapter, and port 23 is the only one open. I can telnet into it and get a list of possible commands, but I can’t find any help on the syntax:

Versa Remote Console 2015
help
>>Syntax error
>>help

Command list
-------------
echo           : Inhibits/permits echo
wm             : Write memory
ww             : Write 1 word in int. memory
rm             : Read memory
rb             : Read 1 byte of int. memory
status         : Print system status
scan           : Scan for WIFI APs
nslookup       : Solve a name
ping           : Ping a machine
mbnode         : Modbus set node address
mbr            : Modbus read registers
mbw            : Modbus write registers
tick           : Shows system ticks
gws            : Sets gateway state
gwg            : Gets gateway state
gwr            : Reset gateway
gwps           : Print gateway variables
ni             : Node information
tmb            : Test modbus
frd            : Flash Read
ver            : Print software version
verbose        : Set verbose level
help           : Print help

I tried to read registers in any way but I always get this code 3:

mbr 0x0102
>>ERROR code 3

I assumed the slave number from the station number provided by the status command:

>>status
Station: 5
DHCP: 1
MAC: 18:fe:31:ad:59:71
IP:  192.168.10.159

Maybe you can get something out of this?

1 Like

You are trying to do it in a different way than I did.
What I understood so far is that Vistapool control unit (controling your pool environment) communicates with Vistapool cloud via MODBUS protocol using Wifi module ac communication device.
I used MODBUS serial converter, connected to the free MODBUS connector on the control unit board.

Do you see any way to grab data with those commands?

I wish I could tell.
Based on the purpose of wifi module it is mostlikely impossible to directly read data.
What do you want from it? Read data or full control?

Hi! How did you “install requests” via python_exec addon?
Can’t get mine to work.
Thank you!

When I SSH into Hassio and execute
python3 /config/www/vistapool/vista.py
I still get

Traceback (most recent call last):
  File "/config/www/vistapool/vista.py", line 6, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Requests were installed properly…

I run it via command_line sensor

  - platform: command_line
    name: Pool
    scan_interval: 600
    command_timeout: 30
    json_attributes:
      - filtration_stat
      - PH
    command: "python3 /home/homeassistant/.homeassistant/config/python_scripts/vista.py"
    value_template: '{{ value_json.temp | replace("º","") | replace("C","") }}'
    unit_of_measurement: '°C'

@kajmaj

Are you using Hassio?
Do you want to say that command_line sensor executes script normally while python_exec also fails to run it? (as my case)

Yep. I run Hassio and command_line sensor executes the script normally (in my case)

Are you using Hassio under Ubuntu?
Script is not working on Hassio under VM :frowning:

I run Home Assistant 0.107.7 on HassOS 3.12 on Raspberry Pi 3B

Working fine under VM here (Hyper-V)

Can you specify the full path to your script?

Mine is under “/config/www/vistapool/vista.py”
So my full script is

  - platform: command_line
    name: Pool
    scan_interval: 600
    command_timeout: 30
    json_attributes:
      - filtration_stat
      - PH
    command: "python3 /config/www/vistapool/vista.py"
    value_template: '{{ value_json.temp | replace("º","") | replace("C","") }}'
    unit_of_measurement: '°C'

But log returns no result and if I execute any other script from same directory with Python_exec, it runs fine, but this one that requires “import requests” doesn’t… What about your case, you run Hassio under VM and you can execute this script from SSH, Python_exec and see the output?
I read that scripts with importing components are not executable under Hassio unless you integrate Custom_component.

@SuperMaximus
Based on python_script is should be /config/python_scripts/vista.py

Same config here, but working fine…

Unfortunately, doesn’t work.

The log says:

Logger: homeassistant.components.command_line.sensor
Source: components/command_line/sensor.py:101
Integration: command_line (documentation, issues)
First occurred: 12:29:04 (1 occurrences)
Last logged: 12:29:04

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

Any other suggestion, guys? Maybe something is wrong with ‘requests’ lib installation?
What would you recommend to check?
Via file platform the algorithm works fine…

I copied exactly the same confir as in @uspino message above with same template.
Now I get no message about
Command failed: python3 /config/python_scripts/vista.py
But cannot see anything that script returns:

Logger: homeassistant.components.command_line.sensor
Source: components/command_line/sensor.py:120
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: 12:44:39 (1 occurrences)
Last logged: 12:44:39

Empty reply found when expecting JSON data

Logs output when I manually execute python_script via HA interface:

Logger: homeassistant.components.python_script.vista.py
Source: components/python_script/__init__.py:196
Integration: python_script ([documentation](https://www.home-assistant.io/integrations/python_script), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+python_script%22))
First occurred: 12:50:32 (2 occurrences)
Last logged: 12:50:49

Error executing script: __import__ not found

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

your not working command line: command: "python3 /config/www/vistapool/vista.py"

my working command line: command: "python3 /home/homeassistant/.homeassistant/config/python_scripts/vista.py"