update
This commit is contained in:
@@ -96,7 +96,8 @@ payload_json = {
|
||||
"sensordatavalues": [] # Empty list to start with
|
||||
}
|
||||
|
||||
|
||||
aircarto_profile_id = 0
|
||||
uSpot_profile_id = 1
|
||||
# Set up GPIO mode (for Blue LED: network status)
|
||||
GPIO.setwarnings(False)
|
||||
GPIO.setmode(GPIO.BCM) # Use Broadcom pin numbering
|
||||
@@ -399,7 +400,7 @@ try:
|
||||
|
||||
#3. Send to endpoint (with device ID)
|
||||
print("Send data (POST REQUEST):")
|
||||
command= f'AT+UHTTPC=0,4,"/pro_4G/data.php?sensor_id={device_id}","server_response.txt","sensordata_csv.json",4\r'
|
||||
command= f'AT+UHTTPC={aircarto_profile_id},4,"/pro_4G/data.php?sensor_id={device_id}","server_response.txt","sensordata_csv.json",4\r'
|
||||
ser_sara.write(command.encode('utf-8'))
|
||||
|
||||
response_SARA_3 = read_complete_response(ser_sara, timeout=5, end_of_response_timeout=45, wait_for_line="+UUHTTPCR")
|
||||
@@ -494,7 +495,7 @@ try:
|
||||
GPIO.output(23, GPIO.LOW) # Éteindre la LED
|
||||
time.sleep(0.1) # Attendre 100 ms
|
||||
GPIO.output(23, GPIO.LOW) # Turn off the LED
|
||||
command = f'AT+UHTTP=0,1,"{url_nebuleair}"\r'
|
||||
command = f'AT+UHTTP={aircarto_profile_id},1,"{url_nebuleair}"\r'
|
||||
ser_sara.write(command.encode('utf-8'))
|
||||
response_SARA_31 = read_complete_response(ser_sara)
|
||||
if need_to_log:
|
||||
@@ -536,12 +537,11 @@ try:
|
||||
print(">>>>>>>>")
|
||||
print(">>>>>>>>")
|
||||
print("SEND TO MICRO SPOT (HTTP):")
|
||||
profile_id = 1
|
||||
|
||||
#step 4: set url (op_code = 1)
|
||||
print("****")
|
||||
print("SET URL")
|
||||
command = f'AT+UHTTP={profile_id},1,"api-prod.uspot.probesys.net"\r'
|
||||
command = f'AT+UHTTP={uSpot_profile_id},1,"api-prod.uspot.probesys.net"\r'
|
||||
ser_sara.write((command + '\r').encode('utf-8'))
|
||||
response_SARA_5 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
print(response_SARA_5)
|
||||
@@ -550,7 +550,7 @@ try:
|
||||
#step 4: set url to SSL (op_code = 6) (http_secure = 1 for HTTPS)(USECMNG_PROFILE = 2)
|
||||
print("****")
|
||||
print("SET SSL")
|
||||
command = f'AT+UHTTP={profile_id},6,0\r'
|
||||
command = f'AT+UHTTP={uSpot_profile_id},6,0\r'
|
||||
ser_sara.write(command.encode('utf-8'))
|
||||
response_SARA_5 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
print(response_SARA_5)
|
||||
@@ -559,7 +559,7 @@ try:
|
||||
#step 4: set PORT (op_code = 5)
|
||||
print("****")
|
||||
print("SET PORT")
|
||||
command = f'AT+UHTTP={profile_id},5,81\r'
|
||||
command = f'AT+UHTTP={uSpot_profile_id},5,81\r'
|
||||
ser_sara.write((command + '\r').encode('utf-8'))
|
||||
response_SARA_55 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
print(response_SARA_55)
|
||||
@@ -588,7 +588,7 @@ try:
|
||||
#step 4: trigger the request (http_command=1 for GET and http_command=1 for POST)
|
||||
print("****")
|
||||
print("Trigger POST REQUEST")
|
||||
command = f'AT+UHTTPC={profile_id},4,"/nebuleair?token=2AFF6dQk68daFZ","http.resp","sensordata_json.json",4\r'
|
||||
command = f'AT+UHTTPC={uSpot_profile_id},4,"/nebuleair?token=2AFF6dQk68daFZ","http.resp","sensordata_json.json",4\r'
|
||||
ser_sara.write(command.encode('utf-8'))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user