Ecran LED
+Votre capteur est équipé d'un écran LED.
+ +diff --git a/README.md b/README.md index eeb1d44..76a88a5 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Version Pro du ModuleAir avec CM4, SaraR4 et ecran Matrix LED p2 64x64. ## General ``` sudo apt update -sudo apt install git gh apache2 php php-sqlite3 python3 python3-pip jq g++ autossh i2c-tools python3-smbus -y +sudo apt install git gh apache2 sqlite3 php php-sqlite3 python3 python3-pip jq g++ autossh i2c-tools python3-smbus -y sudo pip3 install pyserial requests sensirion-shdlc-sfa3x RPi.GPIO adafruit-circuitpython-bme280 crcmod psutil --break-system-packages sudo git clone http://gitea.aircarto.fr/PaulVua/moduleair_pro_4g.git /var/www/moduleair_pro_4g sudo mkdir /var/www/moduleair_pro_4g/logs diff --git a/boot_hotspot.sh b/boot_hotspot.sh index a01fb42..5f354a3 100755 --- a/boot_hotspot.sh +++ b/boot_hotspot.sh @@ -6,7 +6,6 @@ # @reboot /var/www/moduleair_pro_4g/boot_hotspot.sh >> /var/www/moduleair_pro_4g/logs/app.log 2>&1 OUTPUT_FILE="/var/www/moduleair_pro_4g/wifi_list.csv" -JSON_FILE="/var/www/moduleair_pro_4g/config.json" echo "-------------------" echo "-------------------" @@ -14,16 +13,18 @@ echo "-------------------" echo "NebuleAir pro started at $(date)" -echo "getting SARA R4 serial number" +echo "getting RPI serial number" # Get the last 8 characters of the serial number and write to text file serial_number=$(cat /proc/cpuinfo | grep Serial | awk '{print substr($3, length($3) - 7)}') # Define the JSON file path -# Use jq to update the "deviceID" in the JSON file -jq --arg serial_number "$serial_number" '.deviceID = $serial_number' "$JSON_FILE" > temp.json && mv temp.json "$JSON_FILE" +# update Sqlite database +echo "Updating SQLite database with device ID: $serial_number" +sqlite3 /var/www/moduleair_pro_4g/sqlite/sensors.db "UPDATE config_table SET value='$serial_number' WHERE key='deviceID';" echo "id: $serial_number" + #get the SSH port for tunneling -SSH_TUNNEL_PORT=$(jq -r '.sshTunnel_port' "$JSON_FILE") +SSH_TUNNEL_PORT=$(sqlite3 /var/www/moduleair_pro_4g/sqlite/sensors.db "SELECT value FROM config_table WHERE key='sshTunnel_port'") #need to wait for the network manager to be ready sleep 20 @@ -39,10 +40,10 @@ if [ "$STATE" == "30 (disconnected)" ]; then nmcli -f SSID,SIGNAL,SECURITY device wifi list | awk 'BEGIN { OFS=","; print "SSID,SIGNAL,SECURITY" } NR>1 { print $1,$2,$3 }' > "$OUTPUT_FILE" # Start the hotspot echo "Starting hotspot..." - sudo nmcli device wifi hotspot ifname wlan0 ssid nebuleair_pro password nebuleaircfg + sudo nmcli device wifi hotspot ifname wlan0 ssid moduleair_pro password moduleaircfg # Update JSON to reflect hotspot mode - jq --arg status "hotspot" '.WIFI_status = $status' "$JSON_FILE" > temp.json && mv temp.json "$JSON_FILE" + sqlite3 /var/www/moduleair_pro_4g/sqlite/sensors.db "UPDATE config_table SET value='hotspot' WHERE key='WIFI_status'" else @@ -50,10 +51,8 @@ else CONN_SSID=$(nmcli -g GENERAL.CONNECTION device show wlan0) echo "Connection: $CONN_SSID" - #update config JSON file - jq --arg status "connected" '.WIFI_status = $status' "$JSON_FILE" > temp.json && mv temp.json "$JSON_FILE" - - sudo chmod 777 "$JSON_FILE" + # Update SQLite to reflect hotspot mode + sqlite3 /var/www/nebuleair_pro_4g/sqlite/sensors.db "UPDATE config_table SET value='connected' WHERE key='WIFI_status'" # Lancer le tunnel SSH #echo "Démarrage du tunnel SSH sur le port $SSH_TUNNEL_PORT..." diff --git a/html/database.html b/html/database.html index 9a8c24f..05dd6ce 100755 --- a/html/database.html +++ b/html/database.html @@ -54,7 +54,7 @@
Votre capteur est équipé d'un écran LED.
+ +