# Import data from sensor into node-red

**URL:** <https://discourse.nodered.org/t/import-data-from-sensor-into-node-red/81534>\
**Category:** General\
**Tags:** mqtt\
**Created:** [24 September 2023 08:27 UTC](https://discourse.nodered.org/t/import-data-from-sensor-into-node-red/81534 "2023-09-24T08:27:01Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![snax](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@snax](https://discourse.nodered.org/u/snax)\
**Post date:** [29 September 2023 00:19 UTC](https://discourse.nodered.org/t/import-data-from-sensor-into-node-red/81534/21 "2023-09-29T00:19:53Z")

</div>

Hey everyone,

An update... I was so close to giving up, but I have managed to get the system working!!

The issue was the IP address I was connecting to in Node-RED. All the advice and tutorials given said to use the same IP address as the raspberry pi which is 192.168.0.100 and then port 1883. Then I looked at which IP address mosquitto was listening on port 127.0.0.1 so i put this into the mqtt node and alas, it worked. I don't know what that IP is but thank god it worked haha

Here's how it all looks now after all that. I've got it set up to automatically turn the water pump on when the soil moisture goes below 20% and then turn off above 80%. I also added automated a sms to send one for every hour the system is showing a level below 20%, just as a fail-safe. And I can manually turn on the pump if that was to happen..

 ![Screenshot 2023-09-29 at 10.12.31 am](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/33d57a4277071b93e1c340275a27fee469123421.jpeg)

 ![Screenshot 2023-09-29 at 10.14.03 am](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/2/82032919c4f08e066cc25dda3aa64a63a94b6224.png)

Thanks to everyone that shared ideas and helped out!!! I am very much appreciative!!!

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [29 September 2023 07:19 UTC](https://discourse.nodered.org/t/import-data-from-sensor-into-node-red/81534/22 "2023-09-29T07:19:45Z")

</div>

I'm a bit confused and surprised by your response as the IP address 127.0.0.1 with port 1883 means - use the Mosquitto broker on the local machine (which I assume is on IP 192.168.0.100).

The small test flow I posted above used 127.0.0.1 (as I didn't know the IP address of your RPi). If you had tried that flow it would have shown if the local broker was working or not. As @Colin said - once the test flow is working you can change the IP address for another broker - it could on another machine on your home network or even a remote broker.

Anyway, glad you have got it working and receiving data - you can now have fun creating a dashboard.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 September 2023 07:20 UTC](https://discourse.nodered.org/t/import-data-from-sensor-into-node-red/81534/23 "2023-09-29T07:20:05Z")

</div>

Did you include in the mosquitto config file

```auto
allow_anonymous true
listener 1883

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 November 2023 07:20 UTC](https://discourse.nodered.org/t/import-data-from-sensor-into-node-red/81534/24 "2023-11-28T07:20:43Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/import-data-from-sensor-into-node-red/81534.md?page=1)
