Rule Machine using shade position as condition

Hi all, when using conditions for shades the options are basically something like open, closed, partially open.

For various reasons, including a 'fiddle' to make the Aqara E1 shade work, I have positions like 97 for open and 5/10 for closed (for when the window is open to allow a breeze). Is there any way I can set a condition (required expression) like NOT Position >95 for example?

I'm thinking the way to do it would be to set some kind of variable for each of the blinds? Something like if Lounge blind position >95 then set 'Loung Position' variable to 'Open', then use the variable as the condition? Sounds reasonable, is it, or is there a better way? Also...might need some help setting that up, if someone would be kind enough - never used (global?) Variables before.

Essentially I have some rules to open/close blinds with Lux as a trigger, and rather than them fire constantly every minute want to restrict the 'open' rule to when it is not already there (e.g. >97) and the close rule the same (e.g. not when position is <10).


I could be mis-interpreting what you are intending to do, but would it be correct to say you want to open and/or close your blinds when the lux goes above or below a certain value, i.e.:

  • The sun comes up and the light increases past X, open the blinds
  • The sun starts to go down and lux goes below Y, close the blinds

With some additional conditions around closing the blinds based on whether the window is open?

Hi Simon,

Yes - I've got the window open bit nailed.

At the moment, as the trigger is the lux, the rule fires every time the lux changes - even if it is already ''open', so the result is constant refreshing of the device and an 'attempt' to adjust the blinds. I assume too much of this and the hub will get overwhelmed?

Additionally, presumably with the rule, if the blind opens as per the rule and then I subsequently set it to say 60% because it is blinding me, the next time the lux changes and it is not restricted by the time condition, it will go back to 97 (if I remove the closed condition).

Also, as it stands, it won't open in the morning because at a position of 5 or 10, it is not 'closed'.

Hence for both reasons above, I'd like to create a 'required condition' where the position is <15 ('effectively' closed in my case) to replace the 'closed' condition.

Does that make more sense?

Kind of :slight_smile: But don't worry, I'm just as likely to create automations that are difficult to describe :slight_smile:

So one way to make this simpler (I think) would be to make use of the private boolean inside an RM rule, a variable that each rule has that can be modified and referenced for different purposes, including your situation, I think. That said, I have a conversation I was involved in with Bruce in the back of my mind where my approach to blinds could be improved or didn't match his, so will try and look that up as well. For now I will press on :slight_smile:

Here's my rule for transitioning to Evening Mode and closing my blinds each night. In a nutshell, I make sure in the Required Expression section that I am in the very broad period of the day where I am likely to transition to Evening, taking into account both Summer and Winter daylight hours, plus I have not already performed the actions of this rule once today (the private boolean condition). In the actions I close the blinds, set the mode accordingly and turn off the private boolean, meaning that any other triggers based on the lux are no longer acted upon (see more notes below for an additional rule).

Overnight I then reset the private boolean so that the following evening the same process can occur again:

So, long story... well still long... I would suggest looking at something similar to this. Make use of the private boolean to ensure the closure of the blinds only happens once each day. I, personally, would not worry about the current position of the blinds, issuing the command regardless, depending on how the motor responds to the commands when closed. Obviously you can introduce your own additional conditions to this around windows being open, which I would wrap around both the blinds being closed and the private Boolean being updated.

Hope that helps....

And as a slight clarification of where I am coming from with my suggestion... You may at times see me (and others) question what people are trying to achieve with their automation, like I have done here. The reason being is that while people may post a question about how to achieve a specific outcome in something like RM, like you have asked, sometimes it is worth re-thinking the approach to the automation, like I have tried to do in suggesting a different way of tackling the fundamental problem you are trying to solve. I.e. don't think of it as how do I do this in RM, but how do I develop an automation to achieve this outcome.

Thanks Simon - that is really helpful.

Yes, using a Boolean to effectively restrict the rule to running only once will do the trick, and have the desired outcome I think - I'll give it a whirl!

Absolutely know where you are coming from, and better/more efficient ways of achieving the desired outcome are always welcome. Hopefully the way I phrased the original question suggested I was open to suggestions - I know that you and many others are far more experienced. Sometimes a newb like me can tie themselves up in knots overcomplicating things by trying to do something 'how' we think it should be done, rather than focusing on what we want the end result to be!

1 Like