[quote=“RichardTSchaefer, post:254, topic:173675”]You might be able to emulate large parts of this with PLEG … Although it will not be as nice a user interface.
PLEG has Schedules with a Start Time + Random Delta Time. It also has a Stop Time or Interval + an option Random Delta time.
That coupled with the fact that you can start some timers from the starting or ending of other timers can offer a lot of flexibility.[/quote]
If I want PLEG to randomly turn the lights on and off when I on vacation, between 18:00 and 23:00, each time for 30 minutes ± 20 minutes (i.e. each time it will be on for 30 to 50 minutes), and then being off for 20 minutes ± 5 minutes (i.e. each time it will be off for 15 to 25 minutes) I should do something like this:
Inputs - Device Properties: pVacationOn = Vacation Virtual Switch is On
Inputs - Schedules: sGhostTimerLightsOn = Start: Self Trigger; Stop: Interval after 30:00 minutes, Random off delay = 20:00 minutes sGhostTimerLightsOff = Start: Self Trigger; Stop: Interval after 15:00 minutes, Random off delay = 10:00 minutes
Conditions: cGhostLightsOn = (pVacationOn) AND Not(sGhostTimerLightsOff) AND (18:00:00;sGhostTimerLightsOff;23:00:00) cGhostLightsOff = Not(sGhostTimerLightsOn)
Actions: cGhostLightsOn: Start timer sGhostTimerLightsOn and Turn lights on cGhostLightsOff: Start timer sGhostTimerLightsOff and Turn lights off
@cafri,
Question in the original Ghost plugin I thought that the plugin was able to turn on/off each light in a random fashion, not sure how that is accomplished within your current actions, as their relying on the on the same timers. Would have expected multiple schedules to accommodate various random events. Mike
To my understanding, the “random off delay” adds a random duration to the off interval.
This way, “Stop Interval after 30:00 minutes, Random off delay = 20:00 minutes” means that the timer will stop after 30 minutes + a random duration of up to 20 minutes, bringing it to a total of a random duration between 30 and 50 minutes.
@cafri,
thanxs for the timer explanation. The question I think was trying ask is if I have ten lights that I want to have turned on randomly to each other and/or groups of lights turned on against different random events how would one accomplish this? Mike
Were you able to get this working? I have recreated much of your logic, but mine does not seem to be catching the start/stop time range correctly. I may be missing something here, but it seems when I remove the time condition, I can get it to fire correctly.
[hr]
Conditions:
cOutdoorLightsOff4 No Not(sOutdoorLightsOn4)
cOutdoorLightsOn4 No Not(Home) AND Not(Day) AND Not(sOutdoorLightsOff4) AND (20:30:00;sOutdoorLightsOff4;23:15:00)
Actions cOutdoorLightsOn4: // Ghost is the PLEG instance I dedicated for this test
Ghost StartTimer timerName=sOutdoorLightsOn4 intervalTime=
Guest Patio Lights SetTarget newTargetValue=1
You could use a virtual switch or multi-switch that determines when you’re on vacation and add that as a trigger in your condition. I personally specify a vacation schedule (e.g. from this time and date and this time and date I’m out) in schedules.
A feature of Vacation Ghost was setting a custom time schedule to start and stop the ghosts when activated. This way, some ghosts can start or end at different times. Using just the home status and day/night triggers, it seems to work OK in some very limited testing I have done.
I will test at some point using a schedule to flip a virtual switch and then evaluate its state to check how that works.
It’s possible to re-create it in PLEG but it’s troublesome since you’ll need a trigger for each light you want to control. Each light has two conditions (one for ON, one for OFF) that incorporates a schedule (e.g. from 9 AM to 5 PM) with a random interval (e.g. every hour, variation up to 15 minutes) . Each light then behaves independently from another light with each light having its own own random start and stop times.
@Laughing Man, Have you cobbled anything PLEG example(s) that would accomplish this? I would expect that since we’re talking about lights that it would be a limited set of house lights for example; Living room, Kitchen, dining room, and bedroom which would imply 4 triggers and a Day/Night, and eight ON/Off conditions. Mike
Bump! has anyone created a working Vacation Ghost PLEG? Mike
[glow=red,2,300]Update:[/glow] OK so I’m a little dense at times (old age?) Richard I believe you’ve provided the bread crumbs within another thread… Based on the recommendations the following code should be sufficient to create a Vacation Ghost replacement using PLEG? If I wanted other light(s) on a different random timer I would simply create another timer instance (e.g. sSunsetTo2300_2) and associated condition/Action? Mike
Properties:
pVacationSwitch - Status
Schedules:
sSunsetTo2300 - Start type Day of week, start time- 15 Minutes before sunset with 54 Minute random On time, End Type Day of Week, end time 22:30 with 1 hour Random Off time.
sRandomOnOff - Start Type Interval, every 30 minutes, random on delay 10 minutes, End Type Interval, random off delay 10 minutes
Conditions:
cVacationLights1 - Repeat - pVacationSwitch==1 AND sSunsetTo2300 and sRandomOnOff ? 1 : 0
Actions:
cVacationLights1 - Using the Advanced tab ...
Select Light Device
Action: SetTarget
newTargetValue: {(cVacationLights1)}
MNB, does yours work? If so, you can add a random interval so your condition would fire on/off randomly during your sSunsetTo2300 for the specified interval. What I had was
Schedules:
sVacation Absolute (Period of Time I’d be out of town)
sMorning Weekly 0600 to 0830
sEvening Weekly 1700 to 2100
sRandom Interval:01:00:00 00:15:00
Combined with the triggers that would evaluate true for conditions that turned on the lights every hour (+/- 15 minutes of randomness). I then had separate conditions that had the schedules and turned off the light that was turned on (using the same sRandom interval and incorporating say tKitchen for my kitchen lights being on). Problem was I had two conditions for each light I wanted a ghost for!
Unfortunately, I broke mine when experimenting with RichardTSchaefer’s advice trying to incorporate turning lights on and off in the same condition. Probably because I was using Triggers rather than properties since my GE switches don’t do instant updates of status. Experimenting with that now (gotta get it working before my vacation! haha).
@Laughing Man, I noticed that I was missing a condition and have updated my last thread to include it.
I need to build it and test.
Looking at your sVacation Absolute I would have expect that to be via an virtual switch where as you would switch it On for Vacation and Off when your back? Mike
I use a schedule out of personal preference since most apps can’t click on the PLEG plugin. Accidentally hit virtual switches before from my phone so I stopped using them when I could. But you could also use a virtual switch. The condition would still evaluate true as long as the triggers and schedules evaluate true.
I’m not having much luck using newTargetValue={(tHallway ? 1 : 0)} to consolidate my ghost lights for my hallway. Strangely it works for my logic that links together the lights when you hit the switch. Going try LUA code instead since I know the ghost logic works when I leave the newTargetValue field to 1 to turn lights on.
Three sIntervalGhosts are used since each interval seems to count as only one instance no matter how many times it’s used in a condition. My previous attempts to only use one Interval meant that all the lights that were set to go on/off would all trigger at the same time since the randomness in the random on delay would be the same. By using three different intervals (despite them having the same random on/off delays) it avoids this scenario since we have three different instances where the randomness in the random on delay will be different across the three ghosts. You could probably add even more ghosts and use ORs in your expression if you wanted to add more complexity.
Conditions:
Name: cGhostMasterB
Repeat: Yes
Expression: sVacation AND (sMorning OR sEvening) AND !cSomeoneHome AND sIntervalGhost2 ? 1 : 0
State: (will be 1 or 0 depending if condition is true)
The expression checks “sVacation” to determine if I’m on vacation. You can use a virtual switch, multiswitch, or even the Google Calendar plugin if you want. So once it becomes October 10, 2015 at 5:00 PM, “sVacation” is true. “(sMorning OR sEvening)” is used to constrain the lights turning on/off randomly to morning or evening to mimic normal presence. You can remove this if you want your lights to turn on or off regardless of time. Since my home gets natural light during the day it wouldn’t make sense to turn on the lights then. If you do remove it, you should have some schedule in place for when you do want the lights to turn randomly on/off, otherwise you’ll have lights going on/off forever.
“!cSomeoneHome”, this piece checks the “cSomeoneHome” condition to verify that nobody is home or house sitting. It can be removed if you don’t want that check.
“sIntervalGhost2 ? 1 : 0”. This piece controls the random interval and how often the lights should be on or off. As explained above, I use three different ghosts so the lights don’t all turn on/off at the same time since that looks like it’s an automated program.