That's not AI/Logic programming though. Ideally I'd write a boolean formula and the system tries to make it true by adjusting the values it can adjust.
Say I want something like the light should be off it is dark and the window is open (bugs), but if the window is closed and it is dark, the light should be on.
dark & window.open -> !light
dark & !window.open -> light
Obviously, it can't close the window. But it can turn the light to make the formulas true.
If this were answer-set-based, the system could find multiple ways to make the formulas true (that's why I say goal-based) and act in a truly intelligent manner.
Edit: if it could close the window, it had a second way to make the formulas true. That would be nice as well, that the window closes when I turn on the light.
Edit 2: note that at daytime the formulas are always true, such that I can adjust the light and window as I like.
Edit 3: We could also rewrite this as
dark -> (window.open != light)
And it is great that we could reason about our rules in that manner.