So, like many of the projects take on, I choose to do something that is “simple” but behavioral in fashion so that I can teach myself how to program in the language. I already know several languages but this is one of the few that appears to be solely event based with no means of looping or being able to run a timed cycle run.
So I reach out the community to give me a bit of a pointer in the right direction. Any input, links, references, etc would be helpful.
What I am trying to accomplish is a lighting setup for my front door. I have an indoor light dimmer and an outdoor light dimmer, I also have a contact sensor on that same door. On both sides of this door are motion sensors (multi-sensors) that I want to have illuminate only if the light detected by the light sensor is below a certain threshold and motion is detected.
-If Mode changes to Night turn ON outside dimmer to 40%.
-If Motion is then active, set outside dimmer to 100%.
–If Motion is then inactive, return to 40%
-If Motion is active && contact Opens, set inside dimmer to 100% (also while outside dimmer remained the 100%).
-If Door closes, and motion is detected inside the door return outside dimmer to 40% && set inside dimmer to 40%.
–If Motion is inactive inside, set inside dimmer to 0%.
-If Mode changes to Home, then only perform these options when the light sensors are detecting anything below 50lux.
I am trying to learn how to do device value checks while in the handler for another device. I have tried looking for subscriptions where when values change that they write to a global variable to then have any state change be able to use the same data, but I have really found a lot of action/reaction only and not many staged functions.
Again, any help would be appreciated.