Skip to content

Update sensor.py#153

Closed
natesmith123 wants to merge 1 commit intocryptk:mainfrom
natesmith123:main
Closed

Update sensor.py#153
natesmith123 wants to merge 1 commit intocryptk:mainfrom
natesmith123:main

Conversation

@natesmith123
Copy link
Copy Markdown

Add Salt Cell Status/Polarity

Add Salt Cell Status/Polarity

@property
def native_value(self) -> StateType | date | datetime | Decimal:
is_on = (self.data.telemetry.status_raw & 0b00000100) != 0
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I would prefer that this parsing be done in the underlying library and then values be exposed to the integration from there.

@property
def native_value(self) -> StateType | date | datetime | Decimal:
is_on = (self.data.telemetry.status_raw & 0b00000100) != 0
is_init = (self.data.telemetry.status_raw & 0b00000010) != 0
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this bit does not indicate that the salt cell is in an initialization state, it indicates that there is an alert value present. You would then need to reference the value of chlrAlert from the telemetry to determine what alert is present.

Likewise bit 0 indicates an error is present and you would then reference chlrError from the telemetry to see what error is present.

is_on = (self.data.telemetry.status_raw & 0b00000100) != 0
is_init = (self.data.telemetry.status_raw & 0b00000010) != 0
polarity_k1 = (self.data.telemetry.status_raw & 0b01000000) != 0
polarity_k2 = (self.data.telemetry.status_raw & 0b10000000) != 0
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

As mentioned above, I would prefer this parsing happen in the underlying library and then be exposed as attributes for the on/off sensor indicating which relay is active.

@cryptk
Copy link
Copy Markdown
Owner

cryptk commented Oct 23, 2025

I have updated the underlying library to parse these values in cryptk/python-omnilogic-local#75. Going to close this PR as it will be implemented in a different way than was proposed here.

@cryptk cryptk closed this Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants