Having an issue getting time to report as true


#1

1) Give a description of the problem
I created this piston to automate the lights on my main floor of my house, such that when the motion detectors detect motion and no lights are currently on, it will turn on three specific lights. Will also turn every light off if no motion is detected for 20 minutes. I recently tried to enhance it such that if its night time, and I come down for a drink of water, just a two lights come on dimly, and then go off after five minutes.
I’m having an issue where if I come downstairs after 5:30 am and I’m not in night mode, the three lights don’t come on to 50% brightness. Instead just the two lights come on, like its still night.

2) What is the expected behaviour?
When motion is detected after 5:30 am and the mode is not night, all three lights should come on at 50% brightness.

3) What is happening/not happening?
Just the two lights come on at 20% and 2% brightness.

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

5) Attach logs after turning logging level to Full

+293ms ║║Condition #48 evaluated true (5ms)
+303ms ║║Comparison (time) 24596963 is_between (time) 75600000 … (time) 19800000 = false (7ms)
+305ms ║║Condition #64 evaluated false (10ms)
+306ms ║║Condition group #47 evaluated false (state did not change) (17ms)
+311ms ║║Comparison (string) :d803784e76edcbc4da05168b3ab6e021: is_any_of (string) :dfcad90a22cf1240791c35803383abdb:,:462103c2816251d4e40f46ba791cf9c6: = f

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


#2

I can simplify this part.
By using the motion sensors as MAIN TRIGGERS.

IF any of motion sensors X, Y, Z changes to active 
then 
     IF lights A, B, C is on
     Then 
     Do this do that
    
     IF lights D, E, F is on
     Then do this do that


IF all of the motion sensors stays inactive for 20 minutes
Then
do this do that

#3

Could this be because my time range spans more than one day? Maybe I need to break this up into two times, 9 pm to 11:59 pm or 12:00 am to 5:30 am? Is their an easier way to implement this?


#4

image

When spanning midnight, I like to use…

IF Time is NOT between 5:30 AM and 9:00 PM

This will capture all times between 9 PM and 5:30 AM, spanning the midnight hour.


#5

The webCoRE code is smart enough to handle times crossing midnight.

Your piston log shows the time being compared as 06:49:56 AM so it is understandable that the comparison would fail. What time do you think it should have said?


#6

So I think I figured out what my problem was… To recap the problem and maybe explain it better, my wife wanted the 3 dimmer lights to come on at 50% brightness when she comes downstairs at about 5:45 am. What was happening instead was that no lights were coming on at all. Not even the two lights on dim - the mode was still night, but it was outside the 9 pm to 5:30 am window.

This was happening because when she came down at 5:45 and triggered the motion detector, the built in “good morning” automation in ST changed the mode from night to home. But the piston must be finishing before the mode finishes changing to home, so when it was hitting line 102, the mode was still night, preventing the 3 lights from coming on.

So I just added “night” to the list of allowed modes on line 102, and I think that fixed it. I guess lines 73 and 102 are now duplicates, and I should probably just remove line 102 and put its actions in an else statement?