This code runs a barebones Home Assistant integration with a Balboa Spa and a Elfin-EW11A-0 from Hi-Flying Technology WiFi-Serial adapter installed according to the instructions here:
https://github.com/jshank/bwalink
To expand the code and add more features, this site is very useful.
https://github.com/ccutrer/balboa_worldwide_app/wiki
I wrote this code, because I couldn't find an integration to run on Home Assistant that has been installed on a Raspberry Pi with the standard install. Other repositories seem to need separate docker containers or Ruby and I couldn't figure out how to run these with my installation. Some of the integrations I tried wouldn't initialise properly (perhaps because I wasn't using the Balboa branded WiFi adapter). I could control the spa through the command line, but ran into issues automating piped commands in Home Assistant. When ChatGPT came out I wondered if I could use it to write an integration in Python. I have no Python training so it has been a steep learning curve, but I'm amazed ChatGPT 4.0 has helped me get something that works.
The integration creates a platform that has attributes for all the fields in the Spa Status Message. This gets updated every 30 seconds, so is a bit laggy. It also provides the ability to make service calls to change the temperature of the spa and update the time.
-
Make a directory called spa_pool in custom_components
-
Copy all the files as named into the spa_pool directory
-
Restart Home Assistant (If you don't do this before changing your configuration.yaml, home assistant will throw an error).
-
Find IP address of WiFi adapter from your router and port it is broadcasting from by logging into serial adapter from a browser window.
-
In configuration.yaml (replace with your IP and port)
spa_pool: ip: 192.168.0.100 port: 4257 automation: !include automations.yaml sensor: !include sensor.yaml input_number: !include input_number.yaml
- In sensor.yaml
- platform: spa_pool
Restart Home Assistant to see if an entity called sensor.spa_pool_rs_485_sensor is created.
- In automations.yaml
- id: 'any_unique_number' alias: Spa_set_temp description: '' trigger: - platform: state entity_id: - input_number.spa_set_temp for: hours: 0 minutes: 0 seconds: 2 condition: [] action: - service: spa_pool.send_set_temp_command data: set_temp: '{{ states(''input_number.spa_set_temp'') }}' mode: single - id: 'any_unique_number' alias: Initialise Spa Set Temp description: '' trigger: - platform: state entity_id: - sensor.spa_pool_rs_485_sensor attribute: set_temperature for: hours: 0 minutes: 1 seconds: 0 condition: [] action: - service: automation.turn_off data: stop_actions: true target: entity_id: automation.spa_set_temp - service: input_number.set_value data: value: '{{ state_attr(''sensor.spa_pool_rs_485_sensor'', ''set_temperature'') }}' target: entity_id: input_number.spa_set_temp - service: automation.turn_on data: {} target: entity_id: automation.spa_set_temp mode: single
- In input_number.yaml
spa_set_temp: name: Spa Set Temp Control min: 26.5 max: 40 step: 0.5
-
Restart Home Assistant if needed to load in all the new yaml
-
In Lovelace make a manual card with the following yaml
type: vertical-stack cards: - square: false type: grid title: Spa Sensors cards: - type: entity entity: sensor.spa_pool_rs_485_sensor name: State state_color: false unit: ' ' - type: entity entity: sensor.spa_pool_rs_485_sensor attribute: set_temperature name: Set unit: oC state_color: false - type: entity entity: sensor.spa_pool_rs_485_sensor attribute: spa_time name: Time state_color: false - type: entity entity: sensor.spa_pool_rs_485_sensor attribute: heating_state name: Heating - type: entity entity: sensor.spa_pool_rs_485_sensor attribute: current_temperature name: Current unit: oC state_color: false - type: entity entity: sensor.spa_pool_rs_485_sensor attribute: reminder_type state_color: false name: Reminder - type: entities entities: - entity: input_number.spa_set_temp title: Set Spa Temp - ~30s to update
![Screen Shot 2023-06-03 at 5 06 30 pm](https://private-user-images.githubusercontent.com/54464040/243064792-bc076331-fa24-4a14-9027-010a596627bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzAxMDUsIm5iZiI6MTczOTU2OTgwNSwicGF0aCI6Ii81NDQ2NDA0MC8yNDMwNjQ3OTItYmMwNzYzMzEtZmEyNC00YTE0LTkwMjctMDEwYTU5NjYyN2JmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDIxNTAwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMzNjU4NTU2MTJjMGY3NzRmMTU1N2Q1N2ExMzVlNWRmODg2ZjAxOTc3M2VmNTQ0OWI3MWVmNTU1MmJmODU4YzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.sIVSKO_75IU33uElM6YbYooBOaPDBm6JTsu9O8Ay8vs)
-
To change the temperature just manipulate the slider. The Set Temperature changes instantly, but the sensor will take around 30s to update.
-
In automations you can use this format to set the temperature or update the time:
action: - service: spa_pool.send_set_temp_command data: set_temp: 35 - service: spa_pool.send_time_command data: {}
Good luck!