UNPKG

smithtek-nodered-sms

Version:

A Node-RED node for sending SMS via ZTE USB modem.

80 lines (73 loc) 3.68 kB
<script type="text/javascript"> RED.nodes.registerType("zte-sms", { category: "smithtek", color: "#B9B6B8", defaults: { phone: { value: "" }, password: { value: "Admin" }, modemIp: { value: "192.168.0.1" }, smsInterval: { value: 10, validate: function(v) { return !isNaN(v) && v >= 5 && v <= 60; } } }, inputs: 1, outputs: 3, // Updated to 3 outputs icon: "icon.png", label: function() { return this.name || "ZTE SMS"; }, oneditprepare: function() { $("#node-input-phone").val(this.phone); $("#node-input-password").val(this.password); $("#node-input-modemIp").val(this.modemIp); $("#node-input-smsInterval").val(this.smsInterval); }, oneditsave: function() { this.phone = $("#node-input-phone").val(); this.password = $("#node-input-password").val(); this.modemIp = $("#node-input-modemIp").val(); this.smsInterval = $("#node-input-smsInterval").val(); } }); </script> <script type="text/html" data-template-name="zte-sms"> <div class="form-row"> <label for="node-input-phone"><i class="fa fa-phone"></i> Phone Number</label> <input type="text" id="node-input-phone" placeholder="Enter phone number"> </div> <div class="form-row"> <label for="node-input-password"><i class="fa fa-lock"></i> Password</label> <input type="text" id="node-input-password" placeholder="Enter password (default: Admin)"> </div> <div class="form-row"> <label for="node-input-modemIp"><i class="fa fa-globe"></i> Modem IP</label> <input type="text" id="node-input-modemIp" placeholder="Enter modem IP (default: 192.168.0.1)"> </div> <div class="form-row"> <label for="node-input-smsInterval"><i class="fa fa-clock"></i> SMS Polling Interval (5-60s)</label> <input type="number" id="node-input-smsInterval" min="5" max="60" placeholder="Enter polling interval (default: 10s)"> </div> </script> <script type="text/html" data-help-name="zte-sms"> <p><b>ZTE SMS Node</b> - This node is designed to send SMS messages and retrieve modem data from the <b>ZTE MF833V</b> USB modem.</p> <h3>Configuration:</h3> <ul> <li><b>Phone Number:</b> Enter the recipient's phone number.</li> <li><b>Password:</b> Modem login password (default: "Admin").</li> <li><b>Modem IP:</b> The IP address of the modem (default: 192.168.0.1).</li> <li><b>SMS Polling Interval:</b> Defines how often the node checks for new SMS (adjustable between 5s and 60s).</li> </ul> <h3>How to Send an SMS:</h3> <p>Inject any string as a <b>plain text</b> message into the node's input. The node will automatically format and send the message to the configured phone number.</p> <p>Example:</p> <pre> [{"id":"1234","type":"inject","payload":"Fault with Pump 1","wires":[["zte-sms-node"]]}] </pre> <h3>Outputs:</h3> <ul> <li><b>Output 1:</b> Last received SMS sender & timestamp.</li> <li><b>Output 2:</b> Last received SMS message content.</li> <li><b>Output 3:</b> Modem status data (refreshes every 10 seconds).</li> </ul> <h3>Supported Modem:</h3> <p>This node is designed to work with the <b>ZTE MF833V</b> USB modem. <br> <a href="https://ztemobiles.com.au/wp-content/uploads/2023/02/MF833V_Help.pdf" target="_blank">View the ZTE MF833V datasheet</a>.</p> </script>