The Virtual Crib - Home Automation Software Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
How To: Sunrise Sunset times via Insteon PLC
Goto page 1, 2  Next
 
Reply to topic    The Virtual Crib - Home Automation Software Forum Index » Virtual Crib general discussion View previous topic
View next topic
How To: Sunrise Sunset times via Insteon PLC
Author Message
Humanzee



Joined: 22 Aug 2007
Posts: 519
Location: Seattle, WA

Post How To: Sunrise Sunset times via Insteon PLC Reply with quote
This will hopefully be a little guide to setting up your system to receive Sunrise and Sunset times through use of commands sent to the Insteon PLC.

1.) Figure out where you are in decimal latitude longitude format. Try google earth or something. Write them down, they should look like 47.#######, -122.###### where ###### would equal your specific digits, sorry you don't get to know what mine are exactly. Shocked

2.) Go to the commands tab in vcrib admin and create a new command called "SetLatLong" Select your process as "Insteon PLC Main" your type should be "SetLatLong" and your parameter would be your lat, long as found in 1.) above separated by a comma space (47.#######, -122.######) no brackets needed, then click Add
Quote:
NOTE: some of these commands may get automatically created in versions after 0.0.6.0, check for existing commands before adding a duplicate. Of course you will still need to add your coordinates and hit update.


3.) Open the Insteon SDM its the little icon in the system tray that looks like a T. With the window open type "dm" to open the command line. With this window open, go back to the commands tab in admin.exe and hit execute on your new command. You should be able to see some stuff happening in the SDM like:

ui:SetLatLong=47.######, -122.######
PLC:setlatlong=true,47.######,-122.######,true,suntable downloaded
uifinished:SetLatLong=47.######, -122.######
PLC:saladapp=busy
PLC:eventraw=53
PLC:eventraw=FD
PLC:eventraw=FE
PLC:eventraw=FD
PLC:eventraw=FE
PLC:saladapp=free

4.) While you are in the SDM you can try a command like "getlatlong" to see if your values stuck. If they did, try "getsunrise" or "getsunset". If these respond with reasonable values you are on your way. If so go to 6.)

5.) if 4.) didn't work and you get some error you may need to download the timercoreap. Try the command: "dl=insteon.net:timercoreapp12" then "DownloadCoreApp" Go back to step 3.)

6.) So the PLC is giving good info so now to get it into vCrib. We need to create 2 more commands, one for GetSunRise and one for GetSunset.

Name: Get Sunrise
Process: Insteon PLC Main
Type: getsunrise
click Add

and do the same for getsunset.

7.) When you run the getsunrise or getsunset commands you should see that the variables SUNRISE and SUNSET on the settings tab are populated with times. The variables SUNRISE OFFSET and SUNSET OFFSET are there to hold a value for the amount of time you want to change the SUNRISE or SUNSET values to arrive at the values stored in SUNRISE ADJUSTED and SUNSET ADJUSTED. For example a SUNSET OFFSET of "-01:15" will set the SUNSET ADJUSTED value to 16:45 if the SUNSET value were in fact 18:00. This is used where it might actually get dark some time before the actual sunset time. Same thing for sunrise offset. A positive offset number will say that its actually dark till after sunrise.

8.) So whoopee you have sunrise and sunset value that you can use. Now what? Well you need to make sure that you run the getsunrise and getsunset commands each morning before sunrise so that the correct time is used each day. To do this we need to first create a TIME Condition to use in an action. Go to the Conditions Tab and make a new condition.

Description: A Time = 1:00 AM
Type: Time Based
Start Time: 01:00
End Time: 01:00
Event Parameter: TIME in the next select box.

9.) Now the Action to update sunrise sunset. On the Action Tab Create a new action called "Update Sunrise and Sunset Times"
Trigger: A Time = 1:00AM (The condition you added in 8.)
Condition: leave blank
Command: Add "Get Sunrise" and "Get Sunset" per the command names you created in 6.)

Make sure the action is enabled and you select a limit of more than 60, this will prevent the command from running repeatedly during the minute of 01:00-01:01.

10.) So how do you use it? Go back to the Conditions tab and add some more Time Based Conditions. This time instead of using a military time value put in for your start time as.
[VARIABLE=SUNRISE ADJUSTED] with the brackets
and your end time
[VARIABLE=SUNSET ADJUSTED]
with a Event Parameter of TIME in the next select box.

You've just created a time range that effectively equals Daylight. Name it something like "A Time Range = DAY" If you reverse the order of the variable for start and end, you create a time range equaling night time. Both of these conditions will now update daily to a slightly different value. About 2-3 minutes per day as the seasons change depending on your location.

