cereal2nd / velbus-aio

Velbus Asyncio
Apache License 2.0
15 stars 12 forks source link

Cover states wrong for Velbus covers (always open) in Home Assistant #44

Closed KevChief closed 2 years ago

KevChief commented 2 years ago

Velbus covers always have the state "open". When closing a cover, the state changes to "closed" while closing, but it reverts to "open" when the covers are fully closed. The position is correct though between 0 and 100.

I have 5 Velbus "cover" modules of the same type "VMB2BLE", with Velbus build "1935"

You can see the behavior in the following screenshots.

image image

cereal2nd commented 2 years ago

can you get me a log from velbuslink when you trigger a close action in velbuslink? this will help me to debug.

is there a possibility that we plan a debug session where i can login to your system?

KevChief commented 2 years ago

I updated the Velbus "VMB2BLE" modules to the latest build "2205", but get the same behavior. I'll see if I can get some logs,

KevChief commented 2 years ago

@Cereal2nd , I had the chance to get the Velbuslink logs. See attachment: I've only opened Velbuslink, did a quick connect and a sync and then closed a cover. I waited until it was fully closed and done. Afterwards I opened the same cover again.

Could you check this out and make anything of it?

COVER.vlp.2022-09-22_23h29m34s.log

DannyDeGaspari commented 2 years ago

@Cereal2nd , I checked the blinds on my system and I think I know what is going wrong: The blind status message indicates when the blinds start moving and when the moving stops. It indicates if it is moving up (0x1) or down (0x2), when it stops the status indicates stopped (0x0). This is incorrectly interpreted by the functions is_up and is_down in the file blind_status.py. The position could help here to interpret a correct status. When motion has stopped, the position being 0 should return open, when position is 100, it is closed. But how should HA interpret the status of blinds when they are for example at 50% ? Should the status then be open or closed ?

KevChief commented 2 years ago

@DannyDeGaspari , @Cereal2nd : Great find, sounds logical to me indeed what is happening and why it jumps back to “open” when the blinds are fully closed after the full motion. Checking the position to determine whether the blind is closed or open, seems a viable solution. In my opinion, the status can always be “open” unless it is fully closed. When the blinds are open for only a little bit, in theory these have been opened and thus are “open”. Unless someone has a valid point obviously to do it differently?

cereal2nd commented 2 years ago

this can indeed be a solution, but not all cover modules have the position value available

can someone get me the following: 1- what messages are transmitted on the bus on a blind close 2- same as 1 but on a blind open 3- same as 1 but on a blind stop 4- same as 1 but on a blind set position

wlcrs commented 2 years ago

logs from my installation with a VMB2BLE build 1935 on address 04

image

image

image

velbuslink_covers.log

wlcrs commented 2 years ago

Suggestion: In https://github.com/Cereal2nd/velbus-aio/blob/fc95dcd09d032f248f0f64838c5ec0e5ec66918a/velbusaio/messages/blind_status.py#L52-L62, I don't think you should look to self.status to determine is_up and is_down, but rather look to self.position:

    def is_up(self):
        """
        :return: bool
        """
        return self.position == 0

    def is_down(self):
        """
        :return: bool
        """
        return self.position == 100

It's not clear to me how/if these functions are used? So I'm refraining from making a PR myself for now.

cereal2nd commented 2 years ago

Feel free to make the changes and open a pullrequest :)