Condition trigger when number is within a specified range

Hope someone can help.

I’m currently suffering from low Vit D so I have a UVB bulb attached to a tp-link plug.

I want the bulb to come on if I’m home (location services) AND the UV index is below 5 (underground weather) but obviously not all night, so I’d like it to shut off at 7:00 pm but I can’t figure out how to do it!

My first problem is that annoyingly, I can only trigger an event if UV index rises above a defined level, I need it to be the other way around. (although the very fact this is the case has brought me to use Apilio so I guess that’s the silver lining!)

The second problem is that there is no NOT logic and the time service will only trigger an event on a specific time.

So far I have managed to get around the UV issue by getting the webhook service of IFTTT to send a ‘false’ webhook when UV rises above 5, and requiring condition to be true in the logic block thus reversing it, but I cant do that with a time trigger webhook because it would only trigger at 8:00 and then the state would remain false for the next day.

If I had a separate trigger that turned it off at 8:00 the two would compete with each other and id end up with a flashing bulb! :smiley:

Anyone got any ideas? Am I missing something obvious? when i baught all the components for this project it seemed like it would be simple - UV goes down, bulb goes on!

P.S. if the developer sees this, it would be really great if you could add timing features, it would make things so much simpler, and it seems like a really long-winded way of doing things to call upon a service from somewhere else just to have something happen or stop happening at a certain time.

https://groups.google.com/forum/#!topic/apilio/_n7JV1hApUo

Hi i get round the between time as follows
Set up Boolean value for after 0800 iFTTT webhook set to true after 0800 using time and date in IFTTT
then set after 0800 as false after 1900 using set false in Boolean Variable
For your tp-ling plug using weather underground UV below 5 false webhook UV value 6
Set the positive webhook to 1
Make the necessary changes in conditions
Then logicblocks true result if UV below 5 and time is before 1900. That depends on your wording of course. I hope that helps

2 Likes

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! :sun_with_face:

1 Like