11.) Now you can use these ranges as conditions in actions. I.e.
Trigger = Yard OCCUPIED
Condition that must be met...= A TIME RANGE = NIGHTTIME
Command = Yard Light ON

12.) If you want something specific to happen at Sunset or at Sunrise, create new Time Based conditions where the Start and End are equal to each other as either [VARIABLE=SUNRISE] or [VARIABLE=SUNSET] like you did with the 1AM condition. You can then use that Condition as a trigger in an action.


I use these sorts of time ranges and time triggers for all kinds of different actions. For example between SUNSET ADJUSTED and 23:00 I have the lights come on 100% bright. Between 23:00 and 23:59 I have them come on at 60% and between 00:00 and 05:00 I have them come on at 20%. This is bright enough to avoid stubbing your toes etc. If then you also add the condition that the light must be OFF before the action can run, the lights will not dim on you if you Turn them UP or if the room remains OCCUPIED between changes in time range. One thing to remember though is that vCrib does not like time ranges that span midnight. You need to end one at 23:59 and start the next at 00:00.

You can also create other variables to store times such as alarms times and reference them in conditions in the same way. But Variables are for another thread.

_________________
vCrib Tester #1, Forum moderator, using INSTEON devices, X10 sensors and remotes via W800RF, All doors are wired with contact closures.
vCrib Wiki

Last edited by Humanzee on Thu Jan 08, 2009 1:53 am; edited 3 times in total
Thu Feb 21, 2008 11:26 pm View user's profile Send private message
CribKeeper
Site Admin


Joined: 09 Aug 2007
Posts: 653
Location: Overland Park, KS

Post Reply with quote
Nice write-up. We need that copied to the Wiki. It seems so much easier in my head. I thought more of the commands were auto-created, I uess it is just the command types. I will create some of those commands and actions automatically in the next Insteon compile.

You coverted a lot of bases there, defintely shows how complicated the system can be. Time ranges will get better, bob got me started coding on some new stuff tonight already. I wil think it over while falling asleep in a few minutes.

Vaughn

_________________
the Crib Keeper
www.vcrib.com
Thu Feb 21, 2008 11:40 pm View user's profile Send private message Visit poster's website
Humanzee



Joined: 22 Aug 2007
Posts: 519
Location: Seattle, WA

Post Reply with quote
I was going to do some screen captures, but my wireless keyboard at that machine doesn't have a good mouse for croping and drawind arrows. Maybe for the wiki, though as you say, some of this might get done automatically in the future. Thus the dificulty in documenting a moving target.

_________________
vCrib Tester #1, Forum moderator, using INSTEON devices, X10 sensors and remotes via W800RF, All doors are wired with contact closures.
vCrib Wiki
Fri Feb 22, 2008 12:32 am View user's profile Send private message
SnyperBob



Joined: 22 Aug 2007
Posts: 630
Location: Illinois

Post Reply with quote
Hmmm, I'm going to try this out. I just came across this thread. I didn't have a PLC initially so I could never do this. Now that it's summer and the days are longer, my lights kicking on at the preset 7 pm is way early. Still bright outside and I have the lights kicking on, lol

I don't have any x10 motion sensors with the light detector built into them, this PLC thing should really do the trick!

_________________
Visit the vCrib Wiki!

Clever image to be inserted here soon.... Smile
Tue Jul 08, 2008 1:34 am View user's profile Send private message Visit poster's website AIM Address
SnyperBob



Joined: 22 Aug 2007
Posts: 630
Location: Illinois

Post Reply with quote
Hey guys,
I think I got up to step 5 of Humanzee's post, but I'm not getting good values for getsunrise and getsunset in the InsteonSDM window. Here's my log:

Quote:
ui:SetLatLong=41.52, -88.11
PLC:setlatlong=true,41.52,-88.11,false,TimerCoreApp not loaded
uifinished:SetLatLong=41.52, -88.11
ui:dl=insteon.net:timercoreapp12
uifinished:dl=insteon.net:timercoreapp12
ProgressStart
ProgressMax=4606
Progress=0%,0,4606
Progress=1%,64,4606
Progress=2%,128,4606
edited out needlessly long text
Progress=98%,4544,4606
ProgressStart
ProgressMax=4606
Progress=0%,0,4606
Progress=1%,64,4606
edited out needlessly long text
Progress=97%,4480,4606
Progress=98%,4544,4606
Progress=100%,4606,4606
ProgressEnd=True
PLC:saladapp=busy
PLC:eventraw=FD
PLC:dl=4606
PLC:eventraw=FE
PLC:eventraw=FD
PLC:eventraw=FE
text=TimerApp Running

