I have a Basic Rule that does not run as I expect but it may be working as designed.
What I expect the rule to do is, when a door is unlocked or opened, capture the lights, turn two lights orange and then restore to their previous color and off/on state. These lights are normally white when they are turned off.
However what actually happens is, if the lights are currently off, the light changes to orange and then stays orange when turned on again if those lights are captured while turned off. If the lights are on when captured they are restored to the previously set color.
(I can add a 'turn on the lights' bit into the rule and it will probably take care of the issue. I'm just wondering if the way its currently written /should/ work as I expect it to)
It looks like you are using a rule I posted a while back as a starting point. The issue I pointed out in that thread, and which it seems like you may be facing here, is that if a bulb is off at the time of capture, RM considers a capture and restore successful if the bulb is off again after the restore (and its defense, it is technically in the same state). Color, color temperature, and/or level will generally not come along, nor do many bulbs accept those commands when off (preventing Hubitat from "staging" them on the device regardless--though some do). Here is the post where I shared one such rule:
You'll see that I have the bulb turning on before capture, so to answer this.:
...no, this will not work as you expect. If it did, you wouldn't even need to capture the on/off state to a variable the first place since a simple capture and restore would suffice. That's the reason for this extra step.
Depending on your bulbs, there may be something you can do if Hubitat ever implements a "preset color" or "preset color temperature" command as standard (or if your bulb drivers already do, though I'm not aware of any that do except one of my own). The "preset level" command is standardized now, but it's pretty new, and not all bulbs/dimmers support prestaging regardless, nor have all drivers for such devices been updated to use it, and it would be of little help for your problem given that you care about the full gamut of color-related attribitues and not just this one.
Just a note: this is a screenshot from Rule Machine, not Basic Rule.