Time manager use
davegrov
Posts: 114
I am working on improving my programming skills and wanted to work with Displaying time on a TP. I'm using the !i-Time manager App and was wondering how to display the current date, time, sunset and sunrise on a TP.
Can anyone show me some sample code to get started.
Can anyone show me some sample code to get started.
0
Comments
Look at "Advanced" under address code. Lots of stuff.
-Bill
- Chip
I highly recommend using the Time Manager module if your system has internet access. The only trick is that he NetLinx Master must have at least one DNS address defined.
The module utilizes web time servers for reference based upon the latitude and longitude of the system location. You get sunrise and sunset information with daylight savings time support. The module synchronizes the time and date on the Master and all connected touch panels.
Use it with confidence.
how would you query the time manager to determine the sunset time before it actually occurs. say i want to automatically turn on some lights 30 mins before sunset, or turn on some sprinklers an hour before sunrise.
get the time and put it in a string and go from there.
Sorry for butting in here, but with this data_event, what do you do if you get more than one command at a time ? b/c you never strip the data out so if two commands come in on the same string event, it would give you the wrong data. Does this ever happen in !Time_Manager ?
The way that NetLinx passes strings to and from a virtual, you are never going to get two commands in the same DATA_EVENT generated by a virtual device. You might have to add extra processing if it were coming from a serial device, or TCP, but not an in-system message. The NetLinx generates DATA_EVENT based on timing: a flow of data with a pause of a certain length (that value is unpublished, as is this entire process, I've come to it by observation and deduction) constitues a single event; after that pause, any new data creates an entirely new event. Since this is data flowing to and from a virtual device, which is managed entirely by the master anyway, there is no chance of sporatic timing causing events to "stack up" as you describe. A serial port or TCP connection might pause in the middle of a stream, or neglect to pause at the beginning of a new string, so that you would have to buffer and process further to make sure you won't have problems. But it's not generally an issue with a virtual device. I suppose there is a possibilty if the master is under heavy load or very busy that a string might get broken up prematurely, but there is little to no chance of you getting two in the same event.
Most of what Dave said is over my head but to answer your question, no, I haven't had problems which is probably because of what Dave said. I have no idea how the comm module actually does anything but this has worked for me which may be due to dumb luck but I'll take it any way I can.
thanks for the help, after playing around with time manager i realized its not really working. i set it to check every min while i work this out. i get a message that the time was updated, but its not the message that is predefinied in time manager.
Line 26 :: TM NTP LI field indicates unsynchronized time; return DATE/Time: 08/10/2006 19:03:19 - 19:03:19
the send sting to master is something like "the time was adjusted by the server, the new time is ---"
so i know i'm connecting to something. could i possibly be connecting to a server that only has time information? i pretty much left the time manager code alone - i changed the time offset and long / latitude
where can i find the time server list? and does the netlinx do a calc to determine the sunrise / sunset? or does it get that from the server? or both.
the only data event i have running is the time manager. the only thing i see in the diagnostic window is that time has been updated. i was hoping the sunset / sunrise time.
i checked dns the ip seems right. i put my routers ip in there too. - tested with email
maybe i should force it to go to another time server, maybe the one im connecting to meerly has time.
added:
i let it run for some time, and it did come up with some sunrise/sunset info: i couldn't make much sence of it, but i noticed that i had +72.9 for the longitude. i noticed that you code was east coast/norwalk (i assume CT) and you put in -73, i think this may have something to do with it. what do you think? haha - i hope. i think i may have mis-read the setup for the east coast longitude.
definetly bed time.
I have long considered i!-TimeManager to be a necessary inclusion to any NetLinx system with an Internet connection. And, just so you know, i!-Schedule includes it. I have recently started using i!-Schedule instead, even if I don't plan on using the scheduler right away. Generaly, I use the engine-only version. It's just too handy a capability to ignore.
i just checked up on the panel and theres no info except that the time updates.
yea, i'm not too sure whats goin on anymore. apparently my amx box is tellin me that the earth stopped revolving. haha joke.
A good connection should look something like this:
A bad connection would do something more like:
All I did to generate the "bad" data was manually set the DNS and gateway entries to something I knew was wrong. More than likely if you have a connection issue, that is your problem.
i sent a RESET command to vdvTmEvents and it returned that the address was invalid.
i sent a Reset command to 33001 and it returned with all the goodies, sunrise, sunset. i am very happy now. thank you everyone for you help. i dont know what i did different.
i do know?
the only thing different could be this:
i got an error the last time i did a 'quick load' it couldnt find the .src file i just ignored the message and let it send empty.src, (i exported from my laptop then imported onto a different machine and loaded from there.) could that have had somethign to do with it?
nevermind, it was a fresh install of netlinx and i didnt have include source option selected. newbie mistake.
but after i reboot, i have to issue that RESET command to the dev # 33001 or this thing doesnt work. can i just put that in my define start? should i even have to do this? or is this module smart enough that it wont get the sunrise/sunset information unless the event occurs and it needs to get the next one, or what if i dynamically change the long/latitude?
You could create an include (.axi) for the .axs contents if you want to be a little more organized and then just put to include under define_start.
Then go into those sections in the main or the include (if applicable) where you need to set values for your location.
Thanks vining. I got the feeling that would be you the first one to answer on Saturday.
was the result of a duplicated URL listing.
Some body can tell me how i can install i!Time manager module?
I don't know why I can't egt succes with it....
I get this error
Ok I found my errors, now NS compile the module with succes, but the module seem to dosen't works
How I can set a DNS address if I don't have DNS server, I use a DI-604 as router with HDCP range 192.168.0.151 to .....199
See if it can surf the web on that connection. If it can, go to a command prompt and type IPCONFIG and get the DNS from there. If it could not reach the internet, put the address of the controller in your laptop with the current gateway. Now see if you can surf the internet. If you can't you need to talk to IT!
Yes I can, when I get IP from prompt cmd, I get this and the IP address of Master is 192.168.0.130