Hayward AquaLogic / ProLogic automation

I’m not sure why it was working better before, but it’s very timing sensitive. It needs to wait until it sees a keepalive and then it has a short window to send the key press. If it doesn’t make it in time, it’s discarded. There was code in the original implementation that would do retries if the state didn’t change.

Using the script on the EW11 gets it much closer to the serial connection and doesn’t have the network latency to worry about.

I just updated my repository with my latest changes. I made it configurable and it’s not p4 or EW11 specific anymore (though I think the EW11 is the way to go). I also renamed it so that it’s not an override of the built-in aqualogic integration. Some people were having issues with old code being used, so this should remove that issue.

See the readme for information.

1 Like

That’s amazing! Thank you so much for this contribution. If I understand properly, you added some checks to ensure that your code could be used with hardware supporting scripting or not. That means that I could be using your code with my USR-TCP232-304 using this configuration :

aqualogic_p4p8:
  host: 192.168.2.56    #Set to HostName, IP Address, or Serial path
  port: 4328            #Set port if using a network device
  device: serial        #Set to socket or serial
  usescript: False      #Set to False if not using script on a network device
  p4p8: p4              #Set to p4 or p8

And only have to change the configuration the following with the EW11:

aqualogic_p4p8:
  host: 192.168.2.XYZ   #Set to HostName, IP Address, or Serial path
  port: 4328            #Set port if using a network device
  device: socket        #Set to socket or serial
  usescript: True       #Set to False if not using script on a network device
  p4p8: p4              #Set to p4 or p8

Thank you!

Correct, but you would use socket for both. serial is for installs that are using a serial device and not a network device.

If you had installed a previous version of my code, when you install this version it will duplicate the entities because I changed the name and domain.

You can just delete the old entities (they should show as unused) or if you want to prevent the duplicates do this:

  1. Comment out or remove the aqualogic, sensor and switches YAML in your configuration.YAML.
  2. Restart HA
  3. Go to entities and remove all the aqualogic entities.
  4. Enable the new aqualogic_p4p8, sensor and switches YAML in configuration.YAML
  5. Restart HA. The entities will be recreated.

John

Hi John, thanks for sharing your contribution via github!
I added your integration to my HA and the delay script to my EW11. I am getting data from the prologic but still no joy when it comes to button presses. Similar to what @ronkmd reported in an earlier post. I am successfully able to control it via the iOS app, so I believe the EW11 script is working.

I am not sure whether I missed anything to get it working in HA?
Thanks in advance for any suggestions.

PS, Hi @b3nj1 and thank you for replying to a question I posted over a year ago! I had tried getting this integration to work back then, but it seemed to go nowhere. I wasn’t notified when you replied.

Are there any errors in the log? If you can control via Mark’s iOS app, then my version of the HA integration should work. Can you post your configuration.yaml for aqualogic_p4p8?

Do you have a p4 or a ps-8?

Hi John, thanks for the reply!

It’s a p4. Here are the entries for the aqualogic in my configuration.yaml

aqualogic_p4p8:
  host: 10.0.1.64
  port: 8899
  device: socket
  usescript: True
  p4p8: p4

switch:
  - platform: aqualogic_p4p8
    monitored_conditions:
    - lights
    - filter
    - aux_1
    - aux_2
    - aux_3
    - aux_4
    - aux_5
    - aux_6
    - aux_7
    - left
    - right
    - menu
    - minus
    - plus

The sensors are in the sensors.yaml file

- platform: aqualogic_p4p8
  monitored_conditions:
    - pool_temp
    - air_temp
    - pump_speed
    - status
    - pump_power
    - salt_level
    - pool_chlorinator
    - display
    - is_heater_enabled

I just noticed this in the logs

2024-05-31 11:13:35.017 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration aqualogic_p4p8 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-05-31 11:13:36.031 DEBUG (SyncWorker_8) [custom_components.aqualogic_p4p8] AquaLogicProcessor initialized
2024-05-31 11:13:52.627 DEBUG (SyncWorker_8) [custom_components.aqualogic_p4p8] Event processing thread started
2024-05-31 11:13:52.640 INFO (Thread-2) [custom_components.aqualogic_p4p8.core] Connected to 10.0.1.64:8899
2024-05-31 11:13:53.479 DEBUG (Thread-2) [custom_components.aqualogic_p4p8.core] 1135981.977: Unknown frame: b'0d01' b'0000'
2024-05-31 11:13:53.486 DEBUG (Thread-2) [custom_components.aqualogic_p4p8.core] 1135981.989: Unknown frame: b'000d' b'000010550600'
2024-05-31 11:13:53.648 DEBUG (Thread-2) [custom_components.aqualogic_p4p8.core] 1135982.087: Display update: ['pH', '8.0', 'ORP', '655', 'mV', '\x00']
2024-05-31 11:13:53.704 DEBUG (Thread-2) [custom_components.aqualogic_p4p8.core] 1135982.205: Display update: ['pH', '8.0', 'ORP', '655', 'mV', '\x00']
2024-05-31 11:13:54.498 DEBUG (Thread-2) [custom_components.aqualogic_p4p8.core] 1135982.966: Pump speed request: 65%
2024-05-31 11:13:54.564 DEBUG (Thread-2) [custom_components.aqualogic_p4p8.core] 1135983.014; Pump speed: 65%, power: 571 watts
2024-05-31 11:13:54.785 ERROR (Thread-2) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/aqualogic_p4p8/__init__.py", line 120, in run
    panel.process(self.data_changed, self._usescript, self._p4p8)
  File "/config/custom_components/aqualogic_p4p8/core.py", line 308, in process
    text = frame.replace(b'\xdf', b'\xc2\xb0').decode('utf-8')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 29: invalid start byte

