Power HAT RTC problems

How does the power HAT RTC keep the Pi time current without the Pi being connected to a network?
The Pi works on battery power but what’s the sense of this UPS when it doesn’t keep time without the system being first connected to a network?

My HAT RTC appears not to keep time when Pi disconnected from the network yet HAT plugged in and a full battery. Does the HAT not have an RTC or am I misreading the documentation?

Hi @shane.dyck,

Not sure if you got solution on this, but the answer is yes. It has an RTC. It does not seem to set the Pi automatically. I set it using the python API. At bootup, I read the UPS RTC value and set it (to the MCU Clock) using an os.system(“sudo date …”) call.

Add this to any boot-up script:

x-terminal-emulator -e 'cd /home/pi/path/to/api/sixfab-power-python-api/ && python3 ./example/rtc_time_to_pi.py'

rtc_time_to_pi.py contains:

import os
import sys
sys.path.append('./')

from power_api import SixfabPower, Definition, Event
import time

done = False
while not done:
	pms = SixfabPower()
	epoch = time.time()
	
	try:
		os.system(str("sudo date +%T -s " + str(pms.get_rtc_time(Definition.TIME_FORMAT_TIME))))
	except:
		continue
		
	done = True

works for me, ymmv
S

Hi,

The HAT has an RTC. You don’t need to be connected to a network to keep time. The “power_agent” service only uses the internet to set the RTC time by location. However, you can use your HAT offline by setting the RTC once using the Python API. It will continue to keep time until its battery is depleted.