This commit is contained in:
PaulVua
2025-01-23 14:19:46 +01:00
parent 838d6d7357
commit aa3b4d238b
7 changed files with 25 additions and 22 deletions

View File

@@ -10,6 +10,7 @@ import json
parameter = sys.argv[1:] # Exclude the script name
port='/dev/'+parameter[0] # ex: ttyAMA2
endpoint = parameter[1] # ex: /pro_4G/notif_message.php
profile_id = parameter[2]
#get baudrate
def load_config(config_file):
@@ -37,7 +38,7 @@ ser = serial.Serial(
timeout = 2
)
command= f'AT+UHTTPC=0,4,"{endpoint}","data.txt","sensordata.json",4\r'
command= f'AT+UHTTPC={profile_id},4,"{endpoint}","data.txt","sensordata.json",4\r'
ser.write((command + '\r').encode('utf-8'))
try:

View File

@@ -1,7 +1,7 @@
'''
Script to set the URL for a HTTP request
Ex:
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setURL.py ttyAMA2 data.nebuleair.fr
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setURL.py ttyAMA2 data.nebuleair.fr 0
To do: need to add profile id as parameter
First profile id:
@@ -19,6 +19,7 @@ parameter = sys.argv[1:] # Exclude the script name
#print("Parameters received:")
port='/dev/'+parameter[0] # ex: ttyAMA2
url = parameter[1] # ex: data.mobileair.fr
profile_id = parameter[2] #ex: 0
#get baudrate
@@ -47,7 +48,7 @@ ser = serial.Serial(
timeout = 2
)
command = f'AT+UHTTP=0,1,"{url}"\r'
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
ser.write((command + '\r').encode('utf-8'))
print("****")