home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.72k stars 30.45k forks source link

deCONZ cover status reversed #46525

Closed answer35 closed 3 years ago

answer35 commented 3 years ago

The problem

Hi, I am controlling my window shutter roller with deconz. It is Legrand Dooxie module. When at 0%, cover is fully open and 100% fully close. But the binary status is reverse, which consider the cover close at 0% and open at 100% so I cannot use the button really easily to open or close. Is there any way to say Home Assistant to change the way it looks at it ?

What is version of Home Assistant Core has the issue?

2021.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

No response

Link to integration documentation on our website

No response

Example YAML snippet

# Put your YAML below this line

Anything in the logs that might be useful for us?

# Put your logs below this line
elupus commented 3 years ago

Covers in home assistant are expected to have a value of percentage open. If the deconz integration exposes these with a value of percentage closed. That integration is faulty.

stevewull commented 3 years ago

Cover percent open is reporting correct for me. Using a Zemismart _TZE200_xuzcvlku model TS0601 cover

100% = fully open. 0% = fully closed

My Problem on the Lovelace entity card is that the up arrow moves the shade down and the down arrow moves the shade up. Should be reversed.

answer35 commented 3 years ago

And I have the exact opposite of your issue. My percentage is a percentage close and buttons open/stop/close are working fine. So i just have an issue with the binary sensor open/close display even if it is managed right regarding the button open/close which disable open when my cover is already open. That is really weird

stevewull commented 3 years ago

This device was covered in issues #4446 on the deConz forum. For the problem where the direction is reversed, there is an hidden zigbee command, available using the api

PUT, PATCH /api//lights/ with {"reverse":true}

When I execute this command, my cover behaves the same as Answer35's. Direction is correct but the % open/close is reversed. I'm not sure whether this is an issue with the API or with the deConz integration for Home Assistant.

Smanar commented 3 years ago

@answer35 Hello, wich one deconz version have you, there was some change on this part recently. Now it s firmware device dependent.

answer35 commented 3 years ago

@answer35 Hello, wich one deconz version have you, there was some change on this part recently. Now it s firmware device dependent.

Hi, my deCONZ current version: 6.7.2 It should be the last one. if it is required to make a firmware update of my devices, is there anyone who can help me to figure it out on how to make this update because I don't have enough knowledge about that at all ^^ I don't even know how/where to find firmware update files :/

Smanar commented 3 years ago

6.7.2 is your HA deconz plugin version, not the deconz version. To update the device firmware you need the deconz GUI, I can share a firmware for your device if I have one (need your firmware version and the image type), but it will not change lot of thing. When I say it s firmware dependent, I mean deconz don't use the same return according the firmware you have.

But if I remember if you press "up" on HA, when the device is full open, the button is disabled, and you can only use "down", have you same result or the reverse ?

But yes, the percent in deconz is percent closure, idk if HA reverse it too.

probot-home-assistant[bot] commented 3 years ago

deconz documentation deconz source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @kane610, mind taking a look at this issue as its been labeled with an integration (deconz) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

Kane610 commented 3 years ago

Hello, I first saw this issue the other day when I got assigned to it, so it's not that I've been avoiding the issue.

If you get different behavior depending on which device you use, my take is it needs to be normalized in deCONZ.

If you think there are errors in the integration/library logic, please point me to where, links and logic below. I have iterated over this more than once, and my Ikea fyrtur behave like expected.

This is how integration calculates position code Tests to verify calculations

    @property
    def current_cover_position(self):
        """Return the current position of the cover."""
        return 100 - self._device.lift

    @property
    def is_closed(self):
        """Return if the cover is closed."""
        return not self._device.is_open

    async def async_set_cover_position(self, **kwargs):
        """Move the cover to a specific position."""
        position = 100 - kwargs[ATTR_POSITION]
        await self._device.set_position(lift=position)

In pydeconz code Tests to verify calculations

    @property
    def is_open(self) -> bool:
        """True if the cover is open."""
        if "open" not in self.raw["state"]:  # Legacy support
            return self.state is False
        return self.raw["state"]["open"]

    @property
    def lift(self) -> int:
        """Amount of closed position.

        0 is fully open.
        100 is fully closed.
        """
        if "lift" not in self.raw["state"]:  # Legacy support
            return int(self.raw["state"].get("bri") / 2.54)
        return self.raw["state"]["lift"]

    async def set_position(
        self, *, lift: Optional[int] = None, tilt: Optional[int] = None
    ) -> None:
        """Set amount of closed position and/or tilt of cover.

        Lift [int] between 0-100.
        Scale to brightness 0-254.
        Tilt [int] between 0-100.
        Scale to saturation 0-254.
        """
        data = {}

        if lift is not None:
            if "lift" in self.raw["state"]:
                data["lift"] = lift
            elif "bri" in self.raw["state"]:  # Legacy support
                data["bri"] = int(lift * 2.54)

        if tilt is not None:
            if "tilt" in self.raw["state"]:
                data["tilt"] = tilt
            elif "sat" in self.raw["state"]:  # Legacy support
                data["sat"] = int(tilt * 2.54)

        if data:
            await self.async_set_state(data)
Kane610 commented 3 years ago

Closing this as no one responded to support understanding the issue.