Yes, I think what you mean is also what I mean
krambriw wrote:Would the following also be worth considering:
- once triggered by your Power ON, should you have a loop that checks regularly? Lets assume that you watch TV from sunset to sunrise and never turns off...what would turn off your lamps in that case?
This would be an unusual scenario for me. What I did plan, however, is to make sure that if I start watching TV several hours before sunset, that the lights are automatically switched on 30 minutes before sunset. To do this, I enable a macro by a trigger event from switching on the TV. This macro that is now enabled will react to an automatically triggered suntracker event at 'sunset minus 30 minutes offset'. If the TV is not switched on (I am not at home, or not in the TV room), or if I switch off the TV before the suntracker trigger event will be issued (for instance I am already off to bed early), the macro is disabled, meaning that the lights will not be automatically switched on.
I have not tested this thoroughly yet, but I think by using this approach, I do not need the loop stuff that you suggest.
- if the weather is bad, it gets much darker inside. Should those 30 min be dynamically adjusted depending on the weather conditions? Like 30 +/- 15 depending on weather?
Yes, please! this would be great!
I tried to make a summary of the stuff that I use in Eventghost just for some clarification. see below. Note: I stripped several lines of text as I think they are just distracting.
Switching TV ON <Macro Name="TV ON">
<Event Name="USB_UIRT.RC5.Lightning1.1" />
EventGhost.PythonScript
if eg.plugins.Suntracker.GetContentsOfVariable(): #if it is daylight
EventGhost.Enable Item(XmlIdLink(442)) #it is not dark yet, but enable below macro to allow switching on lights automatically if I am still watching TV at 'adjusted sunset'
else:
eg.TriggerEvent("Switch on lights")') #if night time, switch on lights
Switching TV OFF <Macro Name="TV OFF">
<Event Name="USB_UIRT.RC5.Lightning2.2" /> #this is the event that gets triggered when switching off the TV
EventGhost.PythonScript
from time import sleep
if eg.plugins.Suntracker.GetContentsOfVariable(): #If daytime,
print "do nothing"
else:
sleep(10) #if is nighttime, give me 10 seconds to leave the room while lights still on
eg.TriggerEvent("switch off all lights")') #switch off all lights
Disable Below macro # this will be the default situation: when not watching TV, the lights in the TV room do not need to be automatically switched on.
Macro to make it possible to automatically switch on the lights if started to watch TV long before sunset. EventGhost.DisableItem(XmlIdLink(442)) #disable below macro when switching off TV
</Action>
</Macro>
<Macro Name='Trigger event watch TV at night"' id="442" Expanded="True">
<Event Name="Main.ON" /> # this is the suntracker event that gets issued at sunset-offset value of 30 minutes and weather compensated
<Action>
EventGhost.TriggerEvent('switch on lights', 0.0) #lights are switched on at above suntracker event if this macro enabled
</Action>
</Macro>
</Folder>
</EventGhost>