# Action to be triggered when the power consumption is decreasing?

**URL:** <https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [11 January 2023 19:33 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557 "2023-01-11T19:33:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![BernardS](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BernardS](https://discourse.nodered.org/u/BernardS)\
**Post date:** [11 January 2023 19:33 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/1 "2023-01-11T19:33:21Z")

</div>

Hello Fellow Node Red users,

I got a 3D Printer for Xmas, all works fine. I would like to get a notification when the printing is done.  
For sure, the straight way with Octoprint and the Home assistant it's easy, did a testing with Octo4a works great, but at this moment I don't have any device which could permanentlly run Octoprint and don't want to invest.

What I have, is a Shelly 1PM which is concted to the printer, so I can see the consumption.

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

I would like to get an action triggered, when the power consumption drops.  
I found some examples used for the Washingmachine, but all of them are considering as start of the power monitoring the start of the Shelly/Smart plug. I don't want to start the Shelly, the Shelly is doing only powermonitoring, it's allways on.

I have tried to use an RBE node, but because the power is fluctuating, not just increasing, it's not working.

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

Do you have any other sugestion?

Thanks,

---

<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:** [11 January 2023 19:47 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/2 "2023-01-11T19:47:38Z")

</div>

A filter node can be set to "block unless value change is greater than" a set amount, which seems like it should work.

Otherwise a switch node can only pass messages when the payload is below a certain level.

You might need a second filter node to block repeated messages.

---

<div class="post-metadata">

**Author:** ![BernardS](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BernardS](https://discourse.nodered.org/u/BernardS)\
**Post date:** [11 January 2023 20:12 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/3 "2023-01-11T20:12:05Z")

</div>

Thanks Jbudd, but how to avoid messages when the Printer is idle? The consumption will be bellow the set value, and I will get by each polling the action triggered.

---

<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:** [11 January 2023 20:23 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/4 "2023-01-11T20:23:22Z")

</div>

Like this?

> [@jbudd](#):
>
> You might need a second filter node to block repeated messages.

---

<div class="post-metadata">

**Author:** ![BernardS](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BernardS](https://discourse.nodered.org/u/BernardS)\
**Post date:** [11 January 2023 21:08 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/5 "2023-01-11T21:08:49Z")

</div>

So, finally I have found what I needed, straight out of the box.

[node-red-contrib-edge-trigger](https://flows.nodered.org/node/node-red-contrib-edge-trigger)

The Failing edge Node is doing exactlly what I need. Thanks J budd for supporting.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/90dab937d6ca556783bfc290645c804f982cda59.png)

---

<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:** [12 January 2023 09:39 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/6 "2023-01-12T09:39:20Z")

</div>

My preference in this case would be to use core nodes rather than a contrib node. With contrib nodes you can be sure it will keep working into the future, with contrib nodes you do not know whether it will continue to be maintained.

---

<div class="post-metadata">

**Author:** ![BernardS](https://avatars.discourse-cdn.com/v4/letter/b/edb3f5/32.png) [@BernardS](https://discourse.nodered.org/u/BernardS)\
**Post date:** [21 January 2023 08:01 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/7 "2023-01-21T08:01:49Z")

</div>

Colin, you are right, but I have no ideea how to create this manually with standard nodes. And writing a function, is to far from my knowledge. Thanks,

---

<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:** [21 January 2023 08:32 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/8 "2023-01-21T08:32:42Z")

</div>

> [@BernardS](#):
>
> but I have no ideea how to create this manually with standard nodes

Yes you do, @jbudd suggested how to do it earlier. A switch node and a filter node. Did you try that method? If it didn't work show us what you tried and what the problem was.

---

<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:** [21 January 2023 08:41 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/9 "2023-01-21T08:41:32Z")

</div>

Our maybe a switch followed by a trigger.

---

<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:** [22 March 2023 08:42 UTC](https://discourse.nodered.org/t/action-to-be-triggered-when-the-power-consumption-is-decreasing/73557/10 "2023-03-22T08:42:26Z")

</div>

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