Any suggestions?

Edit core.py and change line 308 to:

text = frame.replace(b'\xdf', b'\xc2\xb0').decode('latin-1')

I’m not sure why, but utf-8 isn’t working for some, so changing it to latin-1 seems to work.

Thank you for that fix John. Seems to have removed the log error. And the display in the dashboard seems to be updating nicely now with info from the panel.

I’ve pasted some logs. Included are my attempts at sending the command to the lights switch and one command to the filter switch, neither of which seem to be responded to by the prologic panel. What’s worse there isn’t even an error message to investigate. :pensive:

Care to have a look to see if you spot anything strange?

aqualogic_p4p8

It looks like you did 9 keys in your log. They look OK to me.

10 02 00 02    02 00    02 00 00 18 10 03 – MENU
10 02 00 02    02 00    02 00 00 18 10 03 – MENU
10 02 00 02    01 00    01 00 00 16 10 03 – RIGHT
10 02 00 02    01 00    01 00 00 16 10 03 – RIGHT
10 02 00 02    01 00    01 00 00 16 10 03 – RIGHT
10 02 00 02    00 01    00 01 00 16 10 03 – LIGHT
10 02 00 02    04 00    04 00 00 1c 10 03 – LEFT
10 02 00 02    00 01    00 01 00 16 10 03 – LIGHT
10 02 00 02    80 00    80 00 01 14 10 03 – FILTER

Is the iOS app still working OK?

Yes the iOS app is working without a hitch. Light turns on/off at each press.

Can I assume that if the iOS app is working, then the EW11 delay script is correctly functioning on the EW11 device?

I think that’s a safe assumption. It’s very unlikely that the mobile app would work with key presses without the script.

I’m not sure what else could be wrong. Your config looks ok and the logs show it’s sending keys.

You can try Mark’s version. Our code is very similar though, so I’d be interested if his works.

https://www.troublefreepool.com/threads/aql-ps-8-remote-emulator-app.244915/post-2573692

@J4yDubs , @Sierra I finally received my EW11A and I’m trying to hook it up properly however I am not able to see the EW11 SSID. I’ve followed the setup page (AQL-PS-8 & EW11 Setup Instructions - Google Docs) and reversed my configuration to make sure I was wiring things in the right order. Here’s my current setup:



It seems like my EW11A is receiving power because the green ethernet LED is on.

Am I missing anything?

Thanks!

False alarm, @J4yDubs & @Sierra , turns out it wasn’t wired properly… Here’s the correct way of wiring it for future DIYers :stuck_out_tongue:



Just saw your latest reply. Glad you got it working.

Are you having this working on HA with button press? I’m seeing EW11 Script v006 HA Mod.txt and EW11 Script v007.txt, which one should I use, and also, would that be compatible with what we talked about last week (your implementation for aqualogic_p4p8)?
Thanks!

I have “EW11 Script v006.txt” on the github repository. That’s what I used, but the 007 should work as well. When you import it, you won’t see it loaded. If you do a export, you can then see if the export is what you imported.

Yes, all button presses work for me, even all the menus and settings changes. There’s a quick video in my repository showing going through menus and making a settings change.

Are the button presses not working for you? Have you downloaded one of Mark’s apps to make sure it’s working with those?

I can confirm that the script was uploaded properly, however I cannot connect through it from HA or Mark’s app. :frowning:

Try switching the white and black wires on the EW11 (it’s the two TX/RX lines).

Well, finally got it working. Deleted all my Aqualogic folders and references. Got display, sensors and switch state reporting working fine but still couldn’t activate switches. Then I changed the line in core.py to “text = frame.replace(b’\xdf’, b’\xc2\xb0’).decode(‘latin-1’)” and THE SWITCHES WORKED!

Now the only thing is my Temperature display is messed up, The space between the digits and the degree sign is displaying as some weird capital-A with a caret over it. Any ideas.