Skip to content

Commit fb96473

Browse files
failover.py erstellen
1 parent 542dfd8 commit fb96473

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

comms/core/failover.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import subprocess
2+
import time
3+
4+
def check_lte():
5+
result = subprocess.getoutput("bash ../lte/lte-check.sh")
6+
return "OK" in result
7+
8+
def switch_to_lora():
9+
print("[FAILOVER] Switching to LoRa")
10+
11+
def switch_to_lte():
12+
print("[FAILOVER] Using LTE")
13+
14+
def loop():
15+
while True:
16+
if check_lte():
17+
switch_to_lte()
18+
else:
19+
switch_to_lora()
20+
time.sleep(3)
21+
22+
if __name__ == "__main__":
23+
loop()

0 commit comments

Comments
 (0)