I think one could also have two variables to track the UV index, to check whether the current index is higher or lower than 5. There is only one WeatherUnderground trigger that can be used, and it monitors when the local UV level rises about a specified value:
0 ++++++ 5 ---------------------------- 16
- One variable, “base_level” is set to true when the UV level is over 1.
- A second variable, “threshold_level” is set to true when the UV level is over 5.
- Both variables are reset to false everyday at Sunset.
- If base_level is true, but threshold_level is false, then you are in the range between 1 and 5.
- If both are true then you are in the range between 5 and 16
We will also need:
- A third variable that will be set to true during the times of the day when it is OK to turn the light bulb. For example, set it to true everyday at 14h and to false at 19h.
- And a fourth variable will be set to true when you get home and false when you leave.
You can setup a condition for each variable to check whether they are true or false, as needed.
You will then setup your logicblock to evaluate the logicblock everytime a connected variable changes, and there will only be a positive action (turning on the light) if: you are home, it’s a time of the day when it is ok to turn on the light, the UV index is under 5 so base_level is true and threshold_level is false.
I think this is a great example!