Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Double conversion of level data in state property #68

Closed
magoorden opened this issue Aug 28, 2024 · 1 comment · Fixed by #69
Closed

[Python] Double conversion of level data in state property #68

magoorden opened this issue Aug 28, 2024 · 1 comment · Fixed by #69

Comments

@magoorden
Copy link
Collaborator

To retreive the water levels of a state using it's property, a double conversion is happening, such that the returned value represents the sensor distance and not the water level.

For example

class ClaireState:
    [...]
    @property
    def tube1_level(self) -> Optional[float]:
        return self.convert_distance_to_level(self.Tube1_sonar_dist_mm)

where self.Tube1_sonar_dist_mm is already a converted value.

One could also argue that when the sensor data is fetched by update_state(), no conversion should be performed, as the data currently written into self.Tube1_sonar_dist_mm does not match what the property name suggests.

@magoorden
Copy link
Collaborator Author

I decided to remove the conversion when the a new state information is retreived. In that way, the property names in the ClaireState correspond to the stored value.

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 a pull request may close this issue.

1 participant