Send sms with node-RED

Hi everyone. I would like to use node-RED send the sms to my phone. My sms device is Maestro.

I write the format send sms to Maestro and they just display this.
image
I did not receive any message on my phone.

This is my code.

`[{"id":"b6b35c7e.3e30b","type":"tcp out","z":"cf481068.5cc7d","host":"192.168.1.1","port":"22","beserver":"client","base64":false,"end":false,"name":"","x":590,"y":620,"wires":[]},{"id":"803eb305.439d6","type":"inject","z":"cf481068.5cc7d","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":500,"wires":[["1ec5339b.4e72dc"]]},{"id":"7264934f.e3240c","type":"debug","z":"cf481068.5cc7d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":500,"wires":[]},{"id":"791ae714.afef28","type":"tcp request","z":"cf481068.5cc7d","server":"192.168.1.1","port":"22","out":"time","splitc":"0","name":"","x":470,"y":500,"wires":[["7264934f.e3240c"]]},{"id":"1ec5339b.4e72dc","type":"function","z":"cf481068.5cc7d","name":"","func":"msg={payload:\"AT#SENDSMS=\"<+60182090000>\"This is a test from Ethernet SMS\"}\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":620,"wires":[["791ae714.afef28","b6b35c7e.3e30b"]]}]`

TQVM.

It would be pretty unusual for a device to be at port 22 on 192.168.1.1 - for many people that is their home gateway on their network

ALso based on your screenshot you have set the port to 22 (which is the port for SSH) - but it states that the default is 5555 - which is it ?

Craig

If the default is 5555 the node red will show connection failed. I dont know wheather is tcp got problems or the function node.

jason

So what is the default gateway on your network - and what are your network details (i.e. IP range, DNS etc etc)

hi craig, i know my default gateway for pc one already. so what is the next step i show do?
thanks.

jason

I have no idea what you wre saying in that last sentence. ?

Is you default gateway on the network 192.168.1.1. ?? if so then you can not do a TCP node to it (or you can but it will not do anything about sending an SMS for you !)

The reason why when you hit 192.168.1.1 on port 22 that is responds is that you have SSH enabled on your Firewall/router.

Is the SMS solution you are trying to use - a piece of hardware that you plug into your network - or is this an Internet based service ?

Craig

image


Why I will get this type of error?
FYI, Below is the code in function node:
msg={payload:"AT#SENDSMS="<+60182090000>",This is a test from Ethernet SMS^"}
return msg;

Take a look at your function node

msg={payload:"AT#SENDSMS="<+60182090000>"This is a test from Ethernet SMS"}

You are confusing string start and end with quotes in your string, try

msg={payload:'AT#SENDSMS="<+60182090000>"This is a test from Ethernet SMS'}

But you also need to send it to the correct port.

If you add a debug node to check what you are sending...

What error are you refering to?

The debug output shows the TCP node has returned a Buffer object containing 362 bytes of data.

That is probably some text. If you click the button that says 'raw' it will try to display it as a string and you'll be able to read what it says.

I wrote a JSON API Adapter to the Perl SMS::Send Architecture. So, if there is an SMS::Send driver for your provider, you can just use the JSON web service adapter. SMS-Send-Adapter-Node-Red-0.05 - SMS::Send Adapter to Node-RED JSON HTTP request - metacpan.org.

[{"id":"3313f548.d53dba","type":"inject","z":"bbbcee28.8891c","name":"Inject","topic":"","payload":"My SMS Text","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1540,"wires":[["5cb3e4eb.f6d34c"]]},{"id":"3a6aed54.d74342","type":"debug","z":"bbbcee28.8891c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.sent","targetType":"msg","x":710,"y":1540,"wires":[]},{"id":"a9dfd541.a3b3f8","type":"http request","z":"bbbcee28.8891c","name":"SMS::Send","method":"POST","ret":"obj","paytoqs":false,"url":"https://127.0.0.1/cgi-bin/perl-SMS-Send-Adapter-Node-Red.cgi","tls":"","persist":false,"proxy":"","authType":"","x":490,"y":1540,"wires":[["3a6aed54.d74342","aec87ffa.ec17f"]]},{"id":"aec87ffa.ec17f","type":"debug","z":"bbbcee28.8891c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"statusCode","targetType":"msg","x":700,"y":1500,"wires":[]},{"id":"707cfb7e.11b714","type":"debug","z":"bbbcee28.8891c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":490,"y":1500,"wires":[]},{"id":"5cb3e4eb.f6d34c","type":"function","z":"bbbcee28.8891c","name":"payload formatter","func":"my_text     = msg.payload;\nmsg.payload = {\n               \"driver\"  : \"VoIP::MS\",\n               \"text\"    : my_text,\n               \"to\"      : \"7035551212\",\n               \"options\" : {\"key\" : \"value\"},\n              };\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":1540,"wires":[["707cfb7e.11b714","a9dfd541.a3b3f8"]]}]