Capture and restore not working

I'm aware, but this is not what my response said. A conditional trigger will only run if the condition is true. The first time your power goes 35 or above, the rule will run because the Dreamview is off. However, the rule turns on the Dreamview as part of its actions then waits. Say your plug reports a value of 40. Normally, this would trigger; however, the condition is now false because the Dreamview is on. It's a different way of preventing the rule from running a second time and changing your capture/restore.

From the documentation:

The Conditional Trigger? option allows you to specify a condition that must be true in order for this trigger event to actually trigger the rule You must create the condition on the Create Conditions or Manage Conditions page first. To disable the conditional trigger, un-select the Conditional Trigger: Trigger will only fire if Condition is true option. Conditional triggers will display with "- ONLY IF" plus the specified condition when shown in your list of trigger events.

Basically go to your rule and select Manage Conditions. From there, add the Dreamview Switch Off as a condition. Next, edit your trigger and select conditional trigger. From there, a new dropdown will appear and you can select Dreamview Switch Off as the condition. These steps will give you a conditional trigger and it will prevent the re-triggering of your rule.

1 Like

This should work as well, correct? Create a Required Expression requiring the Dreamview switch to be off? So the rule starts when the swith turns on and then won't restart while it's on.

Settings for Required Expression (I'm using a switch):

Result:
image

Yup. A required expression of the Dreamview being off would work as well too. I cut out the difference that is listed in the docs, but for completeness the difference is:

Conditional triggers are somewhat similar to required expressions, but note that:

  • conditions for conditional triggers are evaluated after the trigger event
  • conditions for conditional triggers can consist of only a single condition, not an arbitrarily complex expression
  • required expressions apply to the entire set of triggers (and typically remove the trigger event subscriptions when false), whereas each trigger can have its own condition (or not); regardless of conditions on triggers, a false required expression will still prevent triggering.
1 Like

Thanks...hadn't read that in quite a while. Good to be reminded.

I think we've buried @cuirbear in options. :wink:

2 Likes

Yeah, plenty of options!
I am going to try, though I am still unsure of what I have to do.

1 Like

The easiest approach would probably be to add a required expression to the start of your rule.

Turn on Required Expression at the top of your rule:

2024-04-09 13_30_22-C8, C7, Hubs

Then click on "Define Required Expression" and create it:

2024-04-09 13_33_43-C8, C7, Hubs

2024-04-09 13_33_59-C8, C7, Hubs

Okay! It worked adding a required expression (Dreamview is off) (still not sure why this worked)

Now, will just have to test it with the side lamps on later this evening.

Thanks to all who added their input.

The rule won't run if the required expression is false.

The first time the rule is triggered by the power level reading, the switch is off, so the rule runs. Required Expression "Switch = off" is true, so the rule can start when the power level changes.

After the rule starts running, the next time the power level changes (say it goes to 100), the switch is already on so the Required Expression is false, since required expression says switch needs to be off. So the rule won't try to start again. It says - "Nope, not gonna start again, because the switch must be off for me to re-start."

Thanks for the explanation.
I tried this last night again once the side lamps came on.
After TV watching, the lamps stayed on as they should (remembering state), but some time afterwards the two lamps ■■■■ themselves off. Uncertain as to what happened (and I did not check the logs in time)

Will turn lamps on and re-run the rules to see what happened, and post logs as available.

Post a sceen shot of your updated rule along w/the logs, filtered for the rule and all the involved devices.

Dang. Cannot seem to reproduce what happened last night.
Will monitor and report what happens.

1 Like

That's in the category of "Shoot - why can't I get it to fail when someone's looking!?" :wink: Been there...

1 Like

I discovered what was happening in the evening...
If TV watching starts when the lamps are off, it captures that state.
Sometimes, TV still on when sunset comes and the lights turn on to fuller brightness.
If TV mode then ends, the rule states to return to previous state, which was off.

Any ideas how to work around this?

In this scenario, what are you wanting your lamps to do? Are you wanting their fuller brightness captured, then dimmed, and finally restored to fuller brightness once the TV is turned off?

1 Like

Here is the scenario:
When I go to TV watching mode, I turn on my side lamps to 15%.
When I finish watching TV, I want to restore them to the state they were in before activating TV watching mode.
So far, it works as it should - if the lamps were off before I started, they turn off again afterwards.
Same for if they were already on.

The problem I have is as follows: if, during TV mode, the lamp state changes from another rule (Lamps on at sunset, for example), the lamps will return to the prior state (off) and not reflect what they should be (on, due to coming on at sunset)

Hope that makes sense.

So what you want is a little more complicated: :slight_smile:

  • I want to restore them to the state they were in before activating TV watching mode
    -- But...if there is another time-based setting in other activations, if that time has occurred, I want the lights to change to that setting when I finish watching TV.

Maybe not the most elegant approach (@JB10 will probably have a better way), but I think you could add some logic "if lamp level changes, capture" so that you always have the current state.

Just to confirm, if you're watching TV you do want the other automation (Lamps on at Sunset, and others you may have that affect the lights) to run regardless of you being in the middle of a TV watching session?

Good question. If the state does change while watching TV, I do not not want the automation to run; however, that being said, once TV watching is over still want the lamps to be on at their brighter setting (as per post-sunset level)

You seemed like a relaxed, friendly, non-demanding guy, and then the realy you finally comes out. :wink: :smiley:

So you can easily block the sunset automation from running by using a similar requried expression in it to stop it from running unless your watch TV automation is off. So that's easy. Depending on how the sunset lighting automation is written you may also simply be able to call it when the TV automation ends and if the appropriate time-frame is active then its settings would be applied, if not, lights would go back to the last captured state.

Oops...I'll have to leave additional comments for later, hopefully @JB10 or others can chime in, just realized I'm late for an errand!

2 Likes

Knowing this piece, it's fixing your post-sunset rule for the lamps and leaving the capture/restore rule in place since it is working. The "simple" fix to this is having a simple conditional action in your sunset rule looking at the state of the Dreamview. Basically, in your sunset lamp rule, I would write the rule something like:

Trigger
Sunset (or whatever actual time you use)

Action
Simple Conditional...If Dreamview Switch is on, wait for event - Dreamview Switch is Off
Whatever level or actions you are doing to the lamps if the TV was not on

Basically, all you are doing is checking the state of the Dreamview. If it is off, the rule proceeds to set the lights as desired. If it is on, you are asking your sunset lamp rule to wait until it gets turned off from the other rule and then turn on the lights as normal. In this scenario, the lights would first get "restored" to off by the other rule, and then, set to the sunset level by this rule.

If you wanted things to go a little faster (maybe a few seconds), your sunset rule would be tweaked to an IF/Then:

If Dreamview is On,
Cancel Rule Timers (TV Mode rule)
Wait for Event - TV Plug is equal to or below 7.0 and stays for one minute
Unmute living room pair
Set lamps to sunset level
Turn off Dreamview
Else,
Set lamps to sunset level
End-IF

Similar idea to the first one. Again, it's checking the state of the Dreamview, however, this revised rule cancels all remaining events from the TV mode rule (Cancel Rule Timers). Then it waits for the TV to turn off, and proceeds to act very similar to the TV Mode rule with the exception being that your lights are not being restored. Instead, they are being set to their sunset level like normal. If the Dreamview is off, the "else" actions are running and the lights get set. This option should go a touch quicker in setting the lights than the first one.

1 Like

was looking at the first option you presented, as it seems easiest for me...
Unfortunately, the rule for turning the lamps on is under Room Lighting, and there are no options for a conditional variable (that I know of)

I will look at the second option, see if it is something i could attempt