Context: We have an open floor plan downstairs, and I have one set of lights in my living room controlled via motion (on/off) and one kitchen lamp controlled via motion (on/off). When it gets dark and one light is off, and then the other turns off (lack of motion), I want the hall light to come on (otherwise completely dark downstairs).
If motion triggers the living room or kitchen, then those lights will turn on (via another piston) and then the downstairs hall light should turn off.
I had a challenge where if I turned on the downstairs hall manually any motion would trigger that light to turn off. Enter variables! Now, the downstairs hall will only turn off it was turned on by the kitchen or living room being dark (light off).
I generally try to keep one piston to handle all the rules of a given device, so the focus on this piston is the downstairs hall. The other lights have their own pistons.