Open/close direction for projector screens

I have developed my first integration, for my projector screen produced by XY Screens using the RS485 interface. I used the Cover Entity and all working fine. However there is one thing that’s counter intuitive to me.

The Cover Entity assumes the retracted screen to be the open state and the rolled down screen to be the closed state. This is how you expect it to be for rolling blinds, garage doors et such.

However for a projector screen this works in the opposite way, the screen is open when it’s rolled out and closed when retracted.

I think it would be great when an extra Device Class for the Cover Entity could be created named DEVICE_CLASS_SCREEN where the logic is opposite of the logic of the DEVICE_CLASS_SHADE Device Class.

What are your thought on this?

My thoughts: Custom device classes

You could override the state property in your integration to correct this logic. See below code from the cover entity class. Just add thisntomyour integration and amend the logic.

    def state(self) -> str | None:
        """Return the state of the cover."""
        if self.is_opening:
            self._cover_is_last_toggle_direction_open = True
            return STATE_OPENING
        if self.is_closing:
            self._cover_is_last_toggle_direction_open = False
            return STATE_CLOSING

        if (closed := self.is_closed) is None:
            return None

        return STATE_CLOSED if closed else STATE_OPEN

I understand I can have my integration return whatever state I want, however this does not solve everything. First of all the interface in HA will show you the up and down arrows in the wrong directions, second there is the open and close percentage which should also be reversed. This is quite easy to fix but still.

I think it should be good if a DEVICE_CLASS_SCREEN should be added to the Cover Entity with the described behaviour so also configurations could benefit from this, like when someone uses a shelly or other device to control a projector screen