/r/nodered

Photograph via snooOG

A place to share nodes and flows, and discuss Node-RED, a low-code tool for event-driven applications.

Node-RED is a drag and drop programming tool made by IBM Emerging Technology to automate the Internet of Things.

You can think of it as the glue that connects your phone to your air conditioner, so that your AC is on half an hour before you get home.

Project home page at: http://nodered.org

/r/nodered

14,828 Subscribers

2

HA Automation for Node-Red

Hello everyone. I would like to ask if anyone is able to pass this automation to Node-Red. I can't do the whole process, as far as playload is concerned I don't understand how to get the events created by frigate. Thanks

alias: "[cam] front door motion > notify "
description: ""
trigger:
  - platform: mqtt
    topic: frigate/events
    payload: new
    value_template: "{{ value_json.type }}"
condition:
  - condition: template
    value_template: "{{trigger.payload_json[\"after\"][\"camera\"] == 'front_door' }}"
action:
  - service: telegram_bot.send_photo
    data:
      target: REDACTED
      url: >-
        http://REDACTED/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/snapshot.jpg
      caption: >-
        camera: {{trigger.payload_json["after"]["camera"] | replace("_", " ") |
    title }}

        snapshot: _{{trigger.payload_json["after"]["label"]}}_ 

        ID: `{{trigger.payload_json["after"]["start_time"]|int}} `

    `{{now().strftime("%d/%m/%y %H:%M")}}` 📷
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 45
      milliseconds: 0
    enabled: true
  - service: telegram_bot.send_video
    data:
      caption: |-
        video: _{{trigger.payload_json["after"]["label"]}}._
        ID: `{{trigger.payload_json["after"]["start_time"]|int}} `🎥
      timeout: 1000
      target: REDACTED
      disable_notification: true
      url: >-
    http://REDACTED/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4
    enabled: true
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
    enabled: false
mode: single
max_exceeded: silent
2 Comments
2024/12/03
22:39 UTC

2

UniFi AI pro NPR to activate an HA automation

As the title suggests, I have a UniFi AI pro camera and I want to activate an automation in HA when the camera detects a known number plate. I’m new to node red so some pointers of how to go about it would be brilliant or a chat to someone who already has this would be good too!

2 Comments
2024/11/29
15:41 UTC

0

Without DSA Job ? Nodejs 🫠

How can I get a job as a Node.js backend developer without DSA? I am a 2023 graduate looking for a job as a Node.js backend developer, but I am not able to secure one. What should I do? What extra steps can I take?

Here is My GitHub: https://github.com/AtharvDalal

3 Comments
2024/11/29
14:01 UTC

1

Node Red SQlite database

Hi, I'm trying to do a project where I need to store values from a csv into a database. I have made a post a few days ago about that.

Right now I was able to access the data and I'm trying to store it, the problem is that the script I have is passing Null values to the database. But if I use a similar script but instead of reading a csv file a ass the values manually it will work.

Does anyone know whats wrong? Thanks

FLOW

CODE READ FROM CSV FILE

// Ensure that all required fields exist in the payload and are properly formatted
if (!msg.payload.date || !msg.payload.time || msg.payload.activity === undefined ||
    msg.payload.acceleration_x === undefined || msg.payload.acceleration_y === undefined ||
    msg.payload.acceleration_z === undefined || msg.payload.gyro_x === undefined ||
    msg.payload.gyro_y === undefined || msg.payload.gyro_z === undefined) {

    node.error("Missing required field(s) in payload: " + JSON.stringify(msg.payload)); // Log error if any field is missing
    return null;  // Prevent further processing if essential data is missing
}

// Log the values to ensure they are correctly passed to the SQL query
node.warn("Payload values: " + JSON.stringify(msg.payload)); // Debug payload

var sql = `
    INSERT INTO sensor_data1 
    (date, time, activity, acceleration_x, acceleration_y, acceleration_z, gyro_x, gyro_y, gyro_z) 
    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);
`;

// Extract data from the payload and ensure proper formatting
var values = [
    msg.payload.date,
    msg.payload.time,
    msg.payload.activity,
    msg.payload.acceleration_x,
    msg.payload.acceleration_y,
    msg.payload.acceleration_z,
    msg.payload.gyro_x,
    msg.payload.gyro_y,
    msg.payload.gyro_z
];

// Log the extracted values before passing them to the SQLite node
node.warn("Extracted Values: " + JSON.stringify(values));

// Attach the SQL query and values to the message for the SQLite node
msg.topic = sql;
msg.params = values;

