So, I thought WebCore would let me do this easily - but then realized that while I can activate a particular color on a light, I'm not certain how to turn if off w/o getting overly complex.
What' I'm looking to do is the following:
If water sensor is wet, make alert light red.
If weather alert is alert state, make alert light yellow.
If neither of those are triggered, turn off the light.
That's the simplified version. I'd like to add 3-4 more colors/alerts (e.g., doors unlocked after midnight, etc.) and have them prioritized so, say, the water sensor being wet makes the sensor always go red even if another alert is triggering.
The prioritization I can do with placement w/if and elseif's. However, aside from having an ENTIRE other set of conditionals for "return to normal" I'm not certain how to trigger the light to turn off.
How is the rule triggering? Is it triggering on an interval or when the state of any of those devices changes?
If its on an interval, after your string of if / else ifs add a final "else if" clause that checks if the light is on, and if it is then turn it off. Then if none of the other rules trigger the light to be on and it is currently on, it will turn off. I think the same thing might actually work even if you have it triggering on the state changes.
Having some trouble finding documentation on that, but from the example I don't think it would actually do what I'm looking for. It would still need a trigger and setting things back to original isn't what I want it to do.
@jtp10181 - That may work. I'm wondering if just having it iterate through conditions on a timer and setting what the color of the light should be given current state might be optimal - trying to have it trigger on changes is what's causing the headache for me at this point (and finding documentation of how to do certain things appropriately).
I don't use webcore but I imagine you can trigger your piston with multiple conditions similar to how RM works? You could always do triggers on some of the device states and ALSO do an interval of like every minute or something. That would make sure it does not get left on too long if you dont have all the triggers setup properly.
The key thing for me is what's triggering - change to/from a value or just the value changing. I believe, based on some of the WebCore docs, that setting up a comparison like "If X is 1" should subscribe to all changes vs. "If X changes to 1" which only triggers on the change. That way, it SHOULD do like you highlighted and have a final "catch" else that turns everything off.
...now to figure out a way to test it or just wait for a major weather event