Outside Night Light Piston


#1

Hi all

Im pretty new to Webcore, have a few basic pistons running and am currently trying to design a piston with randomness, i’d like to also add a notification in to ST of the actions.
I expect the light to turn on around times of sunset, and then again between early morning. Then check to turn off after midnight and sunrise

Currently the lights are not turning off.


#2

What are these lines for?

image

image


#3

Yo get randomness for a period of time after a certain time after sunset, i use the following expression
addMinutes($nextSunset, (110+random(10)))

I set a variable equal to the outcome and then the lights turn off sometime between 110 and 120 minutes after sunset. You could use something similar.


#4

Hi Eibyer,

Basically I dont want the outside light on all night, I’d like it to turn off around midnight, and back on a few hrs before the next sunrise, so I thought i’d build in the OR to retain in a single execute set of circumstances (if that makes sense) Happy to receive other ideas on putting this together, as I am a little new to this.

Heres my latest version:

Events yesterday:
18:01 Light turned on
18:29 Light turned off **<<—**not expected behavior
20:20 Manually turned light on via virtual switch
23:21 Light turned off
03:50 Light turned on
07:24 Light turned off

Im getting there :upside_down_face: but not quite

@Ryan780 thank you for the randomness idea, will put that to practice after ironing out the flow :flashlight:


#5

You aren’t using the time as a trigger, you’re using it as a condition. If you want it to take place at a specific time, you need to use “Happens daily at” instead of Time IS AFTER. IS after is a BIG range. That’s why you’re going to get wacky functionality. Also, I wouldn’t put lights on within a range. That won’t get the randomness you desire.


#6

Thanks again for the reply. Just to clarify, are the OR statements fine? or would you split off, and have and 4x IFs and change each IF “Happens daily at” ?


#7

If you really want them to come on at 3am, you can keep them. I just don’t see why. I would change them to happens daily at though.


#8

Thanks @Ryan780, its to add more/a little ‘presence’ in the small hours


#9

I like to thank all that have input in to this new piston (we’ve) created. My first experience of the forum has been great. :grin:

Here’s my latest version:

Ive added full logging for audit

MrT.


#10

Quick follow up.

My Outside light is performing exactly per design. Thanks again for the input. :dizzy::speaking_head: