# Notification at specific temperature

**URL:** <https://discourse.nodered.org/t/notification-at-specific-temperature/87938>\
**Category:** General\
**Tags:** function-node\
**Created:** [14 May 2024 09:06 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938 "2024-05-14T09:06:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kralle](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@Kralle](https://discourse.nodered.org/u/Kralle)\
**Post date:** [14 May 2024 09:06 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/1 "2024-05-14T09:06:02Z")

</div>

Hello,  
I'm an absolute beginner in Node Red, but I'm getting used to it. I have a Dragino lsn50-v2 sensor registered with TTN. Node Red and one  
InfluxDB installed. In Grafana the temperature is displayed visually. So far so good.  
The following data comes from MQTT:  
v3/temperatur24ney@ttn/devices/temp001/up : msg.payload : Object  
object  
end\_device\_ids: object  
correlation\_ids: array[2]  
received\_at: "2024-05-14T06:57:32.881168746Z"  
uplink\_message: object  
f\_port: 2  
frm\_payload: "AQEBAQ=="  
decoded\_payload: object  
ADC\_CH0V: 0  
BatV: 0.257  
Digital\_IStatus: "L"  
Door\_status: "OPEN"  
EXTI\_Trigger: "FALSE"  
Illum: 0  
TempC1: 25.7  
Work\_mode: "IIC"  
rx\_metadata: array[1]  
settings: object  
simulated: true  
I want to be notified at a certain temperature. The node mail already works. How do I realize that? Thank you

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 May 2024 09:14 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/2 "2024-05-14T09:14:35Z")

</div>

You may have to edit your post.

Not a big problem, but it is difficult to read the _structure_ of the message.

Also add some _empty lines_ between things.  
(Though that is limited to ONE at maximum.)

So edit it and where the actual `payload` is do this:

Add an empty line after the **date come from MQTT:**

Then click the button at the top of the `edit area` that looks like this: `</>`

```auto
type or paste code here

```

Put the `payload` (the message with which you need help) where it says `type or paste code here.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [14 May 2024 09:18 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/3 "2024-05-14T09:18:31Z")

</div>

> [@Kralle](#):
>
> I want to be notified at a certain temperature.

Perhaps you mean "at or above a certain temperature"?  
It's very simple with a Switch node:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/1/21b8c712b34d0d9f70a44a32e8c7474cbb7db497.png)

---

<div class="post-metadata">

**Author:** ![Kralle](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@Kralle](https://discourse.nodered.org/u/Kralle)\
**Post date:** [14 May 2024 09:28 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/4 "2024-05-14T09:28:23Z")

</div>

Yes, exactly, but I still need a function that then sends an email

 ![Screenshot 2024-05-14 112436](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/273e237f8c7e8739429c943fa604bdef33182583.png)

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [14 May 2024 10:00 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/5 "2024-05-14T10:00:05Z")

</div>

If you look at the help for the mail node you can see what information you need to send to it.

" Sends the `msg.payload` as an email, with a subject of `msg.topic` "

After your switch node, insert a change node and use it to set these properties as required, and then pass to the mail node.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [14 May 2024 10:14 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/6 "2024-05-14T10:14:07Z")

</div>

You might find it handy to include a delay node set to limit the rate of email generation.

---

<div class="post-metadata">

**Author:** ![Kralle](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@Kralle](https://discourse.nodered.org/u/Kralle)\
**Post date:** [14 May 2024 10:22 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/7 "2024-05-14T10:22:37Z")

</div>

Why?? It should only send an email if, for example, TempC1=\> 1° Celsius.  
What then are the properties of the change node?

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [14 May 2024 10:29 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/8 "2024-05-14T10:29:46Z")

</div>

The switch node determines the path of the message, the change node can add properties required for the email node e.g. -

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c7b67f373d4de0024d33f321cf15e2d9d5f906b3.png)

---

<div class="post-metadata">

**Author:** ![Kralle](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@Kralle](https://discourse.nodered.org/u/Kralle)\
**Post date:** [14 May 2024 10:30 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/9 "2024-05-14T10:30:55Z")

</div>

I have already tested this with an inject node. Works well. But I can't implement it in my flow.

 ![Screenshot 2024-05-14 SMS-Mail](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/8/58f7e985888f3fe257159af127cb5ad0ba3b1cb1.png)

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [14 May 2024 10:34 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/10 "2024-05-14T10:34:35Z")

</div>

This is not the telling us anything about your flow.

I was referring to the image you posted previously.

Setup the switch node as per @jbudd suggestion and then add a change node after, per my suggestion.

---

<div class="post-metadata">

**Author:** ![Kralle](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@Kralle](https://discourse.nodered.org/u/Kralle)\
**Post date:** [14 May 2024 10:38 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/11 "2024-05-14T10:38:51Z")

</div>

Ah now I understand. I set the switch node msg.payload.TempC1 to \>= for example 24° Celsius.  
At 24° the rule comes from the change node and then the email node

---

<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:** [14 May 2024 14:38 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/12 "2024-05-14T14:38:08Z")

</div>

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:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 May 2024 14:38 UTC](https://discourse.nodered.org/t/notification-at-specific-temperature/87938/13 "2024-05-28T14:38:22Z")

</div>

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