Include Weather into house lighting condition


#1

1) Give a description of the problem
Would like to include weather as a condition in house lighting. I am also using Phone Presence as the initial condition.

2) What is the expected behavior?
Wife wants to save on electricity. So, I created sunset and sunrise variables. However, on cloudy, overcast or rainy days, the house is too dark and she wants the lights on. I was thinking about getting an luminosity sensor to solve this. However I thought I could use the conditions of the new cloud cover for $TWCweather.

3) What is happening/not happening?
I could use the communities assistance to help figure out logic to:

  • Retain my presence condition so it doesn’t even turn on if our phones aren’t there
  • Maintain the timing condition of keeping the lights off between sunrise and sunset
  • Add a simple check (for the expression) $twcweather.conditions.cloudCoverPhrase if the condition are any of “Partly Cloudy”, “Mostly Cloudy”, “Cloudy”.

Later, when the logic is fleshed out in the Piston I can get more detailed with $twcweather.forecast.daypart[0].wxPhraseLong

**4) Post a Green Snapshot of the piston![image|45x37]
Here is the existing piston for our family room

Here is my assumed logic - again could use assistance on this.
I can’t seem to get and (Or) statement between the time and the WX without changing the presence to (or) as well.

Any suggestions would be sincerely appreciated!

Thanks
-Walt

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Untested, but I believe the $twcweather needs to be inside the IF because webCoRE has no idea of the weather results until after the piston executes.


#3

Thanks @WCmore!

If I move the WX statement into the “IF” block, then I think this will still only be triggered within the specified times.

I am still looking for a way to keep my Presence - without it, the piston doesn’t run and my dog doesn’t turn on all the house lights running through the house like a maniac. :slight_smile:

I was hoping for something like:

Any of Presence sensor 1’s or 2’s presence is any of present
and
Time is between 90 minutes to sunset and 90 minutes past sunrise
OR
blah blah blah weather conditions statement.

It won’t let me put a single OR statement is changes both to AND or OR Argh.

Seems to me this would be the simplest way but I don’t have a mind of a developer. Sigh. :blush:


#4

Try making it nested, with the “IF time or weather” indented inside the presence IF.

By the way, my comments here are using “IF” instead of your “only when”. It is harmless for a piston to trigger when motion changes if you have IF’s below that can prevent things from happening in the first place.


#5

I’d probably do it something like this:

IF Motion changes to active         <-- Trigger
and
Any of Presence 1 or 2 is present   <-- Condition
Then
    IF Time is not between 90 min past sunrise and 90 min to sunset
    or
    $twcweather is whatever
        Then do stuff
    END IF
END IF

IF Motion stays inactive for 10 min  <-- Trigger
    Then turn off lights
END IF

Note

  • The “IF or IF” section has to remain conditions for this to work
  • I put the turn off in a separate IF (so it catches everything)
  • I inverted the times (so it does not span midnight)

#6

Hi @WCmore. Man, thank you so much for the updates and suggestions here. I’ve been pretty busy. I hope to check this out by this weekend. It’s not an emergency but you’ve give me some great ideas here.

Thanks so much! :wave:


#7

Going to give this a shot and see if it works. Logically it looks like it would be fine.


#8

Only one thing stands out to me (but it is easily resolved)

Currently, if the last person walks past the motion sensor, and then leaves the house a few minutes later, I don’t think the lights will turn off when they are gone. (unless your dog walks past the sensor once the house is vacant)

An easy solution is to turn off the lights in your “Leaving the House” piston.


#9

Thanks again for the follow up @WCmore. This is actually working fine.

The lights turn off after 10 minutes.

We had a few sunny “clear” days here in the NW about a week ago and i noticed that the default behavior (based on the piston) was to keep the lights off (what i wanted) because of plenty of sunshine.

However, since then, it’s been overcast and crappy here. The lights turn on and off throughout the day just fine! :slight_smile:


#10

Wouldn’t that “or” in your 1st If statement mean that your lights will turn on during the day OR if it is cloudy? I would think you need an “And” instead of the “OR”


#11

With the current wording in piston “h3s4”, it turns on at night, or anytime it is cloudy.


#12

you’re right. I read it backwards :slight_smile:


#13

So how to make a condition out of the illuminance guys?


#14

how to add “Any of” in the first “if” after the “and” like Lutraphobia did in h3s4?


#15

I set this up for my house but found that the TWC information was from too far away and with too much delay. Best to trigger this with an illuminance sensor. Even so, it’s not a trivial project. You’ll want some hysteresis and need to limit the sensor’s reaction to your lighting.