# Help with flow workings

**URL:** <https://discourse.nodered.org/t/help-with-flow-workings/42309>\
**Category:** General\
**Created:** [9 March 2021 06:56 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309 "2021-03-09T06:56:58Z")\
**Posts on this page:** 7\
**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:** [9 March 2021 06:56 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309/1 "2021-03-09T06:56:58Z")

</div>

Sorry folks, but this is today's problem:  
(I have to ask or I won't work it out myself.)

For the sake of simplicity I'll use these two IP addresses.  
1 - 101.191.12.63  
2 - 1.129.19.42

1 - This is a land line. _DSL_ - if you will.  
2 - Is the _fall back_ 4G link.

If the `payload` is (or more so starts with) a `1.` I need to change it.  
But it isn't that simple.

Here's what the scheme is:

(Given this is previously set at this point in time)  
Ping my public IP address.  
If it pings, all good.  
If it doesn't ping:  
Try to get public IP address.  
Once got, set that as the ping address. This isn't a _real_ IP address.  
Then, that IP address will go down.  
Once that goes down, repeat.

It doesn't seem to work as I have it now... Too complicated to post here.  
It is over many flows and so on.  
Yes, probably part of the problem.

I'm not exactly sure how the hand back works.

So when the DSL goes down, that IP address is pinged over and over. As it fails it sends a _DOWN_ signal to code which asks for an updated IP address.  
Once that is received, that address is pinged.

As it is a 4G address, once the DSL comes back up, the modem switched back and the process should _repeat_ as it did when the DSL went down.

But it doesn't seem to work.

Can anyone make sense of what I have just said?  
I'll try to get a better handle on what is happening myself.

Thanks in advance.

---

<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:** [9 March 2021 07:30 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309/2 "2021-03-09T07:30:17Z")

</div>

What is the end purpose of this?

---

<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:** [9 March 2021 07:31 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309/3 "2021-03-09T07:31:31Z")

</div>

(Sorry)  
It is to detect if the DSL link/line is up/down.

---

<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:** [9 March 2021 08:10 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309/4 "2021-03-09T08:10:29Z")

</div>

Ok, progress has been made!

I can't ping my 4G IP address.

So I need a way to change the payload if the IP address is `1.x` to something else.

I guess that isn't rocket science.

But I guess the question (now) is I can't use a `switch` node and have it to do:  
`if msg.payload STARTS-WITH`........

The put the `1.` and send that to set the payload to something else.

But then, there is the problem of detecting the DSL IP address coming back online.

# Update:

Alas it isn't that easy.

I can't ping that `1.x` IP address. So it is a whole different problem now.

☹

---

<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:** [9 March 2021 08:28 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309/5 "2021-03-09T08:28:22Z")

</div>

You don't need to ping the 4G address to know if the DSL is up. Just ping the DSL address and that tells 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:** [9 March 2021 08:43 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309/6 "2021-03-09T08:43:04Z")

</div>

Yes, I got that.

But the logic (which I have only now got working) is this:

Get `public_IP`  
Ping it.  
If it can't be pinged, (delay) get `public_IP` (Loop back to line 1)  
Set context of the IP.  
Ping the IP. (Loop back to line 2)

What was _killing me_ was I had a `RBE` in there.

Took out the `RBE` and it now works.

Sorry.

To further elaborate:  
When the `can't be pinged` happens, indicate 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:** [23 March 2021 08:43 UTC](https://discourse.nodered.org/t/help-with-flow-workings/42309/7 "2021-03-23T08:43:47Z")

</div>

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