Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
SunTracker - with moving ghost
Re: SunTracker - with moving ghost
I would like it to turn on at 2300, 0r 2359 and off at 0600...
but the plugin doesn't allow those timelines..
but the plugin doesn't allow those timelines..
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
For fixed time settings you should use the scheduler plugin. It is also there for download somewhere in the plugin section
Best regards, Walter
Edit: you find it here:
viewtopic.php?f=9&t=818&hilit=scheduler
Best regards, Walter
Edit: you find it here:
viewtopic.php?f=9&t=818&hilit=scheduler
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: SunTracker - with moving ghost
Hello Walter, i would like to use your Sun Tracker besides switching my lights at sunset/sunrise also in dependance to the weather conditions. Meaning, if the weather is cloudy, rainy, etc, bad by my definition at f.e. 14:00 i would like to switch on some lights. Would you mind to give me a little help for this Python Script? I can┬┤t find the variable that holds the status of the weather.
what i like to have is something like ;
if variable.weather is "cloudy","rainy", "etc":
eg.triggerEvent switchOnLight
else
do nothing
thank you for any help
h.
EDIT: another question: when using moving ghost (in a separate "controler") Light ON and Light OFF is happending the whole day and not in between sunset/sunrise. I have no times defined in the Night OFF/Morning ON/Evening OFF settings .... but even if, moving ghost switches ON/OFF during the day.
what i like to have is something like ;
if variable.weather is "cloudy","rainy", "etc":
eg.triggerEvent switchOnLight
else
do nothing
thank you for any help
h.
EDIT: another question: when using moving ghost (in a separate "controler") Light ON and Light OFF is happending the whole day and not in between sunset/sunrise. I have no times defined in the Night OFF/Morning ON/Evening OFF settings .... but even if, moving ghost switches ON/OFF during the day.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
Hello,
Regarding your script, there are several ways this can be done. The simplest is first to activate the function "Create weather condition events" in the plugin so that it sends the current weather event every minute. The events would typically look like this:
16:05:27 Main.Weather Condition: 'Clear'
Then you catch these events with a python script in one or several macros. The weather data is in the payload and you have to match it correctly. Below is a simple script example (you can of course delete or move the weather conditions according to your personal need) you can start to experiment with.
Best regards, Walter
You are right, this is a bug...I need to investigate this a bit.Light ON and Light OFF is happending the whole day and not in between sunset/sunrise
Regarding your script, there are several ways this can be done. The simplest is first to activate the function "Create weather condition events" in the plugin so that it sends the current weather event every minute. The events would typically look like this:
16:05:27 Main.Weather Condition: 'Clear'
Then you catch these events with a python script in one or several macros. The weather data is in the payload and you have to match it correctly. Below is a simple script example (you can of course delete or move the weather conditions according to your personal need) you can start to experiment with.
Best regards, Walter
Code: Select all
if eg.event.suffix == 'Weather Condition:':
theWeather = eg.event.payload
if theWeather in (
"Cloudy",
"Fog",
"Haze",
"Light rain",
"Overcast",
"Mostly Cloudy",
"Fair",
"Heavy Rain",
"Rain",
"Rain Showers",
"Rain Shower",
"Ice/Snow",
"Freezing Rain",
"Freezing Drizzle",
"Light Drizzle",
"Drizzle",
"Flurries",
"Rain and Snow",
"Showers",
"Snow",
"Light snow",
"Snow Showers",
"Isolated Thunderstorms",
"Thunderstorm",
"Chance of Showers",
"Chance of Snow",
"Chance of Storm",
"Scattered Showers",
"Mist",
"Dust",
"Icy",
"Smoke",
"Sleet"
):
eg.TriggerEvent('switchOnLight')
if theWeather in (
"Partly Cloudy",
"Clear",
"Sunny",
"Mostly Sunny",
"Partly Sunny"
):
eg.TriggerEvent('switchOffLight')
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: SunTracker - with moving ghost
Thank you Walter, your script works very nice. Right now i try to combine it with IsSunDown "true or false".
until now i fail
... i am getting errors when i try something like
can you tell me how to combine your script with IsSunDown?
EDIT: or another thought: how to combine the script that it is working in the time when the sunTracker-controller with all compensations (weather, etc.) in the night is NOT switched on (in between nn OFF and nn ON)?
It would be great if you could find the moving Ghost bug.
thank you for your help
H.
until now i fail
Code: Select all
if eg.plugins.IsSunDown == "false":
print "yes" (lights switch on/off depending on the weather)EDIT: or another thought: how to combine the script that it is working in the time when the sunTracker-controller with all compensations (weather, etc.) in the night is NOT switched on (in between nn OFF and nn ON)?
It would be great if you could find the moving Ghost bug.
thank you for your help
H.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
This script uses the sun state with weather compensation:
I believe you can actually use this simpler script. It uses the built in plugin function for getting the current sun status with compensation settings for weather and offset:
The parameters (0,30) are ('fixed offset compensation', 'weather offset compensation') and they are working in parallel.
I am not really sure how you like the light control to function. If you want the lights to stay on during the time sun is down, you could actually configure this in the plugin action itself without any need for additional scripts.
Best regards, Walter
Code: Select all
if eg.event.suffix == 'Weather Condition:':
theWeather = eg.event.payload
bSunIsDown = eg.plugins.Suntracker.IsSunDown(0, 30)
if bSunIsDown and theWeather in (
"Cloudy",
"Fog",
"Haze",
"Light rain", #For Google weather
"Overcast",
"Mostly Cloudy",
"Fair",
"Heavy Rain",
"Rain",
"Rain Showers",
"Rain Shower",
"Ice/Snow",
"Freezing Rain",
"Freezing Drizzle",
"Light Drizzle",
"Drizzle",
"Flurries",
"Rain and Snow",
"Showers",
"Snow",
"Light snow",
"Snow Showers",
"Isolated Thunderstorms",
"Thunderstorm",
"Chance of Showers",
"Chance of Snow",
"Chance of Storm",
"Scattered Showers",
"Mist",
"Dust",
"Icy",
"Smoke",
"Sleet"
):
eg.TriggerEvent('switchOnLight')
if not bSunIsDown:
eg.TriggerEvent('switchOffLight')
Code: Select all
if eg.event.suffix == 'Weather Condition:':
theWeather = eg.event.payload
bSunIsDown = eg.plugins.Suntracker.IsSunDown(0, 30)
if bSunIsDown:
eg.TriggerEvent('switchOnLight')
if not bSunIsDown:
eg.TriggerEvent('switchOffLight')
I am not really sure how you like the light control to function. If you want the lights to stay on during the time sun is down, you could actually configure this in the plugin action itself without any need for additional scripts.
Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: SunTracker - with moving ghost
Hello Walter, thank you again!
1) My goal is to switch my lights on and off according to suntrackers sunset/sunrise (plus OFF by my definition at f.e. 01:15) (at night) if me or my wife is at home.
2) If me or she is NOT at home moving ghost should randomly switch OFF/ON only in between sunset/sunrise (at night) (thats how i found the bug).
3) if me or she is at home during the DAY i would like suntracker according to the WEATHER switch ON/OFF the lights and do nothing when we are out (we are living on the ground floor and sometimes its getting very dark if the weather is bad).
right now 1) is working good, 2) is complicated with the bug and 3) seems to be solved with your help now
... i will test today.
for 3) i┬┤m using this script now (first line is to check if her or my iphone is logged into the wlan - thats another script defining a variable):
do you might know a workaround for the "moving ghost is also working day - bug"? i was trying with the command "moving ghost ON", "moving ghost OFF" from your plugin but do not understand how this works (there are no changes in moving ghosts behavior if i use ON or OFF)
best regards
H.
1) My goal is to switch my lights on and off according to suntrackers sunset/sunrise (plus OFF by my definition at f.e. 01:15) (at night) if me or my wife is at home.
2) If me or she is NOT at home moving ghost should randomly switch OFF/ON only in between sunset/sunrise (at night) (thats how i found the bug).
3) if me or she is at home during the DAY i would like suntracker according to the WEATHER switch ON/OFF the lights and do nothing when we are out (we are living on the ground floor and sometimes its getting very dark if the weather is bad).
right now 1) is working good, 2) is complicated with the bug and 3) seems to be solved with your help now
for 3) i┬┤m using this script now (first line is to check if her or my iphone is logged into the wlan - thats another script defining a variable):
Code: Select all
if eg.globals.IphoneNicoleOUT == "False" or eg.globals.IphoneHolgerOUT == "False":
if eg.event.suffix == 'Weather Condition:':
theWeather = eg.event.payload
bSunIsDown = eg.plugins.Suntracker.IsSunDown(-60, 60)
if not bSunIsDown and theWeather in (
"Fog",
"Haze",
"Light rain",
"Overcast",
"Fair",
"Heavy Rain",
"Rain",
"Rain Showers",
"Rain Shower",
"Ice/Snow",
"Freezing Rain",
"Freezing Drizzle",
"Light Drizzle",
"Drizzle",
"Flurries",
"Rain and Snow",
"Showers",
"Snow",
"Light snow",
"Snow Showers",
"Isolated Thunderstorms",
"Thunderstorm",
"Chance of Showers",
"Chance of Snow",
"Chance of Storm",
"Scattered Showers",
"Mist",
"Dust",
"Icy",
"Smoke",
"Sleet"
):
eg.TriggerEvent('LICHT ON')
if not bSunIsDown and theWeather in (
"Cloudy",
"Mostly Cloudy",
"Partly Cloudy",
"Clear",
"Sunny",
"Mostly Sunny",
"Partly Sunny"
):
eg.TriggerEvent('LICHT OFF')
else:
print "niemand da"best regards
H.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
I think I have found the bug with the moving ghost, we should try this one and see if it solves number 2) for you
Best regards, Walter PS
should be ???
Best regards, Walter PS
Code: Select all
2) If me or she is NOT at homeCode: Select all
2) If me AND she is NOT at homeMy released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: SunTracker - with moving ghost
Hello Walter, i┬┤m going to check moving ghost right now and this night.
Yes, it should be AND
i┬┤m getting back tomorrow
thank you
H.
Yes, it should be AND
i┬┤m getting back tomorrow
thank you
H.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
Hello, I have tested the moving ghost here as good as possible also by changing the local time in the computer and it seems to be working fine, at least here.
If you want to control the function ON/OFF you should select the "Enable Global Moving Ghost with external triggering" and then create a macro with a python script looking like this:
Then you can drop the events in the macro that shall trigger it and the script will change the Moving Ghost function depending on your presence at home or not. (try to figure out an event that doesn't confuse the system too much by coming all the time...)
What are you using to track if your iPhones are home or not?
Best regards, Walter
If you want to control the function ON/OFF you should select the "Enable Global Moving Ghost with external triggering" and then create a macro with a python script looking like this:
Code: Select all
if eg.globals.IphoneNicoleOUT == "True" and eg.globals.IphoneHolgerOUT == "True":
eg.plugins.Suntracker.SetMovingGhostON()
else:
eg.plugins.Suntracker.SetMovingGhostOFF()
What are you using to track if your iPhones are home or not?
Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: SunTracker - with moving ghost
Hello Walter, right now it seems to work perfect. Moving ghost is running since sunset and didn┬┤t before. Thats what i needed. I will keep on testing whats happening tomorrow after sunrise (hopefully the ghost stops to move)
My main idea was to have the ghost moving during night automatically, so the logic would be to switch moving ghost on if suntracker sets sunset (automatically) ... and the moment the ghost wants to switch on/off the lights i┬┤m checking if both iphones are out. With your script it┬┤s kind of the other way around (switching ghost on if iphones are out ... could use sunset/sunrise as a trigger?). Might be better ....! EDIT: mmh, this way there might be a problem when the status of the iphones change during the night/late evening.
For setting the variables IphoneNicoleOUT and IphoneHolgerOUT i use the ping-plugin. Checking every 1 minute if they are connected with the router over wifi and after 15 minutes without response define them as gone. To make those devices respond in a 15minutes-frame i had to switch them to pull emails every 15 minutes. (I figured out that this is far less power consumptive than have push switched on). I also use it to play winamp with her playlist when she┬┤s arriving at home. That helped to make her accepting me spending hours with programming
i will get back tomorrow and let you know if the ghost is still moving or not
thank you again for all your help
best regards
H.
P.S. is there any way to change the event for the weather from 1 minute to 10 minutes?
My main idea was to have the ghost moving during night automatically, so the logic would be to switch moving ghost on if suntracker sets sunset (automatically) ... and the moment the ghost wants to switch on/off the lights i┬┤m checking if both iphones are out. With your script it┬┤s kind of the other way around (switching ghost on if iphones are out ... could use sunset/sunrise as a trigger?). Might be better ....! EDIT: mmh, this way there might be a problem when the status of the iphones change during the night/late evening.
For setting the variables IphoneNicoleOUT and IphoneHolgerOUT i use the ping-plugin. Checking every 1 minute if they are connected with the router over wifi and after 15 minutes without response define them as gone. To make those devices respond in a 15minutes-frame i had to switch them to pull emails every 15 minutes. (I figured out that this is far less power consumptive than have push switched on). I also use it to play winamp with her playlist when she┬┤s arriving at home. That helped to make her accepting me spending hours with programming
i will get back tomorrow and let you know if the ghost is still moving or not
thank you again for all your help
best regards
H.
P.S. is there any way to change the event for the weather from 1 minute to 10 minutes?
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
Hi, I have modified your script a bit so that it only updates the weather approx every 10 minutes. It still triggers every minute to check if one of you are IN.
Best regards, Walter
Very interesting finding, I need to change my settings in my Iphone, thanks(I figured out that this is far less power consumptive than have push switched on)
Best regards, Walter
Code: Select all
try:
counter
except NameError:
counter = 0
if eg.event.suffix == 'Weather Condition:'
if counter == 0 or counter == 10:
theWeather = eg.event.payload
counter += 1
if counter > 10:
counter = 1
if eg.globals.IphoneNicoleOUT == "False" or eg.globals.IphoneHolgerOUT == "False":
bSunIsDown = eg.plugins.Suntracker.IsSunDown(-60, 60)
if not bSunIsDown and theWeather in (
"Fog",
"Haze",
"Light rain",
"Overcast",
"Fair",
"Heavy Rain",
"Rain",
"Rain Showers",
"Rain Shower",
"Ice/Snow",
"Freezing Rain",
"Freezing Drizzle",
"Light Drizzle",
"Drizzle",
"Flurries",
"Rain and Snow",
"Showers",
"Snow",
"Light snow",
"Snow Showers",
"Isolated Thunderstorms",
"Thunderstorm",
"Chance of Showers",
"Chance of Snow",
"Chance of Storm",
"Scattered Showers",
"Mist",
"Dust",
"Icy",
"Smoke",
"Sleet"
):
eg.TriggerEvent('LICHT ON')
if not bSunIsDown and theWeather in (
"Cloudy",
"Mostly Cloudy",
"Partly Cloudy",
"Clear",
"Sunny",
"Mostly Sunny",
"Partly Sunny"
):
eg.TriggerEvent('LICHT OFF')
else:
print "niemand da"
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: SunTracker - with moving ghost
Good morning Walter, power consumption may differ from iphone to iphone. Depending on Version, Firmware, amount of accounts you are pulling, etc .... but (for me and our two phones) it┬┤s the only way to keep them in this 15-minutes-frame.... and in our case helped a lot with staying "iphone-alive" at least a day (by switching off push, not just switching on the 15-minutes-pull additionally) ..... and it┬┤s always nice to not beeing connected with an Apple-Server! (as far as i know all push messages are going via apple). It┬┤s also helpful to switch off iphones "ping" application (in system control).
moving ghost seems to have stopped at sunrise ... but i have to wait to confirm.
the new script gave me an error:
11:33:00 Error compiling script.
11:33:00 Traceback (most recent call last):
11:33:00 SyntaxError: invalid syntax (65, line 6)
i┬┤m not enough experienced in Python to know why.
Anyway, my problem with pulling the weather every minute is the amount of messages you get in the log. Quite hard to find other messages after a while. I assume with the new script the amount of messages stay the same, just firing the event will only happen every 10 times?? ( i wasn┬┤t clear in my previous post, sorry)
best
H.
moving ghost seems to have stopped at sunrise ... but i have to wait to confirm.
the new script gave me an error:
11:33:00 Error compiling script.
11:33:00 Traceback (most recent call last):
11:33:00 SyntaxError: invalid syntax (65, line 6)
i┬┤m not enough experienced in Python to know why.
Anyway, my problem with pulling the weather every minute is the amount of messages you get in the log. Quite hard to find other messages after a while. I assume with the new script the amount of messages stay the same, just firing the event will only happen every 10 times?? ( i wasn┬┤t clear in my previous post, sorry)
best
H.
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
Embarrassing
should of course be and is more clearly written
Maybe more errors will follow...
Regarding the frequency of the event populating your log, I have no setting available to avoid this. Instead there would be a possibility to fetch the weather condition from the script instead but it will require a small design change of the script with a timer that re-starts it let's say every 10 minutes. I can have a quick look at this...
Also, to avoid entries in the log is very difficult with scripts because they always leave a footprint, at least when they are executing. To make a really silent solution, you would need to make a plugin.
Best regards, Walter
Code: Select all
if eg.event.suffix == 'Weather Condition:'Code: Select all
if( eg.event.suffix == 'Weather Condition:' ):Regarding the frequency of the event populating your log, I have no setting available to avoid this. Instead there would be a possibility to fetch the weather condition from the script instead but it will require a small design change of the script with a timer that re-starts it let's say every 10 minutes. I can have a quick look at this...
Also, to avoid entries in the log is very difficult with scripts because they always leave a footprint, at least when they are executing. To make a really silent solution, you would need to make a plugin.
Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
-
krambriw
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: SunTracker - with moving ghost
Here is another version of the script that is fetching the weather condition instead of getting it via an event. Once started, it will run again every 10 minutes until it is stopped. You can stop it by running a python command or by terminating EG.
One important notice: your global variables "eg.globals.IphoneNicoleOUT" and "eg.globals.IphoneHolgerOUT" must be existing BEFORE the script executes. If you put this script in the Autostart folder in the EG tree after the module that takes care of the initialization of the global variables above, it should be fine. Eventually you need also to add a wait statement in between.
If nothing else, we could add a try/except to the script as well but lets test this first.
Best regards, Walter
Code: Select all
eg.globals.end = TrueOne important notice: your global variables "eg.globals.IphoneNicoleOUT" and "eg.globals.IphoneHolgerOUT" must be existing BEFORE the script executes. If you put this script in the Autostart folder in the EG tree after the module that takes care of the initialization of the global variables above, it should be fine. Eventually you need also to add a wait statement in between.
If nothing else, we could add a try/except to the script as well but lets test this first.
Best regards, Walter
Code: Select all
def TheTask():
theWeather = eg.plugins.Suntracker.GetWeatherCondition()
#print theWeather
if eg.globals.IphoneNicoleOUT == "False" or eg.globals.IphoneHolgerOUT == "False":
bSunIsDown = eg.plugins.Suntracker.IsSunDown(-60, 60)
if not bSunIsDown and theWeather in (
"Fog",
"Haze",
"Light rain",
"Overcast",
"Fair",
"Heavy Rain",
"Rain",
"Rain Showers",
"Rain Shower",
"Ice/Snow",
"Freezing Rain",
"Freezing Drizzle",
"Light Drizzle",
"Drizzle",
"Flurries",
"Rain and Snow",
"Showers",
"Snow",
"Light snow",
"Snow Showers",
"Isolated Thunderstorms",
"Thunderstorm",
"Chance of Showers",
"Chance of Snow",
"Chance of Storm",
"Scattered Showers",
"Mist",
"Dust",
"Icy",
"Smoke",
"Sleet"
):
if not eg.globals.lights_ON:
eg.TriggerEvent('LICHT ON')
eg.globals.lights_ON = True
if not bSunIsDown and theWeather in (
"Cloudy",
"Mostly Cloudy",
"Partly Cloudy",
"Clear",
"Sunny",
"Mostly Sunny",
"Partly Sunny"
):
if eg.globals.lights_ON:
eg.TriggerEvent('LICHT OFF')
eg.globals.lights_ON = False
else:
print "niemand da"
if eg.globals.end == True:
eg.globals.end = False
print "Shutting down script..."
print "Script is stopped"
eg.StopMacro()
else:
remain = 600
print "Next execution will start in "+str(remain)+" seconds"
eg.scheduler.AddTask(remain, TheTask)
# Here we go...this is where the script starts
try:
dummy #Only used to initialise some variables at startup
except NameError:
dummy = 0
eg.globals.end = False
eg.globals.lights_ON = False
TheTask()
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM