For an example of Daniel’s suggestion, see [No longer relevant on OH 3.0+] Design Pattern: Rule Latching.