I'm looking for some help since my Python skills are close to zero.
I, with hopefully some help on this forum, would like to build a logic module to read the values of my pool controller. I can build a basic logic module but I have no knowledge of integrating Python scripting into the module.
Login into the vista pool website requires user/password which isn't easy to do into the address
I've found a python script in another forum that is able to log in and parse the data.
https://community.home-assistant.io/...gration/128695
Basically this is the script written by "Uspino". Thank you for posting.
Can someone integrate this into a logic module or give me some guidance?
#!/usr/bin/env python
# coding: utf-8
# In[ ]: import requests
# Fill in your details here to be posted to the login form.
payload = { 'user': ‘your@email.address’, 'pass': ‘yourpassword’, 'remember_password': '0', 'entrar': 'Enter' }
# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
p = s.post('http://vistapool.es/en/login/login', data=payload)
# An authorised request.
r = s.get('http://vistapool.es/en/pool/getmainvalues?id=1234’) print(r.text)
The above script he saved as vista.py .
He then created a command-line to execute the script every x time.
This is the script
- platform: command_line
name: Pool
scan_interval: 600
command_timeout: 30
json_attributes:
- filtration_stat
- PH
- RX
command: "python3 /config/www/vistapool/vista.py"
value_template: '{{ value_json.temp | replace("º","") | replace("C","") }}'
unit_of_measurement: '°C'
- platform: template
sensors:
phlevel:
friendly_name: pH Level
value_template: '{{ states.sensor.pool.attributes.PH }}'
filtrationstatus:
friendly_name: Filtration Status
value_template: '{{ states.sensor.pool.attributes.filtration_stat }}'
rxlevel:
friendly_name: RX Level
value_template: '{{ states.sensor.pool.attributes.RX }}'
I, with hopefully some help on this forum, would like to build a logic module to read the values of my pool controller. I can build a basic logic module but I have no knowledge of integrating Python scripting into the module.
Login into the vista pool website requires user/password which isn't easy to do into the address

I've found a python script in another forum that is able to log in and parse the data.
https://community.home-assistant.io/...gration/128695
Basically this is the script written by "Uspino". Thank you for posting.
Can someone integrate this into a logic module or give me some guidance?
#!/usr/bin/env python
# coding: utf-8
# In[ ]: import requests
# Fill in your details here to be posted to the login form.
payload = { 'user': ‘your@email.address’, 'pass': ‘yourpassword’, 'remember_password': '0', 'entrar': 'Enter' }
# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
p = s.post('http://vistapool.es/en/login/login', data=payload)
# An authorised request.
r = s.get('http://vistapool.es/en/pool/getmainvalues?id=1234’) print(r.text)
The above script he saved as vista.py .
He then created a command-line to execute the script every x time.
This is the script
- platform: command_line
name: Pool
scan_interval: 600
command_timeout: 30
json_attributes:
- filtration_stat
- PH
- RX
command: "python3 /config/www/vistapool/vista.py"
value_template: '{{ value_json.temp | replace("º","") | replace("C","") }}'
unit_of_measurement: '°C'
- platform: template
sensors:
phlevel:
friendly_name: pH Level
value_template: '{{ states.sensor.pool.attributes.PH }}'
filtrationstatus:
friendly_name: Filtration Status
value_template: '{{ states.sensor.pool.attributes.filtration_stat }}'
rxlevel:
friendly_name: RX Level
value_template: '{{ states.sensor.pool.attributes.RX }}'
Kommentar