Having had surprisingly many power outages in the past few weeks I've noticed that the OpenEVSE won't resync the time after the power returns. Whether this is because it syncs at a much later time and I'm too impatient, I don't know.
If (as long as time sync is set to "automatic" the charger resynchronised it's time every day at 12:05am, it would mean that five minutes after power-up (when it'll have gone back to midnight at whatever date it says it is, I can't remember) it'll resynchronise. Perhaps this would even go so far as to render the backup battery redundant?
The current sync uses the browser clock, so it can only happen if you log into the station. We are working on Network Time sync which will sync automatically and make the clock chip and backup battery unnecessary.
Wow, I hadn't even considered it was done through the browser, even though I've seen that before (Dedicated Micros and I think Hikvision CCTV recorders have this option alongside NTP).
I might look at sending a RAPI event from my Domoticz server (which amongst other things monitors a UPS) to send a $S1 time sync every 24 hours and also following a period where the mains input voltage has dropped to zero.
Of course I could just buy a battery but where's the fun in that? :)
Okay, here we go. This has been tested on a Raspberry Pi 4 running the latest Raspbian, I'd expect it to work on any other Linux-based OS.
Create evseclock.sh in your home folder or whatever, containing the following:-
#!/bin/bash # ========================================================= # OpenEVSE clock sync script # ========================================================= # Settings EVSE_IP="192.168.***.***" # OpenEVSE IP Address EVSE_USERNAME="admin" # OpenEVSE Username EVSE_PASSWORD="*****" # OpenEVSE Password # Create URL EVSEURL="http://$EVSE_IP/r?json=1&rapi=\$S1%20`date +"%y%%20%m%%20%d%%20%H%%20%M%%20%S"`" echo "$EVSEURL" # Run the RAPI command curl --digest --user "$EVSE_USERNAME:$EVSE_PASSWORD" "$EVSEURL"
Edit permissions with chmod 755 evseclock.sh
Finally put the following in your crontab using sudo crontab -e, change the time (in this case every 5 minutes) and file path to suit:-
*/5 * * * * /home/pi/evseclock.sh >/dev/null 2>&1
The echo "$EVSEURL" line can be removed from the script, it was in there for testing.
(I can't edit the above post)
Martin, this looks to be a very good workaround until NTP is implemented. I will commission the above code this week.
Have you run into any issue with it on your site in the past two months?
Only that a brief power outage can cause OpenEVSE to drop off the network and not reconnect. The outage will not have caused the wireless access point to drop as it's UPS protected. The EVSE loses its clock though, so doesn't start charging when you expect it to. Power-cycling the EVSE once more seems to sort it back out.
No issue with the script running, though. If required multiple variants of the above script could be added to the crontab, for example dropping the charge current to 6A during the day and bumping back up at night, disabling the EVSE altogether during office hours, whatever floats your boat. Replace S1%20`date +"%y%%20%m%%20%d%%20%H%%20%M%%20%S"` with your command of choice.
Thanks for the add'l info :)
Yes, I have seen the problem you mentioned above: momentary power loss causes the unit's wifi to drop and stay dropped until a longer power cycle.