So far, we can connect ESP32 to IBM Watson IoT Platform on button press, confifure Node-RED for the purpose to send email alert. But the email body will become like {d: {"aMessage": "11"}}
. It is machine readable JSON format.
Here is How to Replace the Payload Message Sent by ESP32 to Node RED on IBM Watson IoT to Human Readable Meaningful Text Message.
It is very easy. Click-drag the Node named “Change”. Double click to edit it. Give it some name you like. In the Rules field, first option to be made from the drop-down is “Set”. Beside it, the dropdown option will be “Message Payload”. In the next row of options, there is drop-down. Select “String” and type your intended text, such as “Button pressed”. Now drag it between the IBM Iot node and Email node so that the thing looks like this :
Now, click to deploy the instance. Then do the action like button press on ESP32 to test. You will receive plain text message as email. Your next improvement of this project should be to send push notification using the flow so that you will have multiple fail proof options to get notified about the button press. Although Node-RED looks odd, difficult to many of the new users, it is actually easy and involves minimal coding.
---
In this short guide, we completely altered the input from our IoT device ESP32 to a custom human readable message. We can create another “Change” node connected to the original IBM IoT node and put our required JSON data, connect with another node from the http node to have an HTTP POST request, another node to pass the authorization header. So adding more three nodes as a branch, we can send request to an external service such as Firebase. In this manner, we have lot of options for notifying about changes in more complex IoT projects.
Tagged With node red replace mas payload string