# Calculate how long a relay is activated

**URL:** https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532
**Category:** General
**Tags:** function-node
**Created:** [19 May 2023 07:43 UTC](https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532 "2023-05-19T07:43:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Alabou](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@Alabou](https://discourse.nodered.org/u/Alabou)
#### Post date: [19 May 2023 07:43 UTC](https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532/1 "2023-05-19T07:43:52Z")

</div>

You could help me with this I try to know how long a contact was activated and in case it reaches two hours a day reset time and not activated until the next day some help like doing thank you

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [19 May 2023 07:57 UTC](https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532/2 "2023-05-19T07:57:35Z")

</div>

Please explain the context of the problem you are running into (and don't try to put everything in the subject).  
We don't know what you mean with "contact" and "activated" etc.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [19 May 2023 07:59 UTC](https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532/3 "2023-05-19T07:59:10Z")

</div>

@Alabou - Title changed to something more suitable

---

<div class="post-metadata">

### Author: ![Alabou](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@Alabou](https://discourse.nodered.org/u/Alabou)
#### Post date: [19 May 2023 10:18 UTC](https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532/4 "2023-05-19T10:18:08Z")

</div>

Calculate how long a relay is activated during the day, if it is activated more than two hours a day, we send a condition to the flow so that it is not activated until the next day

---

<div class="post-metadata">

### Author: ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)
#### Post date: [19 May 2023 13:23 UTC](https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532/5 "2023-05-19T13:23:19Z")

</div>

So, you want to calculate cumulative time the relay is on activated position, and need not be continuously activated and reset after a day and start over again ?

---

<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: [18 July 2023 13:23 UTC](https://discourse.nodered.org/t/calculate-how-long-a-relay-is-activated/78532/6 "2023-07-18T13:23:40Z")

</div>

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