PLC:salad=initialized
PLC:eventraw=00
PLC:eventraw=FE
PLC:saladapp=free
ui:DownloadCOreApp
uifinished:DownloadCOreApp
ProgressStart
ProgressMax=1841
Progress=0%,0,1841
Progress=3%,64,1841
edited out needlessly long text
Progress=97%,1792,1841
ProgressStart
ProgressMax=1841
Progress=0%,0,1841
Progress=3%,64,1841
edited out needlessly long text
Progress=100%,1841,1841
ProgressEnd=True
text=Core App Running

PLC:downloadCoreApp=1841
ui:SetLatLong=41.52, -88.11
PLC:setlatlong=true,41.52,-88.11,false,TimerCoreApp not loaded
uifinished:SetLatLong=41.52, -88.11
ui:getsunrise
uifinished:getsunrise
PLC:EXCEPTION: ''2008/7/8 1090:7:0.0'' is not a valid date and time
ui:getlatlong
uifinished:getlatlong
PLC:getlatlong=41.52,-88.11
ui:getsunset
uifinished:getsunset
PLC:EXCEPTION: ''2008/7/8 1090:7:0.0'' is not a valid date and time


_________________
Visit the vCrib Wiki!

Clever image to be inserted here soon.... Smile
Tue Jul 08, 2008 5:54 am View user's profile Send private message Visit poster's website AIM Address
SnyperBob



Joined: 22 Aug 2007
Posts: 630
Location: Illinois

Post Reply with quote
It seems to have set my latitude and longitude.....but there is no time in either command. It still says timercoreapp not loaded as well.

I'm going to try to reboot and see if that works...

_________________
Visit the vCrib Wiki!

Clever image to be inserted here soon.... Smile
Tue Jul 08, 2008 5:55 am View user's profile Send private message Visit poster's website AIM Address
Humanzee



Joined: 22 Aug 2007
Posts: 519
Location: Seattle, WA

Post Reply with quote
The timercoreapp must be running, try step 5 again.

_________________
vCrib Tester #1, Forum moderator, using INSTEON devices, X10 sensors and remotes via W800RF, All doors are wired with contact closures.
vCrib Wiki
Tue Jul 08, 2008 11:29 am View user's profile Send private message
SnyperBob



Joined: 22 Aug 2007
Posts: 630
Location: Illinois

Post Reply with quote
Thank you!!! I rebooted by machine, and then I had to run the dl=insteon.net:timercoreapp12 command a second time.

So here's everything I did from the beginning.

1. Set up command in vCrib.
2. Ran command dl=insteon.net:timercoreapp12 in SDM
3. Ran command DownloadCoreApp in SDM
4. Rebooted machine
5. Ran command dl=insteon.net:timercoreapp12 in SDM a second time
6. Executed SetLatLong command in vCrib (with SDM command line open)
7. Logs in SDM indicated that the sun table was downloaded
8. Ran getsunset and getsunrise in SDM command line and now I can see correct times:

PLC:getsunrise=7/8/2008 5:26:00 AM
PLC:getsunset=7/8/2008 8:28:00 PM

Thank you! Now I'll try playing around with Step 6 - on....

_________________
Visit the vCrib Wiki!

Clever image to be inserted here soon.... Smile
Tue Jul 08, 2008 3:04 pm View user's profile Send private message Visit poster's website AIM Address
SnyperBob



Joined: 22 Aug 2007
Posts: 630
Location: Illinois

Post Reply with quote
I've never really played around with variables. Can you check the attached screenshot and let me know if this is correct for step 10 of your directions?

I think you should write up a tutorial or whatev just for variables. This opens up a whole new world for vCrib! I didn't think this sort of stuff was possible yet Sad Smile Smile

Thanks!



_________________
Visit the vCrib Wiki!

Clever image to be inserted here soon.... Smile
Tue Jul 08, 2008 4:11 pm View user's profile Send private message Visit poster's website AIM Address
Humanzee



Joined: 22 Aug 2007
Posts: 519
Location: Seattle, WA

Post Reply with quote
Yes, that looks correct. I also set individual conditions for "A TIME = SUNSET ADJUSTED" With the start and end time being set to [VARIABLE=SUNSET ADJUSTED] so that you can trigger actions based on the sunrise or sunset events. You'll also probably find that these can get tricky based on how you live versus when the sun comes up. I found that instead of using the "A Time range = DAYLIGHT" sort of condition in the morning I have set some others such as "Before Noon". Where I set the Start time to like 7:40 AM which is when I should be getting up anyway. Otherwise, the morning routines that are set for dim lighting during the sleep hours can get fooled by an early sun rise. I.e. today the sun rises here at 5:20 am, If I get up at 5:30 to take a wee I don't want the lights to come on full brightness. So that morning criteria is set to a reasonable time vs when the sun comes up. In the evening, I have the bedroom curtains close and the lighting levels change or become active at the Adjusted Sunset time.

In 0060 there is a change to the "type" in the insteon commands for getsunrise and getsunset they will be "Get Sunrise" and "Get Sunset" You'll need to update those commands once you get into 0060

You can get creative with variables, conditions and actions, I.e. Bedroom OCCUPIED Trigger, and Bedroom Curtains=CLOSED, and Bedroom=Dark and A Time Range = Afternoon then LIGHTS ON or Curtains OPEN Where as maybe if the curtains were already open the lights would not be needed. Likewise, I have my morning Alarm Clock times stored as variables as well as whether they are ON or OFF, that way on Saturday I can have a different lighting scenario that lets us sleep in the dark even if someone gets up after 7:40 am. I guess its time to start that thread about varialbes.

edited to correct variable names per SnyperBob's comment below.

_________________
vCrib Tester #1, Forum moderator, using INSTEON devices, X10 sensors and remotes via W800RF, All doors are wired with contact closures.
vCrib Wiki

Last edited by Humanzee on Tue Jul 08, 2008 8:32 pm; edited 1 time in total
Tue Jul 08, 2008 7:21 pm View user's profile Send private message
SnyperBob



Joined: 22 Aug 2007
Posts: 630
Location: Illinois

Post Reply with quote
Humanzee wrote:
Yes, that looks correct. I also set individual conditions for "A TIME = ADJUSTED SUNSET" With the start and end time being set to [VARIABLE=ADJUSTED SUNSET] so that you can trigger actions based on the sunrise or sunset events.


Wait, you just listed something different above.

You typed [VARIABLE=ADJUSTED SUNSET], but mine are set to [VARIABLE=SUNSET ADJUSTED]. Which is correct? Maybe that's why I'm having problems (see other thread I posted)

Thanks,
Bob

_________________
Visit the vCrib Wiki!

Clever image to be inserted here soon.... Smile
Tue Jul 08, 2008 7:32 pm View user's profile Send private message Visit poster's website AIM Address
Humanzee



Joined: 22 Aug 2007
Posts: 519
Location: Seattle, WA

Post Reply with quote
It needs to equal what ever the name of your variable is. My bad, I guess its "SUNSET ADJUSTED"

_________________
vCrib Tester #1, Forum moderator, using INSTEON devices, X10 sensors and remotes via W800RF, All doors are wired with contact closures.
vCrib Wiki
Tue Jul 08, 2008 8:30 pm View user's profile Send private message
Humanzee



Joined: 22 Aug 2007
Posts: 519
Location: Seattle, WA

Post Reply with quote
SnyperBob wrote:

uifinished:getlatlong
PLC:getlatlong=41.52,-88.11
ui:getsunset
uifinished:getsunset
PLC:EXCEPTION: ''2008/7/8 1090:7:0.0'' is not a valid date and time
[/quote]

Also I'm assuming that you redacted some of your coordinates, as 41.52,-88.11 is invalid I think. Looks like you got it working none the less

_________________
vCrib Tester #1, Forum moderator, using INSTEON devices, X10 sensors and remotes via W800RF, All doors are wired with contact closures.
vCrib Wiki
Tue Jul 08, 2008 8:39 pm View user's profile Send private message
CribKeeper
Site Admin


Joined: 09 Aug 2007
Posts: 653
Location: Overland Park, KS

Post Reply with quote
Ok, version 6 this needs to be updated because the Get Sunrise/Sunset commands are created for you by running the Insteon.exe application. New variables regarding Time have been added to and they are created by running the events.exe application.

Thanks,
Vaughn

_________________
the Crib Keeper
www.vcrib.com
Thu Jul 24, 2008 10:40 pm View user's profile Send private message Visit poster's website
SnyperBob



Joined: 22 Aug 2007
Posts: 630
Location: Illinois

Post Reply with quote
interesting!

_________________
Visit the vCrib Wiki!

Clever image to be inserted here soon.... Smile
Fri Jul 25, 2008 3:21 am View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:    
Reply to topic    The Virtual Crib - Home Automation Software Forum Index » Virtual Crib general discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.