- Thread starter
- #261
odam2k
Well-Known Member
I think I've solved this almost entirely using Sql This just shows how useful sql can be...
The view returns the module and pin required to trigger the relay for the light, and how many minutes until the light is to turn on, and how many minutes till it turns off, as well as what it should be now, on or off based on the schedule.
All the module has to do is issue this query every minute, and set the relay pin either high or low depending on whether the light is supposed to be on or off. It only needs to concern itself with "right now", not worry about how long until it changes although it is capable of reporting the time remaining... ...
Here's my table with the Lights configuration. A simple schedule, what time do the lights come on, and what time do they go off. Simple, same thing every day... This is why I wanted to treat lights separate from the other switches, because the schedule is quite simple...
Here's the view which gives me those results...
The view returns the module and pin required to trigger the relay for the light, and how many minutes until the light is to turn on, and how many minutes till it turns off, as well as what it should be now, on or off based on the schedule.
All the module has to do is issue this query every minute, and set the relay pin either high or low depending on whether the light is supposed to be on or off. It only needs to concern itself with "right now", not worry about how long until it changes although it is capable of reporting the time remaining... ...
Here's my table with the Lights configuration. A simple schedule, what time do the lights come on, and what time do they go off. Simple, same thing every day... This is why I wanted to treat lights separate from the other switches, because the schedule is quite simple...
Here's the view which gives me those results...