Jump to content

program sunrise/sunset question


Recommended Posts

A basic programming question--would appreciate some help here.

I created a program to turn off outside lights if they accidentally get turned on during the day.

looks like this:

If control 'xyz light' is switched on

Or control 'xyz2 light' is switched on

etc (list of about 12 controls)

And From Sunrise To Sunset (same day)

Then

Wait 10 seconds

Set xyz light' Off

Set xyz2 light' Off

etc (same list)

Doesn't seem to work.  the program Is saved and enabled.  I turn on a light in the list, and the program does not run.  The status is listed as true.  But the last run time was hours ago. 

This had been working when the same program was written for a single device.  Wondering if the And/Or structure is not what I think.  What am I missing?  Thanks.

 

 

Link to comment

Since you don't want any outside light left on, I would create a scene and add all lights to that scene. Then I would write a program that says:

From sunrise to sunset 

And

(Status light A is on

Or status light B is on

Or status light C is on)

Wait 10 seconds and set scene outside lights off

Link to comment

Thanks.  I did not put in the parentheses around all the OR lines.  Maybe that's the problem!

I also noticed you used status rather than control.  Both give the option to describe the lights as on.  What's the difference?

And for lights on a dimmer, there is no "on" option under status.  Just "responding" or the list of %.  Is responding the same as on to some degree?

Link to comment

For cases like yours, I prefer status, that way they turn off regardless of how they are turned on. One thing I would add is if you're using dimmers, I would say if switch A is not off. That way it accounts for the lights being dim and not necessarily 100%

With control, it'll only turn off if the physical switch gets pressed. Status will turn it off whether it's from physical control, voice control, app, etc

Link to comment

One other thing I like to do is create a Sunset variable, just a simple Boolean flag set to 1 or 0, and I have a program that just sets that, then I use that variable everywhere instead of the timing.  I did this so that I can have my sunset/sunrise offset from the actual sunset/sunrise and tweak everything in a single program.

Some other de facto Boolean I use:

A night variable, that current goes from 11 PM until our normal wakeup time, which runs different programs for different motion sensor times from the sunset trigger and also changes the on level and rate of many scenes and devices, so that the bathroom light doesn't blast you with light in the middle of the night and instead has a gentle ramp to 40%, 50%, or 60% depending on the light, and also dims lights currently on (which also changes the color temperature on my bulbs).

A bedtime variable, triggered when I push a keypad button, that disables most interior automations until our wake-up time.

A vacation variable, which runs randomized but otherwise normal lighting schedules only on lights visible from the outside of the house.

A home variable, which when set to 0 disables interior automations, sets the thermostat to away, and ensures everything is off and stays that way.

A party variable, for when we have people over, that over-rides the night variables and such in case people are in our home late, turns on some rarely used lights (and Christmas lights) and sets the bathrooms so they are on at 10-15% instead of off to make them easy for people unfamiliar with our home to see in.

I then have a few programs that just set these various states based on time, sunrise/sunset and offsets, and manual triggers, and they're used all over the place to change how the home responds based on its current status.  It's a much more complex arrangement to set up initially but it's much easier to maintain the programs as your automation grows larger since instead of changing a bunch of programs to, say, have evening programs start 30 minutes before sunset, you make a single change.  Adding conditions is also more flexible, like when I put the party mode in: I simply had other state variables not set based on the party variable.

 

Link to comment

I live on that technique. It really pays off when you have to change hardware and so many logics and programs are based on it.

I have temperatures that are averages of three sensors outside and toss out any input that is off by more than X degrees from the past average. This eliminates sensors the sun shines on at weird times of the year. I find it very advantageous to keep centralised information as it is easier to troubleshoot and change without disrupting all your logic in programs or change program logic without disrupting the programs handling the sensors. 

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...