Help with sunrise offset, and review please


#1

1) Give a description of the problem
I can’t figure out how to define 20 minutes after sunrise
I also am lost regarding running once per day.
LOL I’d ALSO like a review - this is one of my first I just did!

2) What is the expected behaviour?
After 5am, when my stairway motion detector detects motion:
The sink light turns on, and the Honeywell Alarm disarms.
If it’s ALSO before Sunrise (ideally before 20 minutes AFTER sunrise!):
The deck, foyer, kitchen, office, and yard lights turn on.

3) What is happening/not happening?
I do not see an option for “20 minutes” after sunrise.
I do not know how to simply and easily run this once per day.

**4) Post a Green Snapshot of the piston!

(update: someone just came downstairs… And the alarm made a “disarm” tone. Ok, what did I do wrong??)

(Second update: I realize - it’s after 5am, and without the “once a day” thing, of course the alarm will disarm on motion, no matter what time it is! So I need either “once a day” (preferable) or I could just limit, say, from 5am to 10am. I’d rather once a day it, though.)


#3

Thanks for the offset info! Looks like it will work.

For the other (once a day) - this doesn’t happen at a set time every day, it could happen anytime (after 5am, whenever someone wakes up and comes downstairs). To me, the picture LOOKS like the timer triggers the piston every day at 4:27pm. Am I reading it wrong?

Also - where would I add it?

Thanks!


#5

Heh, I’m sorry, then I REALLY don’t understand. I’m really a beginner at this.

So using your example, but using my 5am for mine… Wouldn’t it just trigger every day at 5am, instead of once a day after 5am when there’s motion?

The reason I’d like it that was is - before 5am if someone comes downstairs, they just want water or something - keep the lights off and alarm still set, don’t trigger piston.

If someone comes downstairs after 5am, then they’re up and ready to start the day. But then after that if someone ELSE comes down, any lights that were turned off will turn back on, and the alarm will do that “BONG” disarm sound even if it’s already disarmed. That’s why I only want this to trigger once per day.


#6

I apologize for butting in to the conversation, but wouldn’t it be a huge risk to your family if a motion sensor disarmed your house?!? What if someone climbed in your window?


#7

I’m going to agree with @WCmore with my appoligies for butting in as well…
Smart home systems are YET not efficient enough to trust with security related areas.
Signal drops, low battery levels, Sensors are not registering at 100% efficiency with ST HUB (or any other hubs) congested network issues etc…
any moment something can go wrong… At the moment it’s still in the area of a “Nice hobby”
When I first started I went all in thinking that my house was going to be like Tony Starks home:)))))
I realized very quickly that it’s not the case…
If something failing “even temporarly” could cause a serious outcome, I won’t leave it up to the smarthome systems.


#8

Well put Ike. Your examples are (hopefully) more likely than the one I mentioned.

Another way to say this:
Even if your SmartHome is running at 99.9% efficiency, then one out a thousand triggers may “skip a beat”. On a lightbulb, it’s no big deal. Just toggle or reconnect, and you are back in business. But when Disarming an Alarm with a motion sensor, (that may fire 40 times a day), then that 0.1% error could occur once a month.

Just for comparison, if it was a physical button that disarmed it, you’d likely only be pressing it once or twice a day, so that 99.9% success could take you a couple of years before you experienced an error.


Pro Tip:
If you have ActionTiles, this would make a great tile to add to your panel. (If you want to confuse any would-be-criminals, you can change the button name to an “innocent” name (such as Pantry?). You don’t want uninvited “guests” pressing the obvious Disarm button)


#9

Well, I discussed it with my SO - he says he’s fine with the alarm not disarming when he comes down (90% of the time, it’s him that wakes up and comes downstairs first!). I don’t yet have an LCD panel in my kitchen (that’s coming!) but there’s an alarm panel by the back door he said he can use - the first thing we do is let the dogs out.

SO - here’s my new one - it DID work this morning (minus the alarm, of course). We agreed we’d STILL only like it to run once a day so we don’t have to turn off a light the other turned off earlier.

Reading/researching the “once per day” thing - it seems like this weird mystery, in that there’s no one easy way to do it. No one code, no one switch, instead you have to make up virtual devices that turn on and off, etc… Am I wrong, is there an easy way? What’s the best way? I have a few other things I’d like to run once per day as well.


#10

One of the ways would be pausing the piston once it’s triggered.

IF MOTION is activated
If time is between this and that
Then 
Do some stuff
Pause piston "Morning lights"

now you wil need a second piston to resume this one

Everyday at 4.00am (lets say)
Resume piston "morning lights"

other than that, variables and simulated switches are your best friend:)))


#11

Oh that’s interesting. So, pausing, variables, and simulated switches… Can you (or is there a place to read) explain some of these? Or pros and cons of each, at least? Pausing/unpausing sounds pretty ideal, but clearly the variables and simulated switches wouldn’t be a thing if they were!

Edit: Oh, and where is “pause” located? and “Resume”?


#12

Variables and Switches are for many different things.
Coding is - in a way - like art, or singing the same song from different tones:))))
Everybody has their own way of doing it.

Let me give you an example from my home:
My main entrance door must be closed at all times (3 cats:))) and it can not be left open more than 15 seconds.
If so, alarm will go off…

The piston is very simple.
But when you start adding scenarios to the situation, switches, variables, pausing are needed for you code.

a) A friend comes by and we’re chatting in front of the door and the door is open.
I don’t want to go through my phone and click buttons so that I can shut off the alarm.
It happens automatically
If motion detected in front of the door and if the door sensor is open more than 30 seconds - which means we are talking - a variable changes from FALSE to TRUE and diverts the pistons 15 second alarm time to lets say 2 minutes. Now for two minutes alarm will not go off…
and even 15 second is not a 15 seconds it’s a variable. I don’t have to write another IF block for 30 seconds, I can just change the variable within the piston. Not manually, piston does it by itself.

b) A worker came to the house. He is in and out constantly. Cats are in the back and their door is shut.
I don’t need the door alarm.
I can pause the piston BUT i have to remember the RESUME it.
So instead I use a simulated switch that is on the wall mounted ipad on Action Tiles.
60 minute delay switch.
If I push that button (simulated switch) switch is ON now and that tells my piston to ignore any warning for the next 60 minutes.

c) I’m not home but I know that day randomly a lot is going to happen. Maid, visitors, friends kid etc.
again cats are in their side of the house. And I don’t want to try to teach people to push a god damn button every 60 minutes LOL
I just pause the piston completely. Again through a simulated switch on the Ipad.
When that feature is activated, a timer piston starts, that day after midnight, piston is RESUMED again. To make sure that we don’'t forget…

How to find PAUSE and RESUME:
When you add NEW ACTION
First choice is LOCATION
don’t scroll down the list, just click ADD TASK
now you will see a DO LIST
Scroll down, you’ll see PAUSE
and 4 after that is RESUME…


#13

Oh wow, thanks for the explanation - I get it!

So in “a”, each time motion is detected in front of the door and the door is opened more than 30 seconds, the piston’s 15 second alarm changes to 2 minutes. So after that 2 minutes, if the conditions are still met (motion and more than 30 seconds) another 2 minutes are added because that’s just how the original IF works, right? So every 2 minutes, 30 seconds, the alarm is extended 2 minutes. Then the piston takes 30 MORE seconds and THEN does another extension of 2 minutes. Do I have that right? Or are the 30 seconds wrapped into that 2 minutes.

I think I need a nap!


#14

LOL
as I said there are many different ways of writing the same piston…

This can be one way, and it’s a good one.
Mine just changes 15 seconds to 2 minutes. No adding, no extraction, just changing the time frame.
(Just because I never needed more than 2 minutes) personal preference.
IF it looks like it will be more, I’ll intive the person in.
IF i don’t have time to invite them in that means I don’t have more than 2 minutes anyway…


#15

I imported your “xb8pb” piston above, and added two lines of code plus a variable.
This addition will only allow the code to execute once each calendar day.

This method uses no virtual device, no switch, no timer nor loop. :+1:


#16

Whew! Ok, so here’s what I’ve come up with… It seems odd to me to have the resume/time (which is a minute EARLIER than the actual piston time) be at the END of it all, but as long as it works…

Curiosity - how would I have inserted the “resume” at the BEGINNING of an already-written piston? Is that necessary? If my above one was good, apparently not. If so - how?


#17

RESUME has to be a seperate piston.
Because once you pause this piston, it won’t be able to function anymore.
Morning lights 2 lets say.


#18

That’s… Pretty elegant. Can you go a bit deeper and explain what and how for me please? I can SEE it working, but I’d like to know how it’s interpreted.

Update edit: and if it’s not too much trouble, the steps you took to add what you did, so I can learn it and use it on something else when I’m ready.


#19

Would I be able to use one piston to restart multiple pistons that I want to be “once per” that I’ve paused? At different times, even?


#20

Technically YES but depending on the system load you have. That piston might cause some signal congestion problems.

I have around 300 devices in my house and if i write a piston that resumes 15 pistons at the same time, I’m sure some will be missed in the process.


#21

I have to ask, just for personal knowledge and not being snarky… Why? I mean, if there’s a page of code, it’s all basically binary “yes, no” or “1,0” or “on, off” and they’re all “at THIS time set THIS thing to resume”… How would one be missed?


#22

it’s not missed, everything you ask is in webcore and ready to use…
Just not in a format you want and/or used to… that’s all…

I can write piston and say AT THIS TIME RESUME THAT PISTON…