# From WHERE is this message coming?

**URL:** https://discourse.nodered.org/t/from-where-is-this-message-coming/95983
**Category:** General
**Created:** [13 March 2025 22:01 UTC](https://discourse.nodered.org/t/from-where-is-this-message-coming/95983 "2025-03-13T22:01:35Z")
**Posts on this page:** 4
**Page:** 1

<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: [13 March 2025 22:01 UTC](https://discourse.nodered.org/t/from-where-is-this-message-coming/95983/1 "2025-03-13T22:01:35Z")

</div>

# **Yes, this is complicated!**

And so I've put the nodes on their own separate flow to see all and nothing else.

 ![Screenshot from 2025-03-14 08-38-34](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/3/b31f9ba9cb3e86d289e3307ebc603f318da1effb.png)

## Walk through:

there are 2 subflows in this scenario.

The small red one and the obvious one `device status`.

The idea is to indicate the status of a RasPi.  
(And it isn't that simple - of course)

I used to use a `ping` to _ping_ all my devices but for reasons of _keeping it simple_ I went to using the `nmap` command.

Each have their pros and cons.

Thus the first small red subflow.

If a device is not detected this sends 3 x `offline` messages to..... clear down the device's status to OFF LINE.

## Why? I'll get to that.

The next part is the bigger subflow.

That looks at what's going on and _indicates_ to me what's going on.

IDEALLY, all is good and things are shown as OK/GOOD.

_green_ (Well, ok: lime) is for good.  
If a flow error happens, it turns to RED and the icon changes.  
If it has just booted the colour changes as well and the icon.  
(There are other things, but for the sake of simplicity, I'll leave the others out.)

If either of the above conditions happen the indicator has to LOCK itself showing that and I have to press a button to acknowledge it.

Then - all things being good - it returns to _green_.

**So?**

Well, SOMEHOW it is getting stuck/locked in an `ERROR RECEIVED` state.

# Yet!

There are no messages received.  
As you can see by the picture.

You can see the `into node` `debug` and it is set to display the entire message.

Nothing shown.

Yet, it goes from `RESET` to that and there is/was no message displayed.

Now, before you go off at me, here's the code from that node showing the mechanics of how it gets to this/that condition:

(rather simple)  
And there are a lot of lines above it, but they are more setting things up.  
No real .... _code_ in them.

```auto

// ERROR message received.
if (msg.payload == "ERROR") {
    //
    // Need to set return message to indicate error
    // 2025 02 05 mes2{} needs to be sent also?
    //
    context.set("LOCK", 1)
    msg1 = { "topic": "alert", "payload": '<font color = "red" i class="fa fa-exclamation-circle fa-2x"></i></font>' }
    node.status({ fill: "red", shape: "dot", text: "ERROR RECEIVED" })
    return msg1
} 
else

```

Oh, and that is the ONLY place in the code where this happens.  
So it isn't being caused else where.

As you can see, it is a rather basic test.

IF the payload is `ERROR` then it sets things up and says `ERROR RECEIVED`.  
`LOCK` is to indicate it has to specifically wait for a clear signal before echoing any newer messages/states.

To help with things, here are TWO screen shots showing the change.

 ![Screenshot from 2025-03-14 08-54-20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/473f48703aceccd3231fc125ed09534b81309129.png)

This is where I `RESET` things.  
That clears the `LOCK` (context) in the subflow and then waits for new status messages.  
The _complaint_ is from the small red `subflow` just above the `inject` node (which reset things)

You can clearly see the `RESET` message under the `subflow`.

This shows how the message/node changes from reset to error, but there is nothing shown in the `INTO NODE` debug node's output.

 ![Screenshot from 2025-03-14 08-54-54](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/3/f3fc695dd9501e790502f9c0e9a20b5ef832e629.png)

ITMT, the first one starts to _time out_ and send THREE `offline` messages.

This is the guts of that subflow.

Basically just look at the 3 `trigger` nodes.

 ![Screenshot from 2025-03-14 08-57-30](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/f/9f926be43513a7fd9ff6e356285ea300b7e33dc1.png)

So it isn't doing anything special.

# THE QUESTION:

So, _HOW_ is that subflow changing from RESET to ERROR RECEIVED when there is no input message?

---

<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: [13 March 2025 22:08 UTC](https://discourse.nodered.org/t/from-where-is-this-message-coming/95983/2 "2025-03-13T22:08:17Z")

</div>

# I'm an idiot!

(You don't have to agree that quickly.) 😉

Found it.

My fault.

Mia culpa.

Sorry folks.

---

<div class="post-metadata">

### Author: ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)
#### Post date: [14 March 2025 07:38 UTC](https://discourse.nodered.org/t/from-where-is-this-message-coming/95983/3 "2025-03-14T07:38:39Z")

</div>

> [@Trying\_to\_learn](#):
>
> I'm an idiot!

The error (almost always) is 40cm from the screen. That's mostly where I start to debug.

---

<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 March 2025 07:39 UTC](https://discourse.nodered.org/t/from-where-is-this-message-coming/95983/4 "2025-03-28T07:39:33Z")

</div>

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