# How to send "False" when there is no Flow?

**URL:** <https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593>\
**Category:** General\
**Created:** [16 December 2020 20:54 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593 "2020-12-16T20:54:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [16 December 2020 20:54 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/1 "2020-12-16T20:54:40Z")

</div>

Hello,

I would be happy if someone can help me solve my problem.

An "mqtt-in" receives every five seconds the signal strength of my Bluetooth device. If the "MQTT broker" sends "-67", for example, the "switch-node" forwards "is not null" and then to the "change node" which then sends a "TRUE". That works and is fine. 🙂

But if my "Bluetooth Device" is not in the house, the "MQTT Broker" does not send any signal strength, there is no Flow, but the "change node" should send "FALSE"! But he doesn't send anything! ☹

I configured the "switch-node" to "otherwise" but it doesn't work. Can someone tell me how to configure the node so that I get a "False" if the "MQTT broker" does not send any signal strength for the "Bluetooth device"?

thank you and have a nice evening

 ![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/9/c91a46347fa12d915da07599a7dc82c9afeb3eaa.png)

```auto
[{"id":"c54c5caf.992f5","type":"inject","z":"e3fd25d8.62b308","name":"Payload from MQTT","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-67","payloadType":"num","x":390,"y":340,"wires":[["defb83f0.b6d85"]]},{"id":"defb83f0.b6d85","type":"switch","z":"e3fd25d8.62b308","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":360,"wires":[["169a1a1b.44f736"],["d71c683f.240f58"]]},{"id":"169a1a1b.44f736","type":"change","z":"e3fd25d8.62b308","name":"change to TRUE","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":280,"wires":[[]]},{"id":"d71c683f.240f58","type":"change","z":"e3fd25d8.62b308","name":"change to FALSE","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":460,"wires":[[]]}]

```

---

<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:** [16 December 2020 21:14 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/2 "2020-12-16T21:14:58Z")

</div>

Connect a debug node showing what comes out of the MQTT node for the two cases.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [16 December 2020 21:27 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/3 "2020-12-16T21:27:09Z")

</div>

I would probably check if value is true or false with JSONata expression. To send `false` if no message sent use a trigger node as in example below.

```auto
[{"id":"4ceecb5f.1df26c","type":"inject","z":"8d22ae29.7df6d","name":"Payload from MQTT","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"-67","payloadType":"num","x":150,"y":2760,"wires":[["5985cfb8.7d627","a0930bf2.00e26"]]},{"id":"5985cfb8.7d627","type":"trigger","z":"8d22ae29.7df6d","name":"","op1":"","op2":"false","op1type":"nul","op2type":"bool","duration":"10","extend":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":270,"y":2820,"wires":[["a0930bf2.00e26"]]},{"id":"a0930bf2.00e26","type":"change","z":"8d22ae29.7df6d","name":" TRUE or FALSE","rules":[{"t":"set","p":"payload","pt":"msg","to":"$boolean(payload) ","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":2760,"wires":[["849076c.5742d08"]]},{"id":"849076c.5742d08","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":2760,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [16 December 2020 21:39 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/4 "2020-12-16T21:39:45Z")

</div>

> [@Steinspiel](#):
>
> But if my "Bluetooth Device" is not in the house, the "MQTT Broker" does not send any signal strength, there is no Flow

True. Kind of. Flow still exist but there is no events to move any data. And the change node is not meant to understand or do any triggering kind of action.

What you'll need is to listen the input and if there will be silence for some period, fire an event which contains data to indicate that silence period is now longer than it should.

Most easyest way is to use the trigger node

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/96cc6cb00ce6934dcc9ce157e44f47332a4e9582.png)

So in every input the trigger node does nothing and every next action resets the delay but if next input takes too long it fires the "then send" action and with your following flow you can then do what ever needed to be done if your primary flow has no triggering action anymore.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [16 December 2020 22:24 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/5 "2020-12-16T22:24:09Z")

</div>

And don’t forget you can set the broker to automatically send an LWT message if a device disconnects by setting it correctly on connect.

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [17 December 2020 18:23 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/6 "2020-12-17T18:23:19Z")

</div>

> [@Colin](#):
>
> Connect a debug node showing what comes out of the MQTT

I did that. If the special Bluetooth device is not in the house, MQTT of course also sends the MAC address and signal strength of the other Bluetooth devices ...

```auto
{"topic":"ergebnis","payload":{"39:51:fc:ea:bd:0a":-75,"44:b2:45:5a:f4:57":-65,.....}

```

Thanks for your help, but @E1cid and @hotNipi solved my problem very well.

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [17 December 2020 18:24 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/7 "2020-12-17T18:24:36Z")

</div>

> [@E1cid](#):
>
> I would probably check if value is true or false with JSONata expression.

Thank you, your example was perfect! I was able to adjust everything for myself and it works great! 🙂

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [17 December 2020 18:28 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/8 "2020-12-17T18:28:43Z")

</div>

> [@hotNipi](#):
>
> So in every input the trigger node does nothing and every

I didn't know the "trigger node" before! But thanks to you and @ E1cid it works for me too.🙂

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [17 December 2020 18:29 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/9 "2020-12-17T18:29:10Z")

</div>

> [@dceejay](#):
>
> And don’t forget you can set the broker to automatically send an LWT message

LWT would not work because there is still an MQTT connection ...  
But thanks for your hint.

---

<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:** [15 February 2021 18:29 UTC](https://discourse.nodered.org/t/how-to-send-false-when-there-is-no-flow/37593/10 "2021-02-15T18:29:19Z")

</div>

Closed on 15 February 2021 18:29 UTC

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