Step 1: Accessing Node-RED
- Open your Home Assistant instance.
- Navigate to the Node-RED addon.
- Click on the addon to open the Node-RED editor.
Step 2: Importing the Flow
- In the Node-RED editor, click on the menu icon in the top-right corner.
- Select “Import” from the dropdown menu.
- Copy the provided flow JSON.
- Paste the JSON into the import dialog box.
- Click “Import” to import the flow.
|
|
Step 3: Understanding the Flow
This flow is designed to periodically send a message to an MQTT topic. Let’s break down each node:
Inject Node (inject1)
- This node injects a message into the flow at regular intervals (every 600 seconds in this case).
- It sends the payload “Like and subscribe”.
Function Node (function1)
- This node prepares the message to be sent to the MQTT broker.
- It takes the payload from the inject node and constructs a new message object.
- The message object contains:
text
: The text to be displayed (“Like and subscribe”).icon
: An icon identifier (in this case, “10516”).duration
: The duration for which the message will be displayed (10 seconds).
- The constructed message object is then sent to the next node.
MQTT Out Node (mqtt1)
- This node sends the prepared message to an MQTT topic.
- Note: You need to customize the MQTT broker settings:
- Add the IP address of your MQTT broker in the “Server” field.
- Specify the topic to which the message should be sent in the “Topic” field.
- Add the username of your MQTT broker in the “User” field (if required).
- The message is sent to the specified MQTT topic using the configured broker.
Step 4: Summary
- This flow periodically sends a message containing “Like and subscribe” to the MQTT topic specified in the flow.
- Note: Before deploying the flow, ensure you customize the MQTT broker settings with the appropriate IP address, topic, and username.
- The message content can be customized in the function node according to your requirements.
By following these steps and customizing the necessary settings, you can set up and utilize this Node-RED flow effectively in your environment. Let me know if you need further assistance!