I'm trying to find our how to send SMS messages via the ZTE MF286D MiFi device ?
I've recently purchased this device and discovered I can manually send/receive SMS messages via the user-interface web page. What I'd like to be able to do is send SMS messages from Node-RED to my mobile phone or from an IoT node (like Wemos D1 Mini or ESP32) to my mobile.
e.g. Status information or an alarm condition. [As an alternative to using MQTT]
I heard about 'goform/goform_set_cmd_process' but haven't found much information about it.
As a starting point I've found this MicroPython script that runs (without giving any errors) but doesn't send the SMS - well it doesn't arrive on my phone. As there is so little documentation available, I'm not sure if the MF286D supports 'goform'.
import requests
def send_sms(router_ip, username, password, recipient_number, message):
# Construct the URL for sending SMS
url = f"http://{router_ip}/goform/goform_set_cmd_process"
# Construct the data payload for the request
data = {
"isTest": "false",
"goformId": "SEND_SMS",
"notCallback": "true",
"Number": recipient_number,
"sms_time": "",
"MessageBody": message,
"ID": "-1",
"encode_type": "UNICODE",
"send_time": "",
"flag": "4",
"sms_priority": "0",
"save_type": "0",
}
# Send the POST request to send the SMS
response = requests.post(url, data=data, auth=(username, password))
# Check the response status code
if response.status_code == 200:
print("SMS sent successfully.")
else:
print("Failed to send SMS.")
# Usage example
router_ip = "192.168.32.1" # Replace with your router's IP address
username = "xxxx" # Replace with your router's username
password = "xxxx" # Replace with your router's password
recipient_number = "+123456789" # Replace with the recipient's phone number
message = "Hello, this is a test SMS message from the MiFi box."
send_sms(router_ip, username, password, recipient_number, message)
# Send the POST request to send the SMS
response = requests.post(url, data=data, auth=(username, password))
The above script uses the 'requests' library, so I assume there may be an equivalent way of using the
http-request node in Node-RED ?
Any advice, suggestions, feedback would be greatly appreciated especially if you have this device.