cryptk / python-omnilogic-local

Python Omnilogic Library for local access
Apache License 2.0
3 stars 0 forks source link

Support for Chlorinator reporting state of active chlorination happening #54

Open daytonturner opened 1 month ago

daytonturner commented 1 month ago

Hi there!

I started digging around with the intent to add chlorinator operating status to your library, but notice that some work has already been done in an attempt to add this, and wonder what your preferred approach would be.

I noticed this comment: https://github.com/cryptk/python-omnilogic-local/blob/main/pyomnilogic_local/models/telemetry.py#L77-L80

Where it checks for the presence of bit 4 being set within status_raw. I've got a diagnostic dump from my chlorinator when it was chlorinating vs not, and was initially going to use the operating_state field, but perhaps your commented out way would work better.

Here are two examples:

NOT CHLORINATING:

        "repr": "EntityIndexData(msp_config=MSPChlorinator(system_id=22, name='Chlorinator', bow_id=1, omni_type=<OmniType.CHLORINATOR: 'Chlorinator'>, enabled='yes', timed_percent=50, superchlor_timeout=24, dispenser_type=<ChlorinatorDispenserType.SALT: 'SALT_DISPENSING'>), telemetry=TelemetryChlorinator(omni_type=<OmniType.CHLORINATOR: 'Chlorinator'>, system_id=22, status_raw=136, instant_salt_level=3031, avg_salt_level=3196, chlr_alert=0, chlr_error=0, sc_mode=0, operating_state=1, timed_percent=100, operating_mode=<ChlorinatorOperatingMode.ORP: 2>, enable=True))"

CHLORINATING:

        "repr": "EntityIndexData(msp_config=MSPChlorinator(system_id=22, name='Chlorinator', bow_id=1, omni_type=<OmniType.CHLORINATOR: 'Chlorinator'>, enabled='yes', timed_percent=50, superchlor_timeout=24, dispenser_type=<ChlorinatorDispenserType.SALT: 'SALT_DISPENSING'>), telemetry=TelemetryChlorinator(omni_type=<OmniType.CHLORINATOR: 'Chlorinator'>, system_id=22, status_raw=132, instant_salt_level=3031, avg_salt_level=3196, chlr_alert=0, chlr_error=0, sc_mode=0, operating_state=2, timed_percent=100, operating_mode=<ChlorinatorOperatingMode.ORP: 2>, enable=True))"

You can see operating_state is 2 when chlorinating and 1 when not. But of course, the value of status_raw is clearly different as well.

Is there a reason your code is commented out? Either of these methods seem like they would suffice.

krucka commented 1 month ago

I'm attempting to do the same thing as in the app there are diagnostic values for the chlorinator such as: -Cell Temp -Cell Current -Cell Voltage -Board Temp -Relay Polarity

Port mirrored the local setup and captured the call for this data:

1.txt 3.txt

Looks like all the data is there in high and low bytes for each of the values in the first file (1.txt). The response for the relay polarity is in the second file (3.txt). I can capture more, but this is my first time doing this so hoping I'll get some reassurance that this is useful

krucka commented 1 month ago

Captured a few more, this time with pics of what the app/controller values showed at the time:

6.txt 7.txt Screenshot_20240801-224643 PXL_20240802_054622212

daytonturner commented 1 month ago

Awesome - thats what I was looking at as well. I'm using a Sense & Dispense, with a chlorinator and salt cell. Let me know if theres anything I can do to assist, either with pull requests or submitting diagnostics - happy to help however needed