Reset Reaction evaluate Contraints?
-
I have a rule that closes my curtains when I start my Xbox activity on the Harmony hub.
In the Contraints I have that it's day time.
In the Reset Reaction it opens the curtains when I end the Xbox activity etc.
Today it was day time and I started the Xbox activity and the curtains closed.
When I turned off the Xbox it was night time, however my curtains then opened.
I expected the curtains to remain closed as by then it was night time.
Not sure the best way to handle this? But I want a rule that closes the curtains if it's day time and I want to play on the Xbox. If it's still day time when I end that Harmony Activity then open the curtains again. Or if it's night time then keep the curtains closed.
I figure if I start playing the Xbox and it's already night time then the curtains would already be closed anyway via the sunset offset schedule that closes the curtains.
-
I've removed the actions from this rules Reset Reaction to open the curtains and just created a second rule also, that is the opposite, so NOT equals the XBOX Harmony activity and in the Reaction I've set to open the curtains, the Constraint checks if its day time. This should work now I think and not open the curtains if its turned to night time whilst I have been on the XBOX.
-
I can't vouch for whether that may or may not be a complete solution, but I'm thinking you're on the right track and I applaud your continued attack on the problem.
Data point, which is in the docs: Constraints do not restrict the reset reactions, only the set reactions. So to be clear, the answer to the question posed in the title is "No, and by design."
As of today (meaning, so far... but new capabilities are afoot).
-
Concur that @cw-kid is on the correct path, but IF you wanted to keep things compact inside the original, single rule, then you could swing it as follows (this is untested pseudocode for you to consider):
EXPRESSIONS
isNight := <your_favorite_sunrise/sunset_or_time_schedule_here>
or
isNight := dateparts(time()).hour>20 && dateparts(time()).hour<8RESET REACTION
[Entity Action] [x_vera_device.set_variable] [urn:upnp-org:serviceId:SwitchPower] [Status] [ ${{ not isNight }} ]Works in theory, to turn ON (open) blinds if it is not nighttime (i.e. daytime), but turn/leave them OFF (closed) otherwise.
-
I am looking at this rule again now that build 21117 has been released.
So to recap I want to achieve the following with this rule.
Trigger -
I start the XBOX Harmony Activity:
Constraints -
Check that its Day time ?
Check the current state of the Window Coverings, to see if they are in fact already opened ?
Reaction -
Close the Window Coverings
Reset Reaction -
When I turn off the XBOX Harmony Activity
Check that its still Daytime ?
If it is still Daytime then Open the Window Coverings
If its now Night time then I don't want the Window Coverings to Open
I haven't tested this rule but I think I have it setup correctly? Using the new Constraints Group in the Reset Reaction etc.
EDIT: This single rule all seems to be working fine.
-
I also had some other rules where in the "Set Reaction" they would send a TTS announcement to Google Home speakers via a HTTP Request. But I only wanted the TTS Announcements to happen if Vera was in HOME mode. Previously I had to use LUA code called via the VeraScenes.lua file and the Vera startup library, to check Vera's House Mode status and then send the HTTP Request or NOT.
I've just edited three of these rules and changed them to use the new Group Constraints in the Set Reaction instead. In here I am now doing the further check to see if Vera is in HOME mode and then sending the HTTP Request.
I removed my LUA code from the VeraScenes.lua file also and any references to that in these MSR rules etc.
I've tested them and they appear to be working OK. If I put Vera in to NIGHT mode and then run the "Set Reaction" the TTS announcement now does NOT play, but the other actions in the Set Reaction are still carried out.
But if Vera is in HOME mode it does play the TTS announcement also.
-
The new Constraints groups, though I haven't yet tried them in practice, seem like the holy grail for some use cases such as yours. Happy to hear that you were able to implement them so swiftly.
While I will probably slog along using IF/THEN logic (within Expressions) in lieu of Constraint Groups, there will come a time when it's simpler just to add those conditions directly as you have. Pretty sure the typical MSR user will feel that way, too.
I think @toggledbits has done a really incredible job with the latest release (21117)!! The "look and feel" alone is something to behold.