// Log the final message to verify before passing it to the SQLite node
node.warn("Final message to SQLite: " + JSON.stringify(msg));

// Pass the message along for execution by the SQLite node
return msg;



CODE MANUAL INSERT


var sql = `
    INSERT INTO sensor_data1 
    (date, time, activity, acceleration_x, acceleration_y, acceleration_z, gyro_x, gyro_y, gyro_z) 
    VALUES ('2023-07-01', '13:54:59', 0, 0.5742, -1.041, -0.2881, 0.2379, -0.2413, 0.8891);
`;

// Log the query to see if it's working with hardcoded values
node.warn("SQL Query: " + sql);

// Attach the SQL query to the message
msg.topic = sql;

// Pass the message along for execution by the SQLite node
return msg;

3 Comments
2024/11/28
22:54 UTC

2

Newbie trying to create a Dashboard chart

Well, I'm kinda new to node-red, I'm trying to create a dashboard to display info I have store in a database. I want it to get the X and Y values, date the information was taken and the activity status at the time respectively, to make a chart, but i'm having a really hard time trying to figure out how i set the X and Y values on the chart. I've tried having function node that send a msg payload in various formats, but couldn't figure it out. Any help is appreciated, thanks

3 Comments
2024/11/28
18:42 UTC

3

webcam camera on dashboard

Hello, I’m facing an issue with the webcam node from node-red-node-ui-webcam. When I access the Node-RED dashboard on my browser, the webcam video displays correctly. However, when I open the dashboard on my phone, the video does not appear. How can I fix this? Should I use a different method?

9 Comments
2024/11/28
17:19 UTC

1

Creating multiple IoT Dashboards with node red

I am using node-red to create an IoT dashboard for a work project.

I will start out with one device, but I am wondering if node-red is the right choice for when I want to add devices, creating multiple separate dashboards. Do I have to run a separate node-red instances for each dashboard? Or can I create multiple dashboards using different flow tabs?

We would like to run node-red on microsoft Azure. Is FlowFuse maybe a good option for us?

Thanks in advance for any help provided!

8 Comments
2024/11/28
09:39 UTC

0

Capture IP Camera snapshot and send to mobile Device

HI All -

I'm looking for a good example/tutorial to have my HomeAssistant/BlueIris setup grab a still image from an IP camera on a specific trigger, and then send that to mobile device(s).

I have the camera outputting an appropriate link which is availble by the URL (checked and works). The notificaiton sends to the HA companion app, but there is no picture included.

I know there must be a tutorial on how to do this, but so far my searches have turned up empty.

Could anyone point me in the right direction?

Thanks!

4 Comments
2024/11/26
23:31 UTC

1

Random video play

Is it possible to have a random video play each time on google home display?

I can play one indivdual file but not from a list

Attached is my flow+

