Switch delay

Hi, thanks in advance for your help.
I have several IKEA blinds in a group which work fine. I have some time automations which also work well. However sometimes I like to override the opening or closing of these blinds with a button. The way I do this is to press an aqara button which then toggles a virtual switch. If the virtual switch open, opens the blinds, virtual switch closed then closes the blinds. This works well until my children press the switch again before the blinds are fully open or fully closed. When this happens, the blinds go crazy which results in some going up and some doing down etc.

So basically the blind cycle is about 40 seconds. I need a way that if the button is pressed again before 40 seconds has elapsed, then the virtual switch will not toggle.

I have an idea in mind, but would like some alternative ideas please. Cheers :+1:

I would suggest a rule triggered by the button, have the rule do an actuator for the blinds, capture the first time the button is pressed, exit rule if pressed within 40 sec, otherwise do the blinds.

How is this set up now? And what was your idea? :slight_smile: My idea involves a rule, something like:

Trigger: Button 1 pushed

Actions to run:

IF (Private Boolean True) THEN
  Set Private Boolean False (This Rule)
  On: Virtual Switch
  Delay 0:00:40
  Off: Virtual Switch
  Set Private Boolean True (This Rule)
END-IF

I'm not sure if that's exactly what you want (I may have misunderstood the role of your virtual switch in my quick read), but it should give you an idea: I'm using the Private Boolean (a free built-in variable in every rule) to track whether the button has been pushed recently and not re-running the actions it has been.

You could probably do something similar nowadays with Basic Rules, new in 2.2.6, if you're running that version and don't feel like Rule Machine, but I haven't tried.

(EDIT: I actually like the idea of capturing the current time and doing a comparison, above, better, since it would better handle an odd case of, say, your hub rebooting right in the middle of this rule execution and missing the scheduled event to turn the Private Boolean back. Should be rare, though...)

1 Like

I use a two button Aqara (Opple) button to send either Open or Close commands directly to the blinds.

When using a single button, you could skip using a virtual switch, if you make a rule that uses the current level of the blinds as condition.. Something like..:

Trigger: button pushed

If blind is above level 50
Then open blinds
Else
Close blinds

Combined with @bertabcd1234 suggestion of using a Private Boolean to limit button presses, should prevent the kids from making the blinds go out of sync.

OR:
Use single press for open, and double tap for close.. :smile:

@672southmain thanks for this. How would I prevent the time from being captured when the the button is pressed for the 2nd time. Could you show be a basic rule and trigger for this please. Very appreciated :+1:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.