feat: add chlorinator diagnostics - #154
Conversation
Add local API requests for chlorinator measurements and relay polarity. Parse cell voltage, current, cell and board temperatures, and instant and average salt levels while preserving the raw controller values.
|
| """Parse a chlorinator diagnostic XML response.""" | ||
| data = xml_parse(xml, force_list=("Parameter",)) | ||
| response_name = data.get("Response", {}).get("Name") | ||
| if response_name != cls.expected_response_name: |
There was a problem hiding this comment.
I don't understand what the point of all of this work to set and verify response names is? Are you concerned that it might send a request and somehow get a response intended for a different request? That doesn't happen. The way the protocol works, every request sent to the Omni via the async_send_and_receive method creates it's own datagram endpoint (so it's own local port), so responses sent from the omni will be sent to a port specific to that request.
There are other (likely more efficient) ways to do this that I plan to look into in the future (involving using a single local port for sending and receiving responses, and matching responses with the transmitted message based on message IDs, etc), but for now, the fact that ever message sent uses a different local port disambiguates the responses.
Was there some other reason for this response_name matching that I'm just not seeing?
| # Lookup table used by OmniLogic to convert the cell and board thermistor ADC | ||
| # readings to tenths of a degree Fahrenheit. Values between entries are | ||
| # interpolated using the low three bits of the raw reading. | ||
| _TEMPERATURE_TENTHS_F = ( |
There was a problem hiding this comment.
How were these values determined?
| RUN_GROUP = 317 | ||
| RESTORE_IDLE_STATE = 340 | ||
| GET_FILTER_DIAGNOSTIC = 386 | ||
| GET_DIAGNOSTIC = 386 |
There was a problem hiding this comment.
Internally, the Omni refers to message type 386 as UI_GET_FILTER_DIAGNOSTIC, which is why I have it named GET_FILTER_DIAGNOSTIC here. Where possible, I attempt to align the names of things in the library to match the names used internally by the OmniLogic system. It helps me to keep things straight when I am cross referencing documentation and such.



Adds requests for salt cell chlorinator measurements and relay polarity.
Parse cell voltage, current, cell and board temperatures, and instant and average salt levels while preserving the raw controller values.
Tested against my pool setup.
Sample with chlorinator on:
Sample with chlorinator off: