swilson / aqualogic

A python library to interface with a Hayward/Goldline AquaLogic/ProLogic pool controller.
MIT License
40 stars 17 forks source link

Unable to set state values, protocol differences? #10

Closed mj-sakellaropoulos closed 3 years ago

mj-sakellaropoulos commented 3 years ago

First: thanks for this library!

The library is able to read most of the bus messages (Display updates, LED updates, local wired key, etc) but is unable to change the state of the panel either via CLI or HASS.

After some debugging, I am seeing some differences in the protocol: Wireless remote ("AquaPod") frame_type is 008c and not 0083 (?) Lights key is apparently 0010 (? does not match AQ-CO-SERIAL manual) local wired key event is 4 bytes instead of 2 (ex filter 8000000080000000) and followed by another transmission with the second key set to zero (maybe key release?) (ex filter 8000000000000000)

I changed the code locally to account for the different frame data, but it still does not work (requeues and fails eventually, sometime reports bad CRC). I can't figure out if somehow my transmission is just being ignored by the panel, if my wiring or RS485 converter is faulty or something else.

I am wondering if you have any ideas as to what is going wrong in this case, maybe there are some settings I missed in the RS485 web ui?

For a better description of the protocol differences here is my fork: https://github.com/mj-sakellaropoulos/aqualogic

My RS485 converter is from waveshare, but it's just a rebranded USRIOT one, same MAC vendor My Panel PCB is model G1-011049D-1T, it looks like this one : https://www.inyopools.com/Products/07501352046539.htm Main software revision is 4.10 I have the RS485 connected to the "remote display" screw terminal block

swilson commented 3 years ago

Since the packet reception is working ok your RS-485 adapter is probably fine. I've got an older board (GLX-PCB-MAIN) so I can't confirm the protocol differences. The transmission is a bit of a crap-shoot as the protocol requires precise timing (which isn't really possible without building some dedicated hardware). Some people have reported using the FRAME_TYPE_WIRELESS_KEY_EVENT works better for them. More info in this thread: https://community.home-assistant.io/t/hayward-aqualogic-prologic-automation/52340

mj-sakellaropoulos commented 3 years ago

People are reporting that transmitting many times eventually gets it working, but even that does not work for me. Somehow people using simple ESP8266 boards seem to be having better luck. I have the parts on order for that now. I have tried with both a short and a long RS485 cable and both fail. I can't see how the 8266 has less latency than the USRIOT but stranger things have happened...

mj-sakellaropoulos commented 3 years ago

Also, if the 8266 method becomes standard, we could move the Keypress buffer to be local to the 8266 and have it send them off after the keepalive to reduce latency.

Another method would be to use an RTL-SDR to communicate with the wireless remote receiver on 433MHz but that seems way harder than anything else

swilson commented 3 years ago

Not sure the 8266 method is a lot bettter. I have tried a FTDI RS-485 adapter direct from my PC and it wasn't much better than the USRIOT. Seems like bit-bashing is required since the wired remotes don't even seem to wait a full cycle to send the key after the keepalive.

Using an RTL-SDR is an interesting idea, but I don't have a wireless remote to experiment with.

dailow commented 3 years ago

@mj-sakellaropoulos I have the same board as you and seeing the same issue. Have you had any luck sending commands to your board?

mj-sakellaropoulos commented 3 years ago

@mj-sakellaropoulos I have the same board as you and seeing the same issue. Have you had any luck sending commands to your board?

Zero luck 🙁. I am going to try via a max485 and custom esp8266/micropython code this week.

I have to roll my own code since esp-link max485 support was broken and thus removed...

(Its working great as read-only in homeassistant though)