# Calculate number of hours with temperature higher then?

**URL:** <https://discourse.nodered.org/t/calculate-number-of-hours-with-temperature-higher-then/55873>\
**Category:** General\
**Created:** [30 December 2021 06:49 UTC](https://discourse.nodered.org/t/calculate-number-of-hours-with-temperature-higher-then/55873 "2021-12-30T06:49:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dohnalradek](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@dohnalradek](https://discourse.nodered.org/u/dohnalradek)\
**Post date:** [30 December 2021 06:49 UTC](https://discourse.nodered.org/t/calculate-number-of-hours-with-temperature-higher-then/55873/1 "2021-12-30T06:49:24Z")

</div>

Hi.

I need to calculate number of hours with average temperatue higher then 7°C.  
I can calculate avwrage temperature per hour (by using calculate node)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/facaf4c758754473b1e2209b123e92fe64fea02d.png)

But I dont know what next?  
This node push one number every hour and when it push this number I need to compare it with number 7. If it is higher then 7, it will increase some auxiliary number by 1. That is my idea how it should work, but I dont know how to realize this.

Thanks for help or advice!

---

<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:** [30 December 2021 08:44 UTC](https://discourse.nodered.org/t/calculate-number-of-hours-with-temperature-higher-then/55873/2 "2021-12-30T08:44:31Z")

</div>

Hi.  
Off the top of my head - add a second "calculate node" but only pass messages to it when temperature is \> 7 (use a `switch` node to achieve this).

---

<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 February 2022 08:44 UTC](https://discourse.nodered.org/t/calculate-number-of-hours-with-temperature-higher-then/55873/3 "2022-02-28T08:44:42Z")

</div>

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