Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pentair] SerialBridge does not set configured id and documented default is not applied #16874

Closed
BillBaird opened this issue Jun 15, 2024 · 6 comments
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@BillBaird
Copy link

Issue

The pentair binding, when using the Serial Bridge ignores the "id" thing configuration. The makes the binding when using the serial bridge configuration essentially read-only. It should be noted that the IP Bridge binding properly sets the "id" and behaves properly.

Expected Behavior

The thing's "id" is included in commands sent using the Pentair binding, enabling the Pentair EasyTouch system to accept and act on the command.

Current Behavior

Currently, commands written to the RS485 bus use a value of 00 for the source id, as seen in this log entry:
[DEBUG] [rnal.handler.PentairBaseBridgeHandler] - Writing packet: FF FF FF 00 FF A5 01 10 00 86 02 09 01 01 48
The correct behavior should have a configured value of 34 (hex 22) for the source id, as seen in this log entry generated using the IP Bridge:
[DEBUG] [rnal.handler.PentairBaseBridgeHandler] - Writing packet: FF FF FF 00 FF A5 01 10 22 86 02 09 01 01 6A

The difference can be seen in the incorrect 10 00 86 sequence and the correct 10 22 86 sequence.

Possible Solution

Add this line in PentairSerialBridgeHandler.java at line 53:

id = configuration.id;

This would make the connect() method begin with

    @Override
    protected synchronized void connect() {
        PentairSerialBridgeConfig configuration = getConfigAs(PentairSerialBridgeConfig.class);

        id = configuration.id;

        try {
            CommPortIdentifier ci = CommPortIdentifier.getPortIdentifier(configuration.serialPort);
            CommPort cp = ci.open("openhabpentairbridge", 10000);

which is exactly what the PentairIPBridgeHandler.java connect() method does.

It should also be noted that PentairBaseBridgeHandler.java indicates that subclasses need to assign, but the PentairSerialBridgeHandler.java does not.

    /** ID to use when sending commands on Pentair bus - subclass needs to assign based on configuration parameter */
    protected int id;

Interestingly, the README.md documentation indicates that it defaults to 34 for both the ip_bridge and serial_bridge

| Thing         | Configuration Parameters                                     |
| ------------- | ------------------------------------------------------------ |
| ip_bridge     | address - IP address for the RS-485 adapter - Required.      |
|               | port - TCP port for the RS-485 adapter - Not Required - default = 10000. |
|               | id - ID to use when communicating on Pentair control bus - default = 34. |
| serial_bridge | serialPort - Serial port for the IT-100s bridge - Required.  |
|               | baud - Baud rate of the IT-100 bridge - Not Required - default = 9600. |
|               | pollPeriod - Period of time in minutes between the poll command being sent to the IT-100 bridge - Not Required - default=1. |
|               | id - ID to use when communciating on Pentair control bus - default = 34. |

The code not only does not set the default of 34 (at least as I read it), nor does it set the id at all for the serial_bridge. Either the code should actually implement a default of 34, or the docs should be changed to indicate that id should typically be set to 34.

Steps to Reproduce (for Bugs)

Prerequisite - you would need a Pentair EasyTouch setup on your swimming pool.

  1. Configure your easy touch as per the documentation, using the Serial_Bridge configuration.
  2. Verify that you are able to see the status of one of your configured features (on-off circuits)
  3. Send a command to change its state. It shouldn't work. Observe the address of '00' in the pentair debug log.

Context

I had a hard time believing this was the issue as this binding has been around for a number of years. In an effort to standardize my installation, I recently converted to it from an early version which I had modified several years ago. I could not get the current binding to work. Observing the log I saw the my ancient working version was sending the hex 22 source address, but the new version was not. I dug into the new code and noticed that the address was only set when using the IP_bridge. I changed my configuration from using a serial bridge to an IP bridge (with the id set to 34), the log entries looked correct, and the things started working.

The good news is that I have a workaround (use the IP bridge). My EasyTouch (I suspect all EasyTouches) require the source address. I don't see how anyone could get the serial binding to work without this fix.

Your Environment

  • Version used: OpenHabian 4.1.2
  • Raspberry PI 4, 4GB.
  • Operating System and version (The latests Openhabian (4.1.2)):
@BillBaird BillBaird added the bug An unexpected problem or unintended behavior of an add-on label Jun 15, 2024
@jlaur jlaur changed the title Pentair binding SerialBridge does not set configured id and documented default is not applied [pentair] SerialBridge does not set configured id and documented default is not applied Jun 16, 2024
@lsiepel
Copy link
Contributor

lsiepel commented Jun 28, 2024

@jsjames as you have a PR pending, is this something you can confirm (and or fix?)

@lsiepel
Copy link
Contributor

lsiepel commented Jun 28, 2024

@BillBaird there is a significant update coming, but that will not make it into 4.2 that will be out in a couple of weeks. I expect it to be in one of the first snapshots of 4.3

@jsjames
Copy link
Contributor

jsjames commented Jun 28, 2024

@BillBaird - As @lsiepel mentioned, there is a significant update to the binding coming which adds quite a few additional features and is much more stable. I verified that this issue should not exist in the new code since I restructured the code better so there is more common code between the 2 bridge types. If you want to try the new version out, you can download this file and put in your addons directory. Note, the configuration of the binding is different. The updated code/documentation is here: https://github.com/jsjames/openhab-addons/tree/pentair2

https://drive.google.com/file/d/13QnBZr2yHtC9pNmJQkOW-T33YmFvKg2y/view?usp=sharing

@BillBaird
Copy link
Author

BillBaird commented Jun 28, 2024 via email

@jsjames
Copy link
Contributor

jsjames commented Jun 29, 2024

I do recall the RPM being an issue that I corrected. My pump does not output the RPM, so I couldn't test this originally.

Regarding the number of programs, if you have an intellitouch, we could work on a future enhancement to the binding to support more programs. Right now the binding does not determine the type of pentair controller, so it assumes they are all an easytouch.

@lsiepel
Copy link
Contributor

lsiepel commented Aug 10, 2024

As #13485 has been merged and @BillBaird confirmed this was fixed. I close this. If needed to discuss new features please open a new issue per enhancement.

@lsiepel lsiepel closed this as completed Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

No branches or pull requests

3 participants