[
    {
        "id": "7a15788ca7fb8851",
        "type": "function",
        "z": "7dfec2778b4499cc",
        "name": "Select Random Media",
        "func": "var media_files = [\n    'media-source://media_source/local/Azaan.mp4',\n    'media-source://media_source/local/Azaan1.mp4',\n    'media-source://media_source/local/Azaan2.mp4',\n    'media-source://media_source/local/Azaan3.mp4',\n    'media-source://media_source/local/Azaan4.mp4',\n    'media-source://media_source/local/Azaan5.mp4'\n];\n\n// Select a random file\nvar random_media = media_files[Math.floor(Math.random() * media_files.length)];\n\n// Set the media content id to the random file\nmsg.payload = {\n    \"entity_id\": [\n        \"media_player.living_room_display\",\n        \"media_player.kitchen_display\"\n    ],\n    \"media_content_id\": random_media,\n    \"media_content_type\": \"video.mp4\"\n};\n\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1280,
        "y": 660,
        "wires": [
            [
                "71eed351ddedf098"
            ]
        ]
    },
    {
        "id": "71eed351ddedf098",
        "type": "api-call-service",
        "z": "7dfec2778b4499cc",
        "name": "Play Media on Displays",
        "server": "10d60cb7.4f5173",
        "version": 7,
        "debugenabled": false,
        "action": "media_player.play_media",
        "floorId": [],
        "areaId": [],
        "deviceId": [],
        "entityId": [],
        "labelId": [],
        "data": "{\t   \"entity_id\":[\t       \"media_player.living_room_display\",\t       \"media_player.kitchen_display\"\t   ],\t   \"media_content_id\":\"media-source://media_source/local/Azaan.mp4\",\t   \"media_content_type\":\"video.mp4\"\t}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "blockInputOverrides": false,
        "domain": "media_player",
        "service": "play_media",
        "output_location": "none",
        "output_location_type": "none",
        "x": 1550,
        "y": 660,
        "wires": [
            []
        ]
    },
    {
        "id": "10d60cb7.4f5173",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": "at: ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]
6 Comments
2024/11/26
22:01 UTC

1

Reading files in NodeRed

Hi I'm very new to NodeRed and IOT, for a class I have I need to implement a specific architecture, using Docker. I need Help.

For the 1º phase we are suppose to understand the "offline" data set and create a dashboard to display statistical results.

But I have tried countless times to access the csv file, but it keeps giving me

"TypeError: The "options" argument must be of type object. Received an instance of Array" - for the create dataset node

"Error: ENOENT: no such file or directory, open ''/Users/david/Desktop/David/Faculdade_Mestrado/IOT/Exercise Data /trainningdata.txt''" - for the read file -> csv node workflow.

https://preview.redd.it/39as76wbew2e1.png?width=1042&format=png&auto=webp&s=086ca78a411e42d854eea4a90f1c151ee2592486

https://preview.redd.it/71ezy837fw2e1.png?width=1926&format=png&auto=webp&s=044c970368e0ef22c7655e9cd549759c7e9eae56

https://preview.redd.it/gh2ghqr8fw2e1.png?width=918&format=png&auto=webp&s=6bde811f67e002f79a575169c27242c17219c0b4

4 Comments
2024/11/24
19:14 UTC

1

Node Red - Homebridge Log

Hello, I am running nodered through a docker on my synology nas, and I use it for automations linked to my homebridge, also running on a docker. Is there any way for me to check the nodered log and see the flows activity? I checked the nodered docker log, but thee only shows errors, nothing else. Thank you.

4 Comments
2024/11/23
10:49 UTC

2

Controlling a fan by both Radon and CO2

I've got a fan I want to control by both Radon- and CO2-levels. Whichever is "worse" must be the decider.

Fan settings are 0%, 25%, 50%, 75% and 100%

Radon-levels are 0-200

CO2-levels are 0-2000

If Radon = 200 and CO2 = 0 then the fan = 100%

If Radon = 0 and CO2 = 100 then the fan = 25%

If Radon = 100 and CO2 = 200 then the fan = 50% and so on.

Any pointers on how to do it?

5 Comments
2024/11/22
19:22 UTC

1

Tabulator torment

Hi all,

I have started using Node Red a couple of months ago and have managed to get data in and out of REST APIs following lots of examples online. I can also display JSON data on a Dashboard (2.0) with the standard table node.

My problem is, I now want to show tables with nested data.

Tabulator supports this but I have no clear examples of how to get this working,. I think I need to send commands to the tabulator node and then link it to the standard table? Can anyone provide or point me to a guide with examples of how to do this please? The tabulator site has lots of reference data but I don't know how to apply this to the Node Red workflow. I can only go so far on guesswork and limited coding experience.

Any pointers would be greatly appreciated.

4 Comments
2024/11/22
18:03 UTC

1

Node Red Chatbot with node-red-contrib-ai-intent - Stuck in Infinite Function Calling Loop

Hi everyone!
I'm developing a chatbot using Node Red and the node-red-contrib-ai-intent package, and I'm encountering a persistent issue with function invocation. The chatbot seems to get trapped in an endless loop, repeatedly calling the same function even when it should logically stop.

Specific details:

  • Tools/functions are defined for the chatbot to perform tasks
  • When certain conditions should halt function calls, the bot continues triggering the same function

Has anyone experienced similar challenges? Any insights on:

  • Debugging infinite loops in AI intent-driven chatbots
  • Implementing proper exit conditions
  • Configuring node-red-contrib-ai-intent to prevent recursive function calls

Any guidance or troubleshooting tips would be greatly appreciated!

0 Comments
2024/11/22
15:23 UTC

1

Can I use a global variable withun a node?

Hi,

I'm wondering: is possible to use a global variable in e.g., a change node, or do I need to replace it with a function node to be able to call the global variable?

Thanks!

2 Comments
2024/11/21
19:38 UTC

0

NodeRed Template/Tableify Issue

Hey guys, so amnew to node red and am still trying to learn it but I have an issue that i cannot solve If someone can help Pls !
So I want to display my database info in a table. If I use tableify it works perfectly, But I want to do it using a template node because it's more flexible.
Am using : http in (post) => Mongodb in => Funtion that collects data and does some math on the data => Tableify => Http response. So this works perfectly.

But when I use template instead of tableify (or even a template after tableify) it doesn't work anymore ( { template (the orange one) nor </> template (the blue one) ) and it's a huge obstacle for me ATM

If someone can help I would appreciate it <3

This Flow works well !

Here is the result of the first flow

But when I use a template : { template (the orange one) or </> template (the blue one) it doesn't work anymore.

https://preview.redd.it/a29nbeqq5b2e1.png?width=1098&format=png&auto=webp&s=eb91492d04785fe8133c44febc95718b9a442103

https://preview.redd.it/3wkx9alw5b2e1.png?width=395&format=png&auto=webp&s=a2dc58f5e24ee6a02623de54f885850a85f17960

I used a debug node in each step and I have the problem specifically in the template.

If anyone knows how to fix this problem, I would appreciate the help ! much love reddit <3

3 Comments
2024/11/21
13:30 UTC

7

A dashboard built for smart retail inventory monitoring & unauthorized intrusion monitoring

0 Comments
2024/11/19
07:16 UTC

24

I've written a Node-RED column with 88 articles to help people who want to learn Node-RED and use it for their projects.

I'm a Chinese software technology blogger who has been blogging consistently for more than 8 years, and all my posts are on CSDN (China's largest technical communication community). I wrote a column about Node-RED, there are more than 80 articles, contains the basic concept of Node-RED explanation, use, component development, business case design, and some project examples I did using it. But these documents are all in Chinese, I don't know if anyone needs them. Here's the link to the column.

https://blog.csdn.net/github_35631540/category_11294112.html

If anyone wants to know more about it, feel free to write to me privately, and if anyone wants technical support for Node-RED, I'd be happy to help.

2 Comments
2024/11/19
01:55 UTC

2

I’m working on a project with a DHT11 sensor, potentiometer, and LED (acting as AC).The LED should turn ON when the potentiometer value exceeds the temperature. I also added an override mode to manually control the LED with serial commands (OVERRIDE_ON and OVERRIDE_OFF), but it’s not working

1 Comment
2024/11/18
12:20 UTC

2

Can I find the Xilinx Zynq 7020 IO Library?

Hello Redditors,

I wanted to ask a small question, I am currently working with a Zynq 7000 series SoC module and have Node-Red installed on it via Embedded Linux, can you also find a library for Zynq 7020 IO pins? like Raspery pi?

My board is a Digilent Pynq-Z1

Thank you!

0 Comments
2024/11/17
15:46 UTC

3

Inject node changes—no longer a button?

I use node-red as a home-assistant add-on. Both are up to date, with the add-on version 18.1.1. Everything has been working, but since I last touched node-red, at some point none of the Inject nodes work as buttons in the interface. They'll work as expected at specific times etc, but can't be used as a push-button any more for debugging. I've scanned the changelogs, but don't see anything really relevant.

Is that new behavior, or am I missing something stupid?

4 Comments
2024/11/17
02:03 UTC

1

Extract Value using Switch Note

Hi,

Nodered Noob here.

I am trying to get power readings form my shelly PM mini.

In the picture is the Output from the Shelly API. The only problem is the ":" in "pm1:0".

Please could someone telly me, how to extract the "apower" value. All my attempts failed because of the ":"

https://preview.redd.it/cey5peh96j0e1.png?width=523&format=png&auto=webp&s=e1e6c10d56284295e7b8a60f85d1ff92d95abb43

3 Comments
2024/11/12
20:33 UTC

7

Unlocking the Power of Real-Time Data: FlowFuse MQTT Broker for Industrial Transformation

FlowFuse MQTT Broker for Industrial Transformation

Optimize your industrial processes with FlowFuse MQTT Broker, a new service that simplifies real-time data access.

In today's rapidly evolving industrial landscape, real-time data is the key to unlocking operational efficiency and driving innovation. However, managing and utilizing this data effectively can be a significant challenge. Legacy systems, disparate data sources, and complex integration processes often hinder organizations from harnessing the full potential of their industrial data.

This is where an MQTT Broker can help. It acts as a central hub, facilitating communication between devices and applications by receiving, filtering, and distributing messages.

About the Webinar:

In this webinar, we'll introduce the FlowFuse MQTT Broker, a seamless solution that enables you to manage all your MQTT clients, Node-RED instances, and devices from a single, centralized platform, eliminating the need for a separate broker service.

Join Nick O’Leary, creator of Node-RED and CTO at FlowFuse on November 27, 2024, at 17:00 CET (11:00 AM ET) to learn about :

  • The advantages of MQTT for industrial communication
  • Key features and benefits of the FlowFuse MQTT Broker
  • How to integrate FlowFuse with existing industrial systems

Who Should Attend?

This webinar is perfect for:

  • Automation Engineers
  • Operational Technology (OT) Leaders
  • Anyone looking to optimize their industrial processes and accelerate digital transformation.

Register now to secure your spot and take the first step toward transforming your industrial processes with FlowFuse!

🔗 Register Now

0 Comments
2024/11/11
14:00 UTC

1

Issues with node red & telnet / ssh

Hey guys.

I have a device I’m trying to control via Telnet. I can control it just fine with basic strings through Telnet via putty, though as soon as I try via node red I get all sorts of whacky outcomes.

Tried with SSH aswell, and I get errors back on the SSH authentication (which is odd as there’s no password).

I spent afew hours trying to debug with chatGPT, to which got to a point where it seemed the command would be sent correctly as per debug, though no actual state change was made on the device. And expected feedback message from the device was different.

Does anyone have any pointers / suggestions to try and resolve this?

Very confused why I can send a basic string command in putty and it works perfectly but trying the same thing on node red just errors out.

Thanks!

11 Comments
2024/11/10
01:01 UTC

2

Google classroom into mode red

Integrating node red with Google Classroom

I am a student who uses Notion for all my college work. I am looking at integrating Notion into node red, and I wondered if there is a way to integrate Google Classroom into node redt too, so I can use node red to create flows such as 'when assignment added to classroom, create task in database' with the title and date etc. I have already tried this in Pipedream and it works however I am limited to 3 workflows. Does anyone know of anyway to integrate Google Classroom to node red? I don't have much knowledge of coding however can try and teach myself if someone can explain the basics of how to create such an integration

4 Comments
2024/11/06
07:24 UTC

8

Is this the proper way of turning light on?

17 Comments
2024/11/05
23:41 UTC

1

'Connect Socket Failed' error while trying to send a message to node red (via HTTP) through lte modem (SIM A7670c) using AT commands

I am trying to send a message using my lte modem (SIM A7670c) to cloud. I am interested in making use of the http protocol for achieving the same. I also set up a node red flow as shown below. I tried sending http request using the modem's at commands, but it responds with an error - 'connect socket failed'. To refine the issue to the modem or node red or server, I made use of MQTT protocol instead of HTTP and just replaced the 'http in' node in the flow to a 'mqtt in' flow. The message sent using at commands was received. So, I think its safe to presume that the modem is working just fine. Then, I used Postman to a HTTP request to the same url and I was able to notice the requests in the debug panel of the node red flow. I have also tried to send HTTP request from the modem to ThingSpeak instead of NodeRed and it works. But, how does this error occur when we try to connect the modem to node red. I have done multiple attempts and wasn't able to get over it. I have attached the AT commands I have used and also the http AT command list of the modem. Any views/ opinions on tackling this situation is welcome. TIA

node red flow

at commands used

list of http at commands

https://preview.redd.it/no9k6uph72zd1.png?width=479&format=png&auto=webp&s=7d14669890c0ed13d147328b57326125841e9035

details of the at command for setting http parameters

5 Comments
2024/11/05
10:25 UTC

3

Best practice for MQTT sources

I am a complete beginner with node-red, and have just started tinkering about with zigbee2mqtt and a couple handful sensors and lights.

I was wondering, what is the best practise when it comes to MQTT input?

Is it having a single input node listening to all messages in the zigbee2mqtt topic and then branches out and maybe connects to other flows?

or

Having multiple MQTT in nodes listening to only relevant topics for the flow it is placed in?

The reason I am asking is that I can see that node-red establishes separate connections per MQTT in node, which will result in many connections to the MQ server.

12 Comments
2024/11/04
18:40 UTC

2

Storing data

Hello all,

I am trying to store data from my p1 port of my electricity meter. This spits out data every second. This has 34 variables. Now I tried to put that in a csv file but after some time my pi zero 2 started to become very slow and not responding and accessible via the website. I had to pull the plug and restart and start node red in safe mode from putty. I checked the file and it is 17mb after 1 week or so. Is this (too) big? Does anyone have advise on how to store this data. Should I for example start a new file every day or is once a month enough? Thanks in advance.

9 Comments
2024/11/04
10:37 UTC

Back To Top