No rain for 2 hours as trigger

weather
triggers

#1

1) Give a description of the problem
I would like to be able to ‘reset’ a variable if not raining for 2h

2) What is the expected behaviour?
if no rain for 2h then set variable to 0

3) What is happening/not happening?
not sure if the condition trigger is working and cant find a way to ask if it was raining 2h ago

I have a global that is set with the twcWeather and it shows the weather report. I try to use it as trigger by finding “rain” or “shower” inside of it. It works but I would try to ask webcore if this global NOT countain those words for 2 hours… Seem not to work! By the way, conditional trigger seem not working at all and act like normal condition…

    Any idea is welcome! For now I think I should have another global wich is telling 2 last hour rain and compare if its greater than 0... But still have this trigger problem...

Thanks!


#2

How does your other piston work? Does it poll twcweather? Maybe you can utilize the same piston to do the reverse. Post a green snapshot of it maybe we can give suggestion/s. Remove any api key/token if there’s any in the snapshot.


#3

Hi,
Thanks for reply! I use the twcweather in a piston to set a global @report up to date. Report is the long sentence weather (like: partly cloudy or rain shower etc)

   I would like to have a triger that start running the code if the value stay without 'rain' inside for let say 2h but it wont. I found out that when I use 'stays for 2h' it start a 2h timer from the time the piston ran... and after this 2h timer it perform the 'when true' part...

   So I simply use the @report change as trigger and check if it countain 'rain'. If yes, a local variable is set to 1. if not, if the same variable stays 1 for 2h then set it to 0.

  So, if it start raining, it will turn the variable to 1 as soon as my @report change to countain 'rain'. If it change again with rain, still to 1... and if it finally change to something without rain, it will wait for 2h and if still no rain it will turn it to 0.

  Later in code, I use this variable as a condition to turn on my device... I m about to make some test with notification to see but seems to work! It have a 'eait' function but I think that it simply wait and I would be forced to check the report again and if it changed while the waiting time it wont 'reset' the wait timer...and I think that it could be complicated to let the piston run while the waiting time and I would be forced to use the assync...etc..

   For now the timer seem not to block the piston execution at the same time but I m not sure...

If you have any info about those functions it would be great! For now I m doing test but as soon as I have something I can provide a snap , could be usefull… or if I get any trouble!


#4

here what I have done

with this its working great! So the watering period turn a local to 1 and return it to 0 after ‘stays for’ and if the rain local is 0 it will trigger if still in watering period!

thanks, hope it will help someone with same question!