Skip to content

Commit

Permalink
Use longname
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberorg committed Mar 29, 2024
1 parent e148677 commit 4267efb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Debug nodes are included for debugging purposes. They can be activated or deacti

## Additional Information
- **mqtt in and out**: Modify to point to your mqtt server in Ingest subflow. Disable link to mqtt out if you do not wish to forward to mqtt.meshtastic.org.
- **Skylines Integration**: Add Skylines tracking ID as LongName to the device.
- **Telegram Integration**: Use anything that can identify as you in ShortName.
- **Skylines Integration**: Add your skylines tracking ID in LongName after "/" e.g. "Paraguide IN/XXXXXXXX". Add your skylines details to [https://flyxc.app](https://flyxc.app)(optional on [https://puretrack.io](https://puretrack.io)), your device will show up on the map there.
- **Telegram Integration**: Messages are forwarded to telegram group topic [https://t.me/meshtastic_india/22/](https://t.me/meshtastic_india/22/).

For more information about Skylines, visit [Skylines GitHub Repository]([https://github.com/skylines/aero](https://github.com/skylines-project/skylines)).

Expand Down
14 changes: 7 additions & 7 deletions meshtastic2skylines.json
Original file line number Diff line number Diff line change
Expand Up @@ -1531,12 +1531,12 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 980,
"x": 960,
"y": 140,
"wires": [
[
"9e94ce2f9309f326",
"9de649c43b8fd80e"
"9de649c43b8fd80e",
"9e94ce2f9309f326"
]
]
},
Expand All @@ -1545,7 +1545,7 @@
"type": "function",
"z": "4348da314170486a",
"name": "toskylines",
"func": "// JavaScript function to calculate session ID\nfunction generateSessionID(userID) {\n // Convert hexadecimal user_id to integer\n var user_id_int = parseInt(userID.substring(1), 16);\n\n // Generate a random session ID with the last three bytes matching the user ID\n var session_id = Math.floor(Math.random() * (Math.pow(2, 24) - 1)) | user_id_int;\n\n return session_id.toString();\n}\n\n// Check if the incoming message has the \"fromShortName\" property\nif (msg.payload && Array.isArray(msg.payload) && msg.payload.length > 0 && msg.payload[1] && msg.payload[1].fromShortName) {\n var fromLongName = msg.payload[1].fromLongName;\n\n // Use fromShortName as user\n var user = fromLongName;\n\n // Calculate the session ID for the user\n var sid = generateSessionID(user);\n\n // Extract other values from the payload\n var lat = msg.payload[0].lat;\n var lon = msg.payload[0].lon;\n var alt = msg.payload[0].alt;\n var tm = msg.payload[0].tm;\n var sog = msg.payload[0].groundSpeed;\n\n // Check if alt is NOT within the specified range (-1000 to 15000)\n if (!(alt >= -1000 && alt <= 15000)) {\n // If alt is NOT within the range, set it to 0\n alt = 0;\n }\n\n // Prepare the data payload for the HTTP POST request\n var postData = `leolive=1&user=${user}&lat=${lat}&lon=${lon}&sid=${sid}&password=123&sog=${sog}&alt=${alt}&tm=${tm}`;\n\n // Set up the HTTP request parameters\n msg.method = \"POST\";\n msg.url = \"https://skylines.aero/track.php\";\n msg.headers = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Content-Length': postData.length\n };\n msg.payload = postData;\n\n return msg;\n} else {\n // If \"fromShortName\" property is not present in the incoming message, return null\n node.warn(\"Invalid or missing properties in the incoming message.\");\n return null;\n}\n",
"func": "// JavaScript function to calculate session ID\nfunction generateSessionID(userID) {\n // Generate a random session ID with the last three bytes matching the user ID\n var session_id = Math.floor(Math.random() * (Math.pow(2, 24) - 1)) | userID;\n\n return session_id.toString();\n}\n\n// Check if the incoming message has the \"fromLongName\" property\nif (msg.payload && Array.isArray(msg.payload) && msg.payload.length > 0 && msg.payload[1] && msg.payload[1].fromLongName) {\n var fromLongName = msg.payload[1].fromLongName;\n\n // Extract the user ID from the LongName\n var parts = fromLongName.split('/');\n var userID = parts[parts.length - 1];\n\n // Calculate the session ID for the user\n var sid = generateSessionID(parseInt(userID, 16));\n\n // Extract other values from the payload\n var lat = msg.payload[0].lat;\n var lon = msg.payload[0].lon;\n var alt = msg.payload[0].alt;\n var tm = msg.payload[0].tm;\n var sog = msg.payload[0].groundSpeed;\n\n // Check if alt is NOT within the specified range (-1000 to 15000)\n if (!(alt >= -1000 && alt <= 15000)) {\n // If alt is NOT within the range, set it to 0\n alt = 0;\n }\n\n // Prepare the data payload for the HTTP POST request\n var postData = `leolive=1&user=${userID}&lat=${lat}&lon=${lon}&sid=${sid}&password=123&sog=${sog}&alt=${alt}&tm=${tm}`;\n\n // Set up the HTTP request parameters\n msg.method = \"POST\";\n msg.url = \"https://skylines.aero/track.php\";\n msg.headers = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Content-Length': postData.length\n };\n msg.payload = postData;\n\n return msg;\n} else {\n // If \"fromShortName\" property is not present in the incoming message, return null\n node.warn(\"Invalid or missing properties in the incoming message.\");\n return null;\n}\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
Expand All @@ -1565,15 +1565,15 @@
"type": "debug",
"z": "4348da314170486a",
"name": "position",
"active": false,
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"x": 1280,
"y": 80,
"wires": []
},
Expand Down Expand Up @@ -1637,7 +1637,7 @@
"type": "function",
"z": "4348da314170486a",
"name": "telegramit",
"func": "const packet = msg.payload.packet;\nconst messageContent = packet.decoded.payload; // Message content\nconst fromShortName = packet.fromShortName; // Extracting fromLongName\n\n// Constructing the message content with fromLongName\nconst content = `${messageContent} from ${fromShortName}`;\n\n// Forming the message object for the Telegram sender\nconst telegramMsg = {\n chatId: -1002032937783, // Assuming this is your chat ID\n type: 'message',\n content: content,\n options: {\n message_thread_id: 22\n }\n};\n\n// Set the formatted message as the new payload\nmsg.payload = telegramMsg;\n\n// Return the modified message\nreturn msg;\n",
"func": "const packet = msg.payload.packet;\nconst messageContent = packet.decoded.payload; // Message content\nconst fromLongName = packet.fromLongName; // Extracting fromLongName\n\n// Constructing the message content with fromLongName\nconst content = `${messageContent} from ${fromLongName}`;\n\n// Forming the message object for the Telegram sender\nconst telegramMsg = {\n chatId: -1002032937783, // Assuming this is your chat ID\n type: 'message',\n content: content,\n options: {\n message_thread_id: 22\n }\n};\n\n// Set the formatted message as the new payload\nmsg.payload = telegramMsg;\n\n// Return the modified message\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
Expand Down

0 comments on commit 4267efb

Please sign in to comment.