46045-syslab/combinations/heartbeat_unit.py

12 lines
275 B
Python

from xmlrpc.client import ServerProxy
from time import sleep
heartbeat_server_port = 10001
with ServerProxy(f'http://localhost:{heartbeat_server_port}') as proxy:
# Periodically send a heartbeat
while True:
proxy.send_heartbeat('BATTERY')
sleep(1)