# Simple project, but no reset

**URL:** <https://discourse.nodered.org/t/simple-project-but-no-reset/8465>\
**Category:** General\
**Created:** [28 February 2019 11:35 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465 "2019-02-28T11:35:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nodepi](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nodepi](https://discourse.nodered.org/u/nodepi)\
**Post date:** [28 February 2019 11:35 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/1 "2019-02-28T11:35:03Z")

</div>

Hi, my farming neighbour requested a simple flood irrigation alarm to wake him at night so he can go redirect the water, no problem I thought. But I am having major trouble testing and resetting it with the dash interface. A manual inject on the flow editor works but doing the same through the dash buttons does not work. No doubt I am making a simple mistake, and obvious to a different set of eyes

watering%20alarm%20flow|690x348

```auto
[{"id":"fffd6f7e.5a893","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"4e4fa748.e09d28","type":"rpi-gpio out","z":"fffd6f7e.5a893","name":"Pin 12 Beacon light","pin":"12","set":true,"level":"0","freq":"","out":"out","x":970,"y":300,"wires":[]},{"id":"f6f50f25.47a3e","type":"exec","z":"fffd6f7e.5a893","command":"sudo shutdown -h now","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":700,"y":500,"wires":[[],[],[]]},{"id":"9788342c.ba0498","type":"ui_button","z":"fffd6f7e.5a893","name":"","group":"ab66c250.7caa","order":0,"width":0,"height":0,"passthru":false,"label":"Pi off","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":370,"y":500,"wires":[["f6f50f25.47a3e"]]},{"id":"93a49dd0.9c327","type":"ui_toast","z":"fffd6f7e.5a893","position":"top right","displayTime":"0.5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"Water Alarm","name":"Water alarm activated","x":940,"y":180,"wires":[]},{"id":"a10e7066.149b3","type":"rpi-gpio in","z":"fffd6f7e.5a893","name":"","pin":"40","intype":"tri","debounce":"25","read":true,"x":150,"y":120,"wires":[["a01dde07.324c5"]]},{"id":"cf790043.5a58d","type":"inject","z":"fffd6f7e.5a893","name":"2 second flash","topic":"repeat","payload":"true","payloadType":"bool","repeat":"3","crontab":"","once":true,"onceDelay":0.1,"x":160,"y":280,"wires":[["163ee65c.b4254a"]]},{"id":"163ee65c.b4254a","type":"and-gate","z":"fffd6f7e.5a893","name":"","rules":[{"t":"true","propertyType":"msg","property":"payload","topic":""},{"t":"true","propertyType":"msg","property":"payload","topic":"repeat"}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":true,"x":500,"y":260,"wires":[["c4981d8c.3edb1","62e54756.6e29b8"]]},{"id":"26844e68.65ea62","type":"inject","z":"fffd6f7e.5a893","name":"true","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":60,"wires":[["a01dde07.324c5"]]},{"id":"a01dde07.324c5","type":"change","z":"fffd6f7e.5a893","name":"binary to boolean","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":120,"wires":[["76f3b9e8.588638"]]},{"id":"c4981d8c.3edb1","type":"change","z":"fffd6f7e.5a893","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"Water level detected","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":240,"wires":[["f2bd01f.6a92d","93a49dd0.9c327"]]},{"id":"f2bd01f.6a92d","type":"ui_audio","z":"fffd6f7e.5a893","name":"","group":"ab66c250.7caa","voice":"en-GB","always":true,"x":1000,"y":240,"wires":[]},{"id":"e41e7d3c.a6724","type":"ui_button","z":"fffd6f7e.5a893","name":"","group":"ab66c250.7caa","order":0,"width":0,"height":0,"passthru":true,"label":"Reset Alarm","tooltip":"","color":"red","bgcolor":"","icon":"","payload":"false","payloadType":"bool","topic":"","x":170,"y":360,"wires":[["163ee65c.b4254a","598ce2c9.af328c"]]},{"id":"62e54756.6e29b8","type":"change","z":"fffd6f7e.5a893","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":300,"wires":[["4e4fa748.e09d28"]]},{"id":"21d4f9f1.9846c6","type":"inject","z":"fffd6f7e.5a893","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":420,"wires":[["163ee65c.b4254a","598ce2c9.af328c"]]},{"id":"76f3b9e8.588638","type":"ui_button","z":"fffd6f7e.5a893","name":"","group":"ab66c250.7caa","order":0,"width":0,"height":0,"passthru":true,"label":"Test alarm","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":150,"y":220,"wires":[["163ee65c.b4254a"]]},{"id":"598ce2c9.af328c","type":"debug","z":"fffd6f7e.5a893","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":550,"y":380,"wires":[]},{"id":"ab66c250.7caa","type":"ui_group","z":"","name":"Water alarm","tab":"2e2e199b.c2d2d6","disp":true,"width":"6","collapse":true},{"id":"2e2e199b.c2d2d6","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

```

---

<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:** [28 February 2019 13:47 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/2 "2019-02-28T13:47:48Z")

</div>

I am not able to look at your flow, but if it works with an inject but not with a dashboard button then, assuming the two methods are going to the same nodes, there must be a difference in the message sent by the inject and by the button. Put a debug node showing what each is sending and compare them.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [1 March 2019 04:57 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/3 "2019-03-01T04:57:26Z")

</div>

In your flow you are using a non-default node, the and-gate. Pls specifiy full name so we can add it to our palettes

---

<div class="post-metadata">

**Author:** ![nodepi](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nodepi](https://discourse.nodered.org/u/nodepi)\
**Post date:** [2 March 2019 08:55 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/4 "2019-03-02T08:55:51Z")

</div>

[krambriw] npm install node-red-contrib-bool-gate,

Were you able to copy my flow or should I try to paste again? Is there a 'proper way' to post your flow on this forum?

---

<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:** [2 March 2019 09:30 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/5 "2019-03-02T09:30:33Z")

</div>

Sorry, I didn't mean that your flow was not importable, but I was on my phone.  
What were the results of comparing the value you were injecting against the value sent by the dashboard button?

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [2 March 2019 09:32 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/6 "2019-03-02T09:32:40Z")

</div>

If you add a change node after "Test alarm" and "Reset alarm" with the msg.topic set to an empty string, it will work. The reason for this is that the ui nodes does not add a topic to the msg themselves. The "topic" requirement is also stated in the info for the gate node.

> _topic(mandatory) string_  
> _the topic of the message. This is mandatory because of the node configuration_

In addition, you might be considering to switch off the beacon light as well when initiating reset. It seems the light will never be turned off

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

---

<div class="post-metadata">

**Author:** ![nodepi](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nodepi](https://discourse.nodered.org/u/nodepi)\
**Post date:** [3 March 2019 10:50 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/7 "2019-03-03T10:50:52Z")

</div>

Thank you so much krambriw, Really appreciate your help.

I doubt I would have found that any time soon, I was just focusing on msg output not topic.  
Completely missed that in the info window, won't be making that mistake again!  
And yes, reset now linked to the beacon light.

---

<div class="post-metadata">

**Author:** ![nodepi](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nodepi](https://discourse.nodered.org/u/nodepi)\
**Post date:** [3 March 2019 10:54 UTC](https://discourse.nodered.org/t/simple-project-but-no-reset/8465/8 "2019-03-03T10:54:13Z")

</div>

Thanks for your help Colin, turns out the topic was the problem not the payload as krambriw pointed out
