Now for the quandary… Is it possible to use nested functions?
Use Case:
Output: GPIO on/off to control my heater
Input: DHT11 Temperature Sensor
Current: I have the heater switching on/off just based on a temperature range
Desired: Turn heater on/off based on temperature range, AND set temperature range by time of day.
Goal: Keep daytime (0600-0000) temperature at ~85F, keep nighttime (0001-0559) temperature at ~65F
Any thoughts or guidance would be greatly appreciated!
There a number of ways to do this. You left out how you’re currently regulating temperature, so I can’t provide instructions for how you would use your existing system, but I can give an example of one way to do it.
Use a daily Time Span Function with two types of actions, Deactivate Controller and Activate Controller. For the configured time span, you will deactivate all temperature regulation Functions except for the desired one, and activate the desired temperature regulation function.
Create a Time Span Function for each time range, with the appropriate regulation Function activated and deactivating all other regulation Functions.
This allows only the appropriate regulation Function to be activated in any given time range.
You could also contain all logic in one Conditional Function, but this requires a good understanding of Python to code.
Excellent, that makes perfect sense.
Currently I use a single conditional statement to set the temperature range that I want to maintain. My issue was how to lower that range overnight. Based on your explanation above, I created a “Day” and “Night” conditional statement and then used the Time Span functions as you described.
It looks like this is the solution, I’ll know better after I look at my graphs in the morning.