RTS I’m aware that the “Day or Night” Plugin has the ability to offset the sun set/sun rise but that would offset all PLEG or LUA that uses it, is there a way to perform that offset within a specific PLEG code? If not I guess I could have multiple “Day or Night” Plugins with different offset as needed.
Just use the D/N plugin for the trigger [tdayor !tDay], add it as a condition and do the maths [-xx:xx:xx or +xx:xx:xx] for every different instance that you require in Conditions. Make sure that tDay and cDay are before any other conditions you create. You might be able to simplify it by omitting cDay, (not sure if tDay gives a timestamp, cDay will?).
Trigger tDay
C Day tDay
Adjusted Time C Day- xx:xx:xx
Won’t hurt to try.
@zedrally, thanxs for the comeback, If I understand you the below PLEG should work? Is there any way of actually seeing the modified day value? In other words if its currently 5:00 pm the below statement would modify ItsDay to reflect 4:00 pm. Mike
t_ItsDay Day or Night indicates Day time.
c_Day t_ItsDay
c_Test c_Day -01:00:00
Followup: The above resulted in the following error msg
Lighting PLEG[12] : c_Day -01:00:00: Invalid Value token: 01:00:00
Also the c_Day resulted in a null value
Yep, I tried it as well, even adding brackets and using Not. ( !Day + 23:00:00)
The trigger provides a timestamp, but how to do maths with it is achievable, but this doesn’t appear to be the correct method.
We will have to wait until with greater knowledge steps in.
@zedrally, after stumbling in the dark… re another unrelated topic “Umbrella Topic” me thinks I’ve found the answer;
[quote=“johnes, post:14, topic:182444”]Sweet…
So, I create a schedule with a start type of Day of Week and use the After Sunset, etc. I assume then that I can use the Interval Stop Type and then put in a time there.
So I make my schedules, and then reference them in the Actions > Advanced part? Seems easy enough…
But let’s say I have one for:
[code]
Schedule A
start
Sunset
end
sunset + 2 hours.
Schedule B
start
Sunset + 2 hours
end
sunset + 4 hours[/code]
What happens if the end of ScheduleA overlaps the start of ScheduleB?[/quote]
So I make my schedules, and then reference them in the Actions > Advanced part? Seems easy enough...Quite so. For example this will set a dim level of 65 between sunset+2 and sunset+4, 50 between sunset+4 and sunrise or 100 for the rest of the day:
Schedules
Dusk Start: Sunset + 2 hrs, Stop: Sunset + 4 hrs
Dark Start: Sunset + 4 hrs, Stop: SunriseActions
CName Light SetLoadLevelTarget newLoadlevelTarget={(Dusk ? 65 : Dark ? 50 : 100)}
You are way over thinking this …
If you want to roll your own Day or Night …
Create a TIMER input
ON EveryDay at Sunrise +/- your desired offset
OFF EveryDay at Sunset +/- your desired offset.
thanxs much Richard, story of my life "over thinking things! : in the example I wanted to start the timer event 1 hour prior to Sunset, do I have to enter an OFF event or it OK to just initiate with a ON “before Sunrise” +/- my desired offset?
If you do not have an OFF event the input will always be true.
If you use it in a condition … you will want to turn repeats on (because you want the condition to fire the next day even if the input is on today!)
But I usually turn things back off … say 1 minute later … or whatever is an appropriate time based on the logic.
Thanxs for the support, per your advisement I will turn on repeats and turn the timer off after a few minutes.
If you turn the timer OFF … you do NOT need to turn REPEATS on.
Understand, also repeats is only good for conditions and Sunset/Sunrise retrigger is not available within Timers.
If you want to know the details …
Actually Repeats apply to associated actions …
When a condition/input is updated the associated action will only run/fire if the condition/input changes values unless the Repeats is specified … in which case it will always run/fire.
Input’s are updated at the discretion of the associated device software or Vera system functionality. Most devices in Vera will not issue an update unless a value changes.
Conditions are updated when an input is updated and a condition references the input, or another condition which ultimately references the updated input.
Conditions often have multiple inputs that can cause the value to change. An update to any of these inputs will cause the Condition to be [/b]updated[/b].
It’s possible to update an input or condition and the the value NOT to change.
It’s in these cases that the Repeats flag is useful.
Thanxs for the guidance. For some of us who don’t use PLEG on a regular basis some of the nuances are easily missed when either revisiting and/or creating new PLEG and/or LUA scenario. I will add your post to my many cut/past PLEG notes. :-[