diff --git a/README.md b/README.md index ecbfeb0..c80a7f0 100755 --- a/README.md +++ b/README.md @@ -4,9 +4,19 @@ Based on the Rpi4 or CM4. # Installation +# Express + +You can download the `installation.sh` and run it: +``` +wget http://gitea.aircarto.fr/PaulVua/nebuleair_pro_4g/raw/branch/main/installation.sh +chmod +x installation.sh +./installation.sh +``` + + ## General -See `installation.sh` +Line by line installation. ``` sudo apt update diff --git a/SARA/reboot/start.py b/SARA/reboot/start.py index eb2e2ef..21f446e 100644 --- a/SARA/reboot/start.py +++ b/SARA/reboot/start.py @@ -128,9 +128,13 @@ try: print(response_SARA_1) time.sleep(1) - #2. Set uSpot URL (TODO) + #2. Set uSpot URL uSpot_profile_id = 1 uSpot_url="api-prod.uspot.probesys.net" + command = f'AT+UHTTP={uSpot_profile_id},1,"{uSpot_url}"\r' + ser_sara.write(command.encode('utf-8')) + response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["OK"]) + print(response_SARA_2) time.sleep(1) #3. Get localisation (CellLocate) diff --git a/config.json.dist b/config.json.dist index 4400e7c..7c23ae8 100755 --- a/config.json.dist +++ b/config.json.dist @@ -18,7 +18,6 @@ "ttyAMA5" ], "i2C_sound": false, - "i2c_BME": false, "i2c_RTC": false, "local_storage": false, "sshTunnel_port": 59228, diff --git a/html/sensors.html b/html/sensors.html index dc4bb17..dbcd3e9 100755 --- a/html/sensors.html +++ b/html/sensors.html @@ -346,7 +346,7 @@ window.onload = function() { }); //creates i2c BME280 card - if (data.i2c_BME) { + if (data["BME280/get_data_v2.py"]) { const i2C_BME_HTML = `
diff --git a/installation.sh b/installation.sh index 5883928..d985ad2 100755 --- a/installation.sh +++ b/installation.sh @@ -68,4 +68,27 @@ echo "Set Up Apache" sudo sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/nebuleair_pro_4g|' /etc/apache2/sites-available/000-default.conf sudo systemctl reload apache2 +#add sudo authorization +if ! sudo grep -q "/usr/bin/nmcli" /etc/sudoers; then + echo "Setting up sudo authorization..." + echo -e "ALL ALL=(ALL) NOPASSWD: /usr/bin/nmcli, /usr/sbin/reboot\nwww-data ALL=(ALL) NOPASSWD: /usr/bin/git pull\nwww-data ALL=(ALL) NOPASSWD: /usr/bin/ssh\nwww-data ALL=(ALL) NOPASSWD: /usr/bin/python3 *" | sudo EDITOR="tee -a" visudo +else + echo "Sudo authorization already set. Skipping..." +fi + +#Open all serial ports +if ! grep -q "enable_uart=1" /boot/firmware/config.txt; then + echo "Adding UART configuration..." + echo -e "\nenable_uart=1\ndtoverlay=uart0\ndtoverlay=uart1\ndtoverlay=uart2\ndtoverlay=uart3\ndtoverlay=uart4\ndtoverlay=uart5" | sudo tee -a /boot/firmware/config.txt > /dev/null +else + echo "UART configuration already set. Skipping..." +fi + +sudo chmod 777 /dev/ttyAMA* + +#Open I2C ports +echo "Open I2C ports" +sudo raspi-config nonint do_i2c 0 + echo "Setup completed successfully!" +