This commit is contained in:
Your Name
2025-03-26 10:30:24 +01:00
parent e75caff929
commit 970a36598c
6 changed files with 119 additions and 45 deletions

View File

@@ -54,6 +54,8 @@ CSV PAYLOAD (AirCarto Servers)
22 -> solar_voltage
23 -> solar_power
24 -> charger_status
25 -> Wind speed
26 -> Wind direction
JSON PAYLOAD (Micro-Spot Servers)
Same as NebuleAir wifi
@@ -235,6 +237,8 @@ Sara_baudrate = config.get('SaraR4_baudrate', 115200)
npm_5channel = config.get('npm_5channel', False) #5 canaux du NPM
selected_networkID = int(config.get('SARA_R4_neworkID', 0))
send_uSpot = config.get('send_uSpot', False) #envoi sur MicroSpot ()
wind_meter= config.get('windMeter', False)
reset_uSpot_url = False
#config_scripts
@@ -242,7 +246,6 @@ config_scripts = load_config_scripts_sqlite()
bme_280_config = config_scripts.get('BME280/get_data_v2.py', False)
envea_cairsens= config_scripts.get('envea/read_value_v2.py', False)
mppt_charger= config_scripts.get('MPPT/read.py', False)
wind_meter= config_scripts.get('windMeter/read.py', False)
#update device id in the payload json
payload_json["nebuleairid"] = device_id
@@ -628,6 +631,20 @@ try:
#Wind meter
if wind_meter:
print("Getting wind meter values")
cursor.execute("SELECT * FROM data_WIND ORDER BY rowid DESC LIMIT 1")
last_row = cursor.fetchone()
if last_row:
print("SQLite DB last available row:", last_row)
wind_speed = last_row[1]
wind_direction = last_row[2]
#Add data to payload CSV
payload_csv[25] = wind_speed
payload_csv[26] = wind_direction
else:
print("No data available in the database.")
#MPPT charger
if mppt_charger:
@@ -750,14 +767,15 @@ try:
#3. Send to endpoint (with device ID)
print("Send data (POST REQUEST):")
command= f'AT+UHTTPC={aircarto_profile_id},4,"/pro_4G/data.php?sensor_id={device_id}&lat={device_latitude_raw}&long={device_longitude_raw}&datetime={influx_timestamp}","aircarto_server_response.txt","sensordata_csv.json",4\r'
print("sending:")
print('<p class="text-danger-emphasis">')
print(command)
print("</p>", end="")
#print("sending:")
#print('<p class="text-danger-emphasis">')
#print(command)
#print("</p>", end="")
ser_sara.write(command.encode('utf-8'))
response_SARA_3 = read_complete_response(ser_sara, timeout=5, end_of_response_timeout=120, wait_for_lines=["+UUHTTPCR", "+CME ERROR", "ERROR"], debug=True)
print("receiving:")
#print("receiving:")
print('<p class="text-danger-emphasis">')
print(response_SARA_3)
print("</p>", end="")