Trying Variables and Expressions to notify me of lights on or off


#1

1) Give a description of the problem
Push notification is not occuring on test (turning a light on

2) What is the expected behavior?
A Push that X light is on or off

3) What is happening/not happening?
No Push notification - I am trying to use expressions and variables.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS)


#2

try changing the $status is ‘on’ to switch is ‘on’


#3

Well that was silly easy @jkp . Ok here is a more complex question. If I uncomment out the second if, it will not run because is it the opposite time restriction as the top one correct?


#4

the image above only shows one IF block.


#5

Oh I guess the green option doesnt show commented out code.

Here is my other one. I have a restriction on the top and a if condition on the second If which makes me think it will cancel out.

Even though The first IF is between sunrise and sunset it is still pushing the notification to me now along with the second if that is the opposite time.


#6

Sunrise to Sunset happen in the same day. But Sunset to Sunrise are also in the same day (as far as webCoRE is concerned).

What you want is Sunset to next Sunrise. There is a system variable for $nextSunrise and that’s what you want to use. You have to make an expression to do that though.

image


#7

Oh Interesting logic.
So I would choose Virtual Device - Time
Preset Sunrise
Variable $nextSunrise.

Where does the expression come into play?

I assume for the second If i would have to repeat similar setup?


#8

Ha… It does not need to, now that you point it out to me. I just have a habit of making everything into an expression, even when it’s not necessary. It should work just fine the way you say (and the way I do it).


#9

ok. I was confused on the need thanks for confirming!


#10

It is still running the second IF at night…


#11

Shouldn’t it? Time is between sunset and the next sunrise, that’s true at night.

Alright, let’s back up a few steps. When do you actually want this piston to run? Do you really just want it to run AT sunrise, and then later in the day at Sunset? What triggers it off, someone turning on or off one of these light switches?

I think there’s a better way to accomplish what you’re looking to do here but I need to better understand what your goal is.


#12

Here is the piston

I was the first if to tell me if the lights are on during the day. The second If to tell me if those lights are not on at night.


#13

For the first one…your IF should be “Time is between sunrise and sunset”

You should only change the second one to $nextSunrise as you want it to compare time over midnight.

But I still don’t follow what you really want to Trigger this piston.

Is it Time, or a light switch being on?

So, are you trying to be continually notified all day long if a light is left on, or are you wanting to get reminded once in the morning and once again at night?


#14

If you just want two notifications per day, once at Sunrise and another at Sunset, do it like this:


#15

Continually because something is setting them off and I’m want to be notified what they turn on or off at the wrong times