Skip to content

Parse Hayward block metadata from lead XML#44

Merged
matchews merged 2 commits into
haywardomnilogiclocalfrom
codex/refactor-udpclient-xml-handling
Sep 10, 2025
Merged

Parse Hayward block metadata from lead XML#44
matchews merged 2 commits into
haywardomnilogiclocalfrom
codex/refactor-udpclient-xml-handling

Conversation

@matchews

Copy link
Copy Markdown
Owner

Summary

  • Derive block count and compression flag from lead XML instead of UDP header
  • Drop unused header parsing and add helper for Parameter extraction
  • Update tests to embed block metadata in lead message payload

Testing

  • mvn -q -pl bundles/org.openhab.binding.haywardomnilogiclocal test (fails: Non-resolvable parent POM org.openhab:openhab-super-pom)

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

@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 +129 to +142
private static int parseIntParameter(String xml, String name) {
String search = "<Parameter name=\"" + name + "\">";
int start = xml.indexOf(search);
if (start == -1) {
return 0;
}
start += search.length();
int end = xml.indexOf("</Parameter>", start);
if (end == -1) {
return 0;
}
try {
return Integer.parseInt(xml.substring(start, end));
} catch (NumberFormatException e) {

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 lead parameters without assuming attribute order

The new parseIntParameter helper searches for parameters using the literal substring <Parameter name="…">. XML attribute order is not guaranteed, and the OmniLogic examples in API.md include additional attributes (e.g. dataType="int" name="MsgBlockCount"). When the lead message contains any other attributes or a different ordering, this method returns 0, leaving expectedBlocks at 0 and compressed false so the loop will wait until it times out instead of assembling the received blocks. Please parse the XML element without depending on attribute ordering or additional attributes.

Useful? React with 👍 / 👎.

@matchews matchews merged commit ff476c4 into haywardomnilogiclocal Sep 10, 2025
@matchews matchews deleted the codex/refactor-udpclient-xml-handling branch September 11, 2025 00:38
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