Vera Time Clock

I understand that Vera’s clock is dependent on Internet at boot to set the system time.

We have a natural gas generator, and on some power loss events (once the generator kicks in) we have power, but the local network hub does not. This results in a condition where Vera reboots, Internet is not present, and Vera’s clock resets to 1999. To “fix” this, as far as I can tell, I need to force boot Vera when Internet is restored, go into the dashboard and set time manually, or provide Vera with UPS power. One other option would be to have Vera poll the time server on regular intervals, but as far as I can tell, the poll is only done at boot.

Is there a setting (or code) to have Vera poll the time server on a regular basis?

Thanks,
Dave

Ive had this issue as well, except mine goes back to June 2010…

I’d also like to have Vera wait to connect to NTP and set the interval myself, such as every 4 hours, etc

Some folks have put NTP on Vera2, so, e.g., you could sync with your own local server.

A bunch of us run Vera, and all the associated Network gear, on UPS to avoid little disruptions. Mine runs for about 12 hrs on battery power.

+1
It’s also a little easier on your equipment without all those under/over volt situations power failures cause.

any way to set time through a lua script ?
i’m having some idea’s here …

Which UPS are you using that keeps Vera going for 12 hours. I sorely need something like this.

@S-F,
It’s home-made, and consists of:

[ul][li]a) a large SLA Battery[/li]
[li]b) a Mean-Well Single 12v Output power supply, with Battery Charger function (AD-155, from memory)[/li]
[li]c) 2x NetGear “Green” GigE Switches[/li]
[li]d) Vera[/li]
[li]e) 1x DLink DSL unit, 1x Linksys Router-Firewall, … (eventually I’ll wire my Cradlepoint to replace)[/li]
[li]f) a whole bunch of Barrel-jack cables[/li]
[li]g) Thick copper wire for the Battery-to-Power supply connection.[/li][/ul]

Item (b) is wired to supply 12v to all devices in the Structured Wiring closet, eliminating every plugpack… with (f).

I don’t have an inverter and/or traditional UPS, and don’t use any 110v only devices. All my devices run on 12v, they were specifically selected so I could do this in the closet without further stepping down/up the DC.

When I lose power I do lose WiFi since my WiFi gear is distributed around the house on Wired Ethernet channels. Presumably the [central] NetGear green-switches will power down those Ethernet lines to save power.

The Alarm system has it’s own, separate 12v SLA Battery, but it’s much smaller. For the main battery I bought the biggest one that would fit into the SWC, and safely leave room for the other stuff.

Thanks all.

@oTi@: +1. The concept of installing NTP is intriguing, I’ll read up on it to see if I’m up to the challenge. It seems to me that if I can run my own time server, that would be ideal in my case. Thanks for this tip!

Thinking about it more, a combination of UPS and NTP might be the best approach for me. The UPS would take over for the short interruptions, and NTP would likely address most Internet disruptions.

Dave

Update: installed NTP on Vera 2 and used the local NIST server as the preferred server. At least this will take care of the time issue once the Internet connection is reestablished. I feel that I need to do some more research on the best way to set up a time server on my LAN. Any links or tips for this on Mac would be most appreciated.

In the case of power failure and if the time needed for the generator to kick in is almost the same everytime, you could set a cron job to save vera’s time to a file every minute and reload that time on startup.

I use the below scripts to do that:

save_time.sh:

[tt]date “+%F %T” > /etc/timesaver/saved_time[/tt]

reload_time.sh:

[tt]date “+%F %T” -s “cat /etc/timesaver/saved_time
timemm=date "+%M"
timehh=date "+%H"
timemm=expr $timemm + 2

if [ “$timemm” -gt “59” ] ; then
timemm=expr $timemm - 60
timehh=expr $timehh + 1
fi

date “+%H:%M” -s “$timehh:$timemm”[/tt]

The first script is called by a cron job and the second one is added to /etc/rc.local

Of course, having a UPS is the best option to protect your hardware.

i have a hardware solution for that … see the post on ‘Sysmon’ in ‘general’.
I just need to write a few lines of Lua to retrieve time from Vera and the serial port.
depending on who has the ‘most recent time/date’ that one goes into effect.

Anyone know how to:

  • retrieve time/date through a lua command ?
  • set time/date through a lua command ?

i’m a hardware/firmware wiz, but software is not my cup of tea.

Unfortunately, your solution is beyond my capabilities–but it does seem like an elegant fix. I may stick with a UPS and an NTP server.

I do feel better with NTP installed. Now I feel the need to figure out a way for the timers to “correct themselves”. In other words, to check their status against the clock, and reset to the proper state if they’re out of sorts.

Dave

Thanks for all the help here. I have NTP installed on Vera and have an NTP server running on a Plex box on my LAN (a box that’s always on.) All my boxes are successfully syncing with the time server.

Now on to the stupid question. I followed the instructions to install NTP on Vera here: [url=http://wiki.micasaverde.com/index.php/Install_NTP]http://wiki.micasaverde.com/index.php/Install_NTP[/url]; do I also need to add NTPD to the rc.local file on Vera?

Thanks in advance,
Dave

No need. Installing the package creates the /etc/rc.d/S65ntpd symlink, which is invoked on reboot.

[quote=“futzle, post:14, topic:168707”]Installing the package creates the /etc/rc.d/S65ntpd symlink, which is invoked on reboot.[/quote]So it does! Thanks for the prompt reply.

Dave

You could always use something like this to act as your NTP server, if you don’t want to make your own:

[url=http://pro.neutrontek.com/eng/product/product_parameter.asp?id=118]http://pro.neutrontek.com/eng/product/product_parameter.asp?id=118[/url]

Likely an overkill, since it looks like you can synchronize the time with GPS as well.

[quote=“SOlivas, post:16, topic:168707”]You could always use something like this to act as your NTP server, if you don’t want to make your own:

[url=http://pro.neutrontek.com/eng/product/product_parameter.asp?id=118]http://pro.neutrontek.com/eng/product/product_parameter.asp?id=118[/url]

Likely an overkill, since it looks like you can synchronize the time with GPS as well.[/quote]
That’s pretty cool. I wonder how much something like that would cost. I did a quick search but couldn’t find a retailer.