Update sensor.py#153
Conversation
Add Salt Cell Status/Polarity
|
|
||
| @property | ||
| def native_value(self) -> StateType | date | datetime | Decimal: | ||
| is_on = (self.data.telemetry.status_raw & 0b00000100) != 0 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
|
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. |
Add Salt Cell Status/Polarity