# Listener for sensor value change and save it in BD

**URL:** <https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890>\
**Category:** General\
**Created:** [8 April 2021 22:20 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890 "2021-04-08T22:20:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vpnob](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vpnob/32/40025_2.png) [@vpnob](https://discourse.nodered.org/u/vpnob)\
**Post date:** [8 April 2021 22:20 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/1 "2021-04-08T22:20:48Z")

</div>

Hello, i will have a utility meter to monitor my power consumption but i want to save it in a tablet.

There is any way to detect any change of value and save it on my tablet? Thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 April 2021 22:24 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/2 "2021-04-08T22:24:44Z")

</div>

Hi and welcome to the forum.

Unfortunately, there is no where near enough info to help you.

Is node-red running on the tablet?

How would you want this value saved - in a file? in a database?

changes can be detected by use of the RBE node.

* * *

If you are very new to node-red, can I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![vpnob](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vpnob/32/40025_2.png) [@vpnob](https://discourse.nodered.org/u/vpnob)\
**Post date:** [8 April 2021 22:41 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/3 "2021-04-08T22:41:34Z")

</div>

Hello. I have many flows in NR.

I have Node-RED running in Home Assistant Addon.  
I want save the value in mysql table.

I already have a flow to insert data in a table. But in this case i need any trigger to detect value changes and save it on table.

There is any node listener to detect value changes and start flow to save data?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 April 2021 22:47 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/4 "2021-04-08T22:47:27Z")

</div>

> [@vpnob](#):
>
> But in this case i need any trigger to detect value changes

Where does the value come from(what node)?

Did you look at the rbe node? It can block unless value changes.

---

<div class="post-metadata">

**Author:** ![vpnob](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vpnob/32/40025_2.png) [@vpnob](https://discourse.nodered.org/u/vpnob)\
**Post date:** [8 April 2021 23:09 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/5 "2021-04-08T23:09:30Z")

</div>

I will search about rbe node.

The value comes from entity node (i think is this node to receive the value of sensor)

---

<div class="post-metadata">

**Author:** ![vpnob](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vpnob/32/40025_2.png) [@vpnob](https://discourse.nodered.org/u/vpnob)\
**Post date:** [8 April 2021 23:21 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/6 "2021-04-08T23:21:12Z")

</div>

> [@Steve-Mcl](#):
>
> changes can be detected by use of the RBE node.

I already read documentation about RBE node and is this i want.

But how i can start flow automatically when rbe node value changes?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 April 2021 23:52 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/7 "2021-04-08T23:52:57Z")

</div>

> [@vpnob](#):
>
> But how i can start flow automatically when rbe node value changes?

Sorry. I have no idea how this HA entity thing works. If it fires a msg like MQTT does then simply wire it to the rbe node then prepare the SQL then write to database.

Maybe ask on HA forum? Most people here use node-red without HA.

---

<div class="post-metadata">

**Author:** ![vpnob](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vpnob/32/40025_2.png) [@vpnob](https://discourse.nodered.org/u/vpnob)\
**Post date:** [9 April 2021 00:03 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/8 "2021-04-09T00:03:55Z")

</div>

> [@Steve-Mcl](#):
>
> Maybe ask on HA forum? Most people here use node-red without HA.

Ok. Thanks about your help

---

<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:** [8 June 2021 00:04 UTC](https://discourse.nodered.org/t/listener-for-sensor-value-change-and-save-it-in-bd/43890/9 "2021-06-08T00:04:17Z")

</div>

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