Changes

m
no edit summary
Line 96: Line 96:     
After that, it extracts the sensor ID from the sensor directory path using the ‘basename’ command and stores it in the ‘sensor_id’ variable.
 
After that, it extracts the sensor ID from the sensor directory path using the ‘basename’ command and stores it in the ‘sensor_id’ variable.
 +
 
[[File:Networking trb user scripts cli code explanation4.png|border|class=tlt-border]]
 
[[File:Networking trb user scripts cli code explanation4.png|border|class=tlt-border]]
   Line 102: Line 103:     
Which then converts the raw temperature value to degrees Celsius by dividing it by 1000 and then formatting it with two decimal places using '''‘printf’'''. The resulting temperature value is stored in the '''‘temp’''' variable.
 
Which then converts the raw temperature value to degrees Celsius by dividing it by 1000 and then formatting it with two decimal places using '''‘printf’'''. The resulting temperature value is stored in the '''‘temp’''' variable.
 +
 
[[File:Networking trb user scripts cli code explanation5.png|left|border|class=tlt-border]]
 
[[File:Networking trb user scripts cli code explanation5.png|left|border|class=tlt-border]]
    +
These lines define the URL of the server to which the temperature data will be sent and the payload data that will be sent with each request. The payload includes the '''‘sensor_id’''' and '''‘temp’''' variables, formatted as a JSON object.
   −
  −
  −
  −
  −
These lines define the URL of the server to which the temperature data will be sent and the payload data that will be sent with each request. The payload includes the '''‘sensor_id’''' and '''‘temp’''' variables, formatted as a JSON object.
   
[[File:Networking trb user scripts cli code explanation6.png|left]]
 
[[File:Networking trb user scripts cli code explanation6.png|left]]
    +
This line uses the '''‘curl’''' command to send an HTTP POST request to the server specified by '''‘$SERVER_URL’'''. The '''‘-X POST’''' option specifies that the request should be a POST request, and the '''‘-H “Content-Type: application/json”’''' option specifies that the payload data is in JSON format. The '''‘-d “$PAYLOAD”’''' option specifies the payload data to be sent with the request.
   −
  −
  −
  −
  −
  −
This line uses the '''‘curl’''' command to send an HTTP POST request to the server specified by '''‘$SERVER_URL’'''. The '''‘-X POST’''' option specifies that the request should be a POST request, and the '''‘-H “Content-Type: application/json”’''' option specifies that the payload data is in JSON format. The '''‘-d “$PAYLOAD”’''' option specifies the payload data to be sent with the request.
   
[[File:Networking trb user scripts cli code explanation7.png|left]]
 
[[File:Networking trb user scripts cli code explanation7.png|left]]
       +
=== Output ===
   −
  −
  −
  −
  −
=== Output ===
   
[[File:Networking trb user scripts HTTP listener screenshot.png|left|800x800px]]
 
[[File:Networking trb user scripts HTTP listener screenshot.png|left|800x800px]]
  −
  −
  −
  −
  −
  −
  −
  −
  −
  −
  −
  −
  −
  −
  −
      
Run the script by entering the file path of the file or '''./<filename>.sh''' if you are in the same directory.
 
Run the script by entering the file path of the file or '''./<filename>.sh''' if you are in the same directory.
Line 151: Line 124:     
==Example 2: filtering SMS messages==
 
==Example 2: filtering SMS messages==
  −
  −
   
[[File:Configuration examples user scripts 1.png]]
 
[[File:Configuration examples user scripts 1.png]]

Navigation menu