There are some who would like to be able to control various different things through both a Dashboard and their phone with, for example, SMS. This can be done with GSMCloud and can be scaled in relation to numbers and commands.
In this post we will use the following nodes:
- TIME: Add Time, Between, Pulse.
- LOGIC: NOT Gate, Is NULL, Value, AND, Match.
- Notifications: Receive SMS, Send SMS, Write To Log.
Compared to a basic flow that uses commands through SMS, it is relatively simple.
We start by making use of our “Receive SMS” node, where we need to create a sub-system that keeps track of when the flow should be updated. This is because we can easily encounter something called “deadlock”.
And REMEMBER that you must not leave things that are not needed in the “TO” field in Send SMS.
Update System
We start by taking our Receive SMS, after which we need to connect Timestamp to 2x Add Time – Add Time should be set to 10 seconds. Now we need to get our Between node, this node should be connected to both Add time nodes – one should be timed “Time” the other to “Input 2”. Now you just need to connect Timestamp from Receive SMS to “Input 1”. The Between Node’s Output goes in a pulse for 10 seconds.
Phone Numbers
This part is not complicated, but can be long in relation to how many people need to be able to send SMS to the system. Here we will use our Value(text) node and Match node.
How does the match node work?
Short and to the point, it takes an input that it matches with the fields in it and takes the input that goes to the field.
First of all, it is a good idea to have a list of the people who will be on the system. All numbers should start with a country code. So in our case “+45”.
In Receive SMS there is an output called “Sender” this needs to be pulled to our match node’s input. Now the node will match the phone number that comes in with what is written in.
Now you can take the Value node and change it to text to add names to the match node, so you can easily log who sent an SMS and when without any problems.
Now you have a system that will handle phone numbers and make sure they are the right ones.
SMS Commands and Codes
It's really just the same as with phone numbers. There's not much difference, the only difference is that it doesn't matter what you write in the Match node. As long as it only takes the right kinds of input. For example, if you give it a value of “TRUE”, it will send “TRUE” on, but “TRUE” will not be logged or sent as a message without an additional system that can “transform” the value into a STRING that “is alive”. BUT, it can be used in the form of a system that will “trigger” something else if you want.
But you can give the match node “temp”, “1” or “?62345”. After you have created the commands you want, you can take any output from your device, for example temperature and last update from a GT-1000 Pro, you will not be able to take battery because it is a true/false value, without having to do something extra.
But, I don't want to log people who are not on the list.
No problem, we'll just add a little extra to the flow. If the Match node finds data that doesn't match, it will output "NULL". Which means we can use an "Is NULL", "Not GATE" and an "AND Gate" node to fix the problem.
Take an “Is NULL” node and connect it to our output of our phone number match node. This means we need to connect our “Is NULL” to an “AND Gate”. Then your Pulse should also be connected to the “AND Gate”.
This means that it will always return true if a new message arrives, regardless of whether it is from the same number or not. It also means that if a person sending an SMS is not on the list of phone numbers that are “allowed”, then our “AND Gate” will not return “True”.
Connect the entire system together
First of all, we can add a “Write To Log” node. This will create a message, in this message we will create some variables – to keep it simple, my message will just be `{sender} — {command}`. This will allow us to pull the output of other nodes into our message.
Now it's finally time, in your Receive SMS you need to connect “Sender” with your phone number match node – furthermore you need to connect “Message” to the command node.
Both your phone number match node and command node need to be connected to our “Write To Log” node. And our “AND Gate” needs to be connected to our “Write” Input on the Log node.
But I would like to receive an SMS message
Then just use our “Send SMS” node. You need to add all the phone numbers you want to send to in the field called “To”, to write more numbers you need to press “enter” after, numbers in this node do not need a country code.
It should be said that everyone in this node will get a message – if messages are to be separated based on who sends a message, it requires further development in your flow.
Drawings are made with Exalidraw