diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index 3adcf96..5c160ed
--- a/README.md
+++ b/README.md
@@ -25,13 +25,14 @@ sudo mkdir /var/www/nebuleair_pro_4g/logs
sudo touch /var/www/nebuleair_pro_4g/logs/app.log /var/www/nebuleair_pro_4g/logs/loop.log
sudo cp /var/www/nebuleair_pro_4g/config.json.dist /var/www/nebuleair_pro_4g/config.json
sudo chmod -R 777 /var/www/nebuleair_pro_4g/
-git config core.fileMode false
+git config --global core.fileMode false
+git config --global --add safe.directory /var/www/nebuleair_pro_4g
sudo crontab /var/www/nebuleair_pro_4g/cron_jobs
```
## Apache
Configuration of Apache to redirect to the html homepage project
```
-sudo sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/nebuleair_pro_4g/html|' /etc/apache2/sites-available/000-default.conf
+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
```
diff --git a/SARA/sara.py b/SARA/sara.py
index 74872f3..c4cc291 100755
--- a/SARA/sara.py
+++ b/SARA/sara.py
@@ -2,6 +2,9 @@
Script to see if the SARA-R410 is running
ex:
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+CCID? 2
+ex 2 (turn on blue light):
+python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+UGPIOC=16,2 2
+
'''
import serial
diff --git a/SARA/sara_setAPN.py b/SARA/sara_setAPN.py
new file mode 100755
index 0000000..330e6fd
--- /dev/null
+++ b/SARA/sara_setAPN.py
@@ -0,0 +1,68 @@
+'''
+Script to connect SARA-R410 to APN
+AT+CGDCONT=1,"IP","data.mono"
+
+/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setAPN.py ttyAMA2 data.mono 2
+'''
+
+import serial
+import time
+import sys
+import json
+
+parameter = sys.argv[1:] # Exclude the script name
+port='/dev/'+parameter[0] # ex: ttyAMA2
+apn_address = parameter[1] # ex: data.mono
+timeout = float(parameter[2]) # ex:2
+
+
+#get baudrate
+def load_config(config_file):
+ try:
+ with open(config_file, 'r') as file:
+ config_data = json.load(file)
+ return config_data
+ except Exception as e:
+ print(f"Error loading config file: {e}")
+ return {}
+
+# Define the config file path
+config_file = '/var/www/nebuleair_pro_4g/config.json'
+# Load the configuration data
+config = load_config(config_file)
+# Access the shared variables
+baudrate = config.get('SaraR4_baudrate', 115200)
+
+ser = serial.Serial(
+ port=port, #USB0 or ttyS0
+ baudrate=baudrate, #115200 ou 9600
+ parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
+ stopbits=serial.STOPBITS_ONE,
+ bytesize=serial.EIGHTBITS,
+ timeout = timeout
+)
+
+command = f'AT+CGDCONT=1,"IP","{apn_address}"\r'
+ser.write((command + '\r').encode('utf-8'))
+
+
+try:
+ # Read lines until a timeout occurs
+ response_lines = []
+ while True:
+ line = ser.readline().decode('utf-8').strip()
+ if not line:
+ break # Break the loop if an empty line is encountered
+ response_lines.append(line)
+
+ # Print the response
+ for line in response_lines:
+ print(line)
+
+except serial.SerialException as e:
+ print(f"Error: {e}")
+
+finally:
+ if ser.is_open:
+ ser.close()
+ #print("Serial closed")
diff --git a/config.json.dist b/config.json.dist
index 6c31450..17b1cae 100755
--- a/config.json.dist
+++ b/config.json.dist
@@ -6,7 +6,7 @@
"NextPM_ports": [
"ttyAMA5"
],
- "i2C_sound": true,
+ "i2C_sound": false,
"i2c_BME": false,
"sshTunnel_port": 59228,
"npm1_status": "connected",
@@ -14,10 +14,10 @@
"SARA_R4_SIM_status": "connected",
"SARA_R4_network_status": "connected",
"WIFI_status": "connected",
- "MQTT_GUI": true,
+ "MQTT_GUI": false,
"envea_sondes": [
{
- "connected": true,
+ "connected": false,
"port": "ttyAMA4",
"name": "h2s",
"coefficient" : 4
diff --git a/html/launcher.php b/html/launcher.php
index ea5355a..150e346 100755
--- a/html/launcher.php
+++ b/html/launcher.php
@@ -115,7 +115,7 @@ if ($type == "sara_APN") {
$port=$_GET['port'];
$timeout=$_GET['timeout'];
$APN_address=$_GET['APN_address'];
- $command = '/usr/bin/python3 /var/www/moduleair_pro_4g/SARA/sara_setAPN.py ' . $port . ' ' . $APN_address . ' ' . $timeout;
+ $command = '/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setAPN.py ' . $port . ' ' . $APN_address . ' ' . $timeout;
$output = shell_exec($command);
echo $output;
}
diff --git a/html/saraR4.html b/html/saraR4.html
index d9e6849..80ced94 100755
--- a/html/saraR4.html
+++ b/html/saraR4.html
@@ -55,6 +55,7 @@
Status
Loading...
+
@@ -111,6 +112,7 @@
Connexion 4G Network
+
@@ -118,6 +120,8 @@
Network scan. Attention: 2 min scan.
+
Orange FR (20801), SFR (20810), Bouygues (20820)
+
@@ -152,7 +156,8 @@
Address
-
+
+
@@ -536,11 +541,12 @@ function getData_saraR4(port, command, timeout){
}
function sendMessage_saraR4(port, endpoint){
+
console.log("Send message from SaraR4 (port "+port+" and endpoint "+endpoint+"):");
$("#loading_"+port+"_message_send").show();
- $.ajax({
+ $.ajax({
url: 'launcher.php?type=sara_sendMessage&port='+port+'&endpoint='+encodeURIComponent(endpoint),
//dataType: 'json', // Specify that you expect a JSON response
method: 'GET', // Use GET or POST depending on your needs
@@ -558,9 +564,12 @@ function getData_saraR4(port, command, timeout){
}
function connectAPN_saraR4(port, APN_address, timeout){
+
console.log(" Set APN (port "+port+" and adress "+APN_address+"):");
+
$("#loading_"+port+"_APN").show();
- $.ajax({
+
+ $.ajax({
url: 'launcher.php?type=sara_APN&port='+port+'&APN_address='+encodeURIComponent(APN_address)+'&timeout='+timeout,
//dataType: 'json', // Specify that you expect a JSON response
method: 'GET', // Use GET or POST depending on your needs
diff --git a/html/wifi.html b/html/wifi.html
index 589a0c0..d1c63d2 100755
--- a/html/wifi.html
+++ b/html/wifi.html
@@ -45,12 +45,68 @@
-
+
-
+
Connection WIFI
La connexion WIFI n'est pas obligatoire mais elle vous permet d'effectuer des mises à jour et d'activer le contrôle à distance.