Weather Offset Depending on Clouds


#1

1) Give a description of the problem
I have a simple Piston that turns on all lights one hour before Sunset. It works great.

I want to try and find a way of adjusting that offset due to cloud coverage. (anything more than 50%, set offset to 2 hours)

3) What is happening/not happening?
I added the Accuweather ST app but I cannot see how to add that into WebCore

I understand I would have to setup a variable to change my offset from the standard one to a dynamic one but that is pushing my current understanding of WebCore.

Any assistance would be appreciated

Thank you


#2

I tried, by looking at another example of

((contains($weather.conditions.current_observation.weather, ‘cloudy’))==‘true’?’-15’:’0’)

but this seems to ADD time to Sunset, rather than, take off time

So the goal would be if not cloudy, 1 hour, if cloudy, 2 hours

Thank you all again


#3

There must be a bug in that offset… not sure, see if you can do it this way.

I entered the offset values in milliseconds.

Edit: Hmm, doesn’t evaluate correctly… it’s adding an hour :confused:


#4

Same thing here. I have reached the extent of my WebCore knowledge at this point and I am totally stuck.

Appreciate your time


#5

Ah, sorry, rookie mistake, remove the minus sign from the values

I can hear James Edward Olmos in the background… a negative times a negative equals a positive. repeat!


#6

Does this look about right to you?

Right now, it shows as 23 hours (in change) until the next time it fires, which seems about right.

How often does the variable check for cloud cover? Since it seems to execute on a timer


#7

That’s what I was thinking about on the drive home. It was evaluating correctly each time I save the piston so it probably wouldn’t hurt to add another timer to execute the piston itself maybe 3 hours before sunset so you get the most current forecast, until you or I figure out a more efficient way.


#8

You might need to edit out the equal sign after the $sunset


#9

I have taken out the equal sign.

I just have to see about checking the weather daily before executing

Thanks again


#10

Here’s another version, at 3 hours before sunset every day, it should update the offset variable which will be used by the Wait until.


#11

That looks fantastic

I will report back tomorrow. Thank you!

edited to show my current Piston


#12

Two quick observations:

(1) Your last picture will wait thousands of seconds between each color light change. (is that intentional?)

(2) You are only searching for the word ‘Cloudy’… What about when it is Raining, Foggy or Overcast?


Here is how I do it. First I grab the current weather and store it in a string variable:

temp

Then I convert that string into an integer variable:

temp

Then I simply plug in an IF:

IF {rain} is greater than 7
    Then Turn on lights early
    Else Turn on lights at normal time
End IF

(The “greater than 7” can be any number you like, but I use 7 because it toggles an early light in all scenarios unless it is Clear, Partly Cloudy, or unknown)

Also, for the really observant folks out there, I left gaps in my number sequence in case I need to squeeze in a new weather description in the future.


Another bonus of converting the weather description into a number:
You can add a single line of code to that piston to output a gauge on your dashboard.

temp


#13

I did notice I had it in seconds. I have updated to milliseconds so that should be fine

For your suggestion though, I cannot seem to connect / find the data for wuCurrent

I only have $weather as a variable. You will have to forgive me just getting into all this now


#14

wuCurrent is my own variable, pulling from the same place as you did:
$weather.conditions.current_observation.weather
I just did not want that long code written out 9 times.


In other words:
temp
is on a line before the {rain} variable


I will edit that post now to make more sense


#15

I will have to admit, I am getting a little lost

I have my string variable and my rain variable

although, my rain variable is returning 0.

Where I am getting stuck is my If Statement.

I only want this to run around sunset

So I have a every day, 3 hours before
then an If statement to check if the variable is greater than 7

then I really need to execute, my lights on, sunset - 2 hours
OR sunset -1 hours

that last statement seems to have crossed me up

once again, thank you everyone

edit: another question. If I go back to the original offset variable eibyer. In the dynamic offset, could I look for and/ors

ie …“cloudy”,“snow”, etc

or do the variables not work like that ?


#16

Why not use lux as the trigger? That’s what I do to control inside and outside lights (different lux levels). Sunset with offsets wasn’t working for me when what I really wanted was just to turn them on when it got dark.


#17

I don’t think I have a Lux sensor at all, I could use


#18

I use the lux from the Weather Tile 2.0. It pulls it from a local weather station. Then I have a piston that evaluates the lux and sets ‘dark inside’ and ‘dark outside’ global boolean variables. They’re different because it gets dark inside before outside. Then other pistons turn on the inside or outside lights when it gets dark.

Temperature Sensor 1 is Weather Tile.


#19

That is a cool idea. I will give that a shot, thank you


#20

OK

So here is what I have done…I am sure this is not efficient or may not even efficient.

I took the lux global piston from @Equis

then, I set this up for my weekday lights. Turn on early if someone is home, turn on later if no one is home

Will this constantly fire to check the variable ?

Thank you all again for your help