This commit is contained in:
Your Name
2025-02-26 09:48:56 +01:00
parent 49e93ab3ad
commit 8fecde5d56
3 changed files with 69 additions and 43 deletions

View File

@@ -5,7 +5,9 @@
___) / ___ \| _ < / ___ \
|____/_/ \_\_| \_\/_/ \_\
Script that starts at the boot of the RPI
Script that starts at the boot of the RPI (with cron)
@reboot sleep 30 && /usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/reboot/start.py >> /var/www/nebuleair_pro_4g/logs/app.log 2>&1
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/reboot/start.py
@@ -118,6 +120,19 @@ def read_complete_response(serial_connection, timeout=2, end_of_response_timeout
try:
print('<h3>Start reboot python script</h3>')
#check modem status
print("Check SARA Status")
command = f'ATI\r'
ser_sara.write(command.encode('utf-8'))
response_SARA_ATI = read_complete_response(ser_sara, wait_for_lines=["IMEI"])
print(response_SARA_ATI)
match = re.search(r"Model:\s*(.+)", response_SARA_ATI)
model = match.group(1).strip() if match else "Unknown" # Strip unwanted characters
print(f" Model: {model}")
update_json_key(config_file, "modem_version", model)
time.sleep(1)
# 1. Set AIRCARTO URL
print('Set aircarto URL')
aircarto_profile_id = 0