Prevent Action Once Count Reached

I have blinds that go up and down certain number of times during the day. For example, when turning the TV on, the blinds in that room will go down.

There are days when the TV goes on and off throughout the day, particularly on weekends. To save battery, I would prefer some kind of stop action and just leave the blind at the last position (whether open or closed), and I would like the count to reset each morning. In the first draft of my workflow I’m targeting just the lowering action.

Not sure how to go about this, but so far I’ve created two numeric variables:
Max Blind Lower Target = 3 (so, don’t lower more than 3 times)
Max Blind Lower Current = x (holds the current value, should reset each day)

Point where I’m stuck:
#1. How do we reset the value back to zero?
#2. I have a logiblock set to automatically evaluate to send a Stop Blinds action through IFTTT. I think this is the way to go, but have to fix #1 first.

  1. First, you need to find out the Webhook (URL) to set your numeric variable to zero. Open your variable settings and click on the “Set value” icon to get the URL in the clipboard.

  1. Next, you should create a new condition, with type “time event”, as follows:

  1. Finally, create a new logicblock and choose this condition, so the logicblock will be run everyday at 8:00. Then add an action for the “positive result” case, which should be type “Webhook”. Enter the webhook from step 1 (it should be in the clipboard) in the Webhook URL field and don’t forget to add 0 at the end (so the variable is set to zero)

For example:

(xxx and yyy will be particular to you)



Thanks @teknofilo for the description!
This covers the part to set the counter to 0. Do you also need help with the counter itself?

1 Like

Super, thanks @teknofilo and @pebneter. Now that I have counter resetting resolved, I think something is off on the action execution itself. Here’s what I have so far:

Numeric Variable “MaxBlindLower” to hold the current number of times the blinds have been lowered so far (within the 24 hour window).

Numberic Variable “MaxBlindLowerTarget” to hold the target number of times (3).

Then, two conditions: one to set that the MaxBlindLower should be equal to or less than the target, and one for the counter reset.

I have a StopExcessBlindLower Logicblock that runs “StopBlinds” on a negative result (i.e., if MaxBlindLower is NOT equal to or less than the target).

I do have automatic evaluation of the logicblock checked, but it doesn’t seem to fire on implementation.

In IFTTT, I have the following on the Lower Blinds webhook:

So overall, what I think the sequence of steps that should be happening are:

  1. Webhook to lower blinds
  2. IFTTT lowers blinds, and also adds 1 to the blind counter on Apilio
  3. Apilio adds 1 to the counter, and triggers logicblock to run
  4. Logicblock runs, if equal to 3 or less, do nothing; but if greater than 3, then launch Stop Blinds webhook.

Step 4 doesn’t seem to be running unless manually evaluated. I’ll keep playing with it in the meantime - I think we’re close.

1 Like

Can you show us a screenshot of the condition MaxBlindLower?

And I guess the IFTTT action you show us does just stop the blind, whatever the direction is, correct?

1 Like

Here’s the condition….though I’m noticing a peculiar timeout piece I might have added sometime back that I wonder might be the culprit?

The IFTTT stop action does indeed stop regardless of direction. It’s a straightforward webhook / somfy that is confirmed to work on its own.

1 Like

If I understand this correctly, I would reverse the logic:
Name: “movements_reached”
Variable: MaxBlindLower (as is)
Compare reference: MaxBlindLowerTarget (as is)
Compare type: “more than”
Timeout/Delay: empty

Then in the logicblock, you add the stopping action to the positive actions.
Can you try?

1 Like

K, have switched it up. The Condition ‘MaxBlindLower’ is now reversed:

Stop action is on the positive side:

But still no go. The auto trigger service (lightning bolt) is confirmed working on Apilio’s side, correct? I’m noticing that the auto trigger for the cycling workflow seems to have stopped working this week as well - but was going to revisit that after solving this in case they are related.

For good measure here is the current condition status:

1 Like

Hi @qdmt ,
I quickly checked the log entries (the same as you see on the dashboard and on the logicblock page).
I think the event was correctly triggered after the count was set to 4.
Maybe the URL for IFTTT is not correct?
(btw. are you aware that you can trigger IFTTT applets directly without using webhooks?)

1 Like

I’ve tested the stop blinds URL in the Logicblock while the blinds are going down, and it works - so the URL is correct.

If you compare the logs from the numeric variable:

With the logicblock logs:

You’ll notice no activity past 12:24:58. If my understanding is correct, it should have also fired at 12:31, 33, and 46.

I thought about using an IFTTT applet, but my tier level with IFTTT won’t allow an OR in the StopBlinds applet that I already have (i.e., if receive Webhook OR if receive Apilio Action). I would have to create a new StopBlinds applet that would house the Apilio/IFTTT action (unless I’m mistaken).

1 Like

Ah yes, now I get it.
It doesn’t trigger anymore because the condition (x > 4) was and keeps being true.
You can trick this by adding a timeout of 10 seconds (10 is the minimum).


Ah hah - that’s what’s happening on the cycling side as well. The weather has been consistently above the target threshold, so it keeps being true there and also never reset.

The 10 second trick worked well! Very cool, thanks again.