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

Shade position is not correctly calculated #23

Open
jankrib opened this issue Jun 25, 2023 · 3 comments
Open

Shade position is not correctly calculated #23

jankrib opened this issue Jun 25, 2023 · 3 comments

Comments

@jankrib
Copy link
Owner

jankrib commented Jun 25, 2023

image

Given this code:

    def current_cover_position(self) -> int | None:
        if self._state:
            # xcomfort interprets 90% to be almost fully closed,
            # while HASS UI makes 90% look almost open, so we
            # invert.
            return 100 - self._state.position

It looks like the position is reported as a byte 0 to 255, giving 100-255=-155.

Does this mean position is reported differently for different devices or is it simply a bug for all?

I would love your input here @alexbrasetvik since the current calculation is based on your shades.

@jankrib jankrib changed the title Shade position is not cerrectly calculated Shade position is not correctly calculated Jun 25, 2023
@alexbrasetvik
Copy link
Contributor

This does not reproduce with my devices, and I have a snapshot of the states of devices/components from my neighbor reporting this issue, in which all their shPos values are 0 or 100. (And anything 255 relates to slatPos – which our devices don't use – or limeCycle of WaterGuard)

So the calculation is not obviously broken given the devices I've had the ability to look at state for. I looked in the Cordova app for any calculations with shPos, and the ones I could find relate to the 0-100 value range. (It would also make more sense to divide by 255 than subtract it to translate to the percentage value the app operates with. 🧐)

@jankrib
Copy link
Owner Author

jankrib commented Jun 26, 2023

Thanks for looking into it. I guess we need to do some real time logging on @oywino system to get any further with this.

@oywino
Copy link

oywino commented Jun 26, 2023

Feel free to do whatever it takes to solve this - or tell me what you want me to do. 😊

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

No branches or pull requests

3 participants