Skip to content

Refactor Hayward OmniLogic local binding to UDP#3

Merged
matchews merged 1 commit into
haywardomnilogiclocalfrom
codex/remove-http-login-and-telemetry-code
Sep 9, 2025
Merged

Refactor Hayward OmniLogic local binding to UDP#3
matchews merged 1 commit into
haywardomnilogiclocalfrom
codex/remove-http-login-and-telemetry-code

Conversation

@matchews

@matchews matchews commented Sep 9, 2025

Copy link
Copy Markdown
Owner

Summary

  • eliminate HTTP login and telemetry calls in local OmniLogic bridge
  • add UDP request/response classes and client
  • hook UDP communication into polling, discovery, and command handling

Testing

  • mvn -pl bundles/org.openhab.binding.haywardomnilogiclocal -am test (fails: Non-resolvable parent POM; network is unreachable)

https://chatgpt.com/codex/tasks/task_e_68c0437bb21c83239bd1ff3d2aaa4000

@matchews matchews merged commit bc45169 into haywardomnilogiclocal Sep 9, 2025
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +119 to +121
public void scheduledInitialize() throws UnknownHostException {
config = getConfigAs(HaywardConfig.class);
udpClient = new UdpClient(config.endpointUrl, UDP_PORT);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Parse endpoint host before constructing UdpClient

The bridge now instantiates UdpClient with config.endpointUrl, but the configuration parameter is still documented as a full HTTP URL (see OH-INF/thing/bridge.xml, default https://www.haywardomnilogic.com/...). Passing a URL string to InetAddress.getByName results in an UnknownHostException before any login attempt, so existing installations will fail to initialise even with the default configuration. Extract the host portion (e.g., via URI) or adjust the configuration format before creating the client.

Useful? React with 👍 / 👎.

Comment on lines +38 to +46
public String send(UdpRequest request) throws IOException {
byte[] out = request.toBytes();
try (DatagramSocket socket = new DatagramSocket()) {
DatagramPacket packet = new DatagramPacket(out, out.length, address, port);
socket.send(packet);

byte[] buf = new byte[4096];
DatagramPacket responsePacket = new DatagramPacket(buf, buf.length);
socket.receive(responsePacket);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Add receive timeout to UdpClient

UdpClient.send creates a DatagramSocket and blocks on socket.receive(responsePacket) without setting SoTimeout. When the controller is offline or drops packets, the call hangs indefinitely and any init or polling job using this method never returns, whereas the previous HTTP client had a 10 s timeout and retry logic. Add a socket timeout and handle the resulting SocketTimeoutException so the thing can recover and update its status.

Useful? React with 👍 / 👎.

@matchews matchews deleted the codex/remove-http-login-and-telemetry-code branch September 10, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant