Setting system time

Is there a way to set the system time on the ConnectPort X4 through Python? Through the CLI? Through the web interface? This seems like it should be obvious but I cannot find any documentation on this.

If you’re using Dia, this is a nice little NTP client driver: http://www.digi.com/wiki/developer/index.php/Network-Time-Server-Dia-Example

It was the first thing I installed when I got my CP. :slight_smile:

Hello,

See this page for some information on setting the system time on the X4:

http://www.digi.com/wiki/developer/index.php/Read_and_write_the_Realtime_clock

Chris

Thanks.

It’s strange that the “set time” command is not in the command reference document (90000566_H).

Thanks for the heads up. A request is now in to get the manual updated/corrected.

in this guide http://www.digi.com/wiki/developer/index.php/Network-Time-Server-Dia-Example

i cant seem to change the refresh (or update) rate, when i run the “channel_dump” command, the time is always the same unless i manually press “save” in the idigi_dia.html web.

is there any way to change the refresh rate or is it by default refresh every 1 day (i think)

(Salamat Pagi :slight_smile:

Perhaps that example doesn’t correctly re-read the Dia setting each cycle & only use the original value, but it is just an example. You could change the rather simple code to re-check the time duration.

I won’t check the SNTP time too often as 1) it is rude to the host of the SNTP service, and 2) given the rubberness of Python it could do more harm to your sense of time than good, with your time shifting back & forth by a few seconds all of the time.

It’s Selamat Pagi, nice try though :slight_smile:

Thanks for the reply, I got it to work by changing the server address (apparently it’s the network problem not the code problem). I still don’t fully understand the Python code, very new with these programming stuffs.

Oh by the way, by the rule of thumb, how often should I set the update rate? (purpose is for Home Appliance/Lights Automation)

I certainly won’t set more than once per day. If you have an X4 or X8 with real-time clock chip, you should not see anymore than a minute’s drift per month. An X2 (without clock hardware) will drift more.

The RISK you have anytime you change the clock is in missing an event. Let’s say you wish to turn the lights on at 3pm - if one minute it’s 2:59 and the next it’s 3:02 because of a time-change, you risk missing the 3pm event. You also can confuse timers, so in the above case something supposed to run for 5 minutes might run only 2 and so on.

(I lived in Singapore for 11 years, and many times drove trunk loads of second-rate durian down from Yong Peng or Batu Pahat, but that was more than a decade ago & my memory gets rusty :slight_smile:

Singaporean :slight_smile: Hello neighbour!

I’m still learning the basics of Python. Next target would be using Python to command the XBee to on/off or to sleep. Thanks for being so helpful and for the advice.