Detecting cover opening/closing

Hello there,

Been playing with HASS since version 0.4. I’ve never written here but I’ve read thousands of threads in this great community.

Now I’m facing a problem and can’t find any documentation on it. Here is the problem and what I want to accomplish:

My 2 years old daughter likes to play with my tuya cover switch as it has touch buttons and must be fun for her. I want to create an automation that detects when cover is opening/closing and pause the movement, this way she will not burn the motor. Problem is that I don’t know how to detect this movement in HASS. I’ve looked at the state of the cover in HASS and it is: unknown/open/closed, but does not report opening/closing.

Any ideas on these or links to available docs (I can’t find them) would be much appreciated.

Thank you so much for your help!

If the cover doesn’t report the state until fully open or closed then the only thing you can do is detect the switch presses.

Hello, thank you for your answer. That’s what I thought I’d do, but I can’t find these switches on HASS, I think it is reporting as a cover component only.

I’m not familiar with Tuya devices or how they integrate with HA, but from a very brief review of the code, it would appear that the button presses for these cover devices are not reported to HA, and everything happens outside of HA, except that HA will update the state of the cover entities indirectly in response to these presses, and it looks like you can open/close/stop the covers from HA as well.

It’s also not clear from the code, but I’m guessing that when the cover is opening or closing that the state of the cover entity becomes unknown. Is that true? If so, you might be able to use the following:

{{ is_state('', 'unknown') }}

to detect when it is opening or closing. Note that this will return False if doesn’t exist, so it should only return True when the entity exists and it’s state is ‘unknown’. I haven’t tested it, but I suspect this trigger might work as well:

  platform: state
  to: 'unknown'