# How to tackle this one

**URL:** <https://discourse.nodered.org/t/how-to-tackle-this-one/48031>\
**Category:** General\
**Created:** [5 July 2021 05:37 UTC](https://discourse.nodered.org/t/how-to-tackle-this-one/48031 "2021-07-05T05:37:34Z")\
**Posts on this page:** 5\
**Page:** 2

<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:** [5 July 2021 07:39 UTC](https://discourse.nodered.org/t/how-to-tackle-this-one/48031/21 "2021-07-05T07:39:28Z")

</div>

This is a slightly better layout for simplicity

```auto
[{"id":"19c34f22.1b1c29","type":"inject","z":"fc6fbf47.86d3e8","name":"Reset","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":100,"y":70,"wires":[["37176db4.a7f91a"]]},{"id":"37176db4.a7f91a","type":"trigger","z":"fc6fbf47.86d3e8","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-4","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":320,"y":120,"wires":[["a432b8a8.5d82f8","3d921823.47e428"]]},{"id":"b4da3c74.87be","type":"inject","z":"fc6fbf47.86d3e8","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":120,"wires":[["37176db4.a7f91a"]]},{"id":"ee8f2dd5.12e408","type":"debug","z":"fc6fbf47.86d3e8","name":"Toggle","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":620,"y":60,"wires":[]},{"id":"a432b8a8.5d82f8","type":"function","z":"fc6fbf47.86d3e8","name":"","func":"var x = context.get(\"toggle\") || 0;\n\nx = x + 1;\ncontext.set(\"toggle\",x);\n\nx = x%2;\n\nmsg.payload = x;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":120,"wires":[["ee8f2dd5.12e408","ee454ba6.42219"]]},{"id":"ee454ba6.42219","type":"change","z":"fc6fbf47.86d3e8","name":"From sensor","rules":[{"t":"set","p":"state","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":120,"wires":[[]]},{"id":"35f098ff.4fb488","type":"inject","z":"fc6fbf47.86d3e8","name":"ON","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":110,"y":320,"wires":[["b28cf4b.2c00488","fed734ce.1e307"]]},{"id":"f5718044.5024b8","type":"inject","z":"fc6fbf47.86d3e8","name":"STANDBY","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"SB","payloadType":"str","x":130,"y":370,"wires":[["b28cf4b.2c00488"]]},{"id":"6c2170b7.e9e3b8","type":"comment","z":"fc6fbf47.86d3e8","name":"Standby output simulation","info":"","x":390,"y":80,"wires":[]},{"id":"3d921823.47e428","type":"link out","z":"fc6fbf47.86d3e8","name":"CLOCK","links":["b9d287f.affa178","985ea4bd.4fa2c"],"x":315,"y":170,"wires":[]},{"id":"b9d287f.affa178","type":"link in","z":"fc6fbf47.86d3e8","name":"CLOCK","links":["3d921823.47e428"],"x":395,"y":450,"wires":[["e13828e9.c4d01"]]},{"id":"e13828e9.c4d01","type":"change","z":"fc6fbf47.86d3e8","name":"get flow.mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"mode","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":450,"wires":[["3c8ab0e3.681ca","cc0ca5de.84be78"]]},{"id":"b28cf4b.2c00488","type":"change","z":"fc6fbf47.86d3e8","name":"set flow.mode","rules":[{"t":"set","p":"mode","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":370,"wires":[[]]},{"id":"3c8ab0e3.681ca","type":"switch","z":"fc6fbf47.86d3e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"SB","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":660,"y":450,"wires":[["bd7a1ca4.678a8"],["8cd6ae25.5b20c"]]},{"id":"fed734ce.1e307","type":"change","z":"fc6fbf47.86d3e8","name":"SET ON","rules":[{"t":"set","p":"state","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":320,"wires":[[]]},{"id":"cc0ca5de.84be78","type":"debug","z":"fc6fbf47.86d3e8","name":"MODE","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":510,"y":500,"wires":[]},{"id":"bd7a1ca4.678a8","type":"delay","z":"fc6fbf47.86d3e8","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":820,"y":390,"wires":[["7064a5d7.dd19b4"]]},{"id":"f745622e.2022d","type":"change","z":"fc6fbf47.86d3e8","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":500,"wires":[["bd7a1ca4.678a8"]]},{"id":"8cd6ae25.5b20c","type":"switch","z":"fc6fbf47.86d3e8","name":"SB?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"SB","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":500,"wires":[["f745622e.2022d","2cbf2225.cba0b6"]]},{"id":"a110a4c1.746968","type":"debug","z":"fc6fbf47.86d3e8","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1150,"y":450,"wires":[]},{"id":"2cbf2225.cba0b6","type":"change","z":"fc6fbf47.86d3e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"SB","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":540,"wires":[["7064a5d7.dd19b4"]]},{"id":"7064a5d7.dd19b4","type":"rbe","z":"fc6fbf47.86d3e8","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":1000,"y":450,"wires":[["a110a4c1.746968"]]},{"id":"333d8883.05e518","type":"comment","z":"fc6fbf47.86d3e8","name":"Mode selecter (by device)","info":"","x":250,"y":270,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [5 July 2021 07:42 UTC](https://discourse.nodered.org/t/how-to-tackle-this-one/48031/22 "2021-07-05T07:42:37Z")

</div>

Wow i am going to have to sit down and go through this and see what you have done - thanks for all the effort.!!

Craig

---

<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:** [5 July 2021 07:43 UTC](https://discourse.nodered.org/t/how-to-tackle-this-one/48031/23 "2021-07-05T07:43:14Z")

</div>

no problems.

Good luck.

Most of the nodes are to set up the scenario.

Only the bottom part is the bit that does what you want.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [12 July 2021 20:27 UTC](https://discourse.nodered.org/t/how-to-tackle-this-one/48031/24 "2021-07-12T20:27:06Z")

</div>

The one for the problem i put up about the Heatpump and sensing what state it was in ??

Yep worked my way through it and understood it - was quite nice work thanks.

It was a bit of overkill for what i needed (and hence has extra complexity) in the end the one i put up with the trigger node worked - just had to reverse the states on it - so ended up being 3 nodes - here it is

```auto
[{"id":"1629a54e.99ed5b","type":"change","z":"9ca52a8a.d12d48","name":"Check for Standby Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data.dps[\"115\"]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":360,"wires":[["654c0af3.188134"]]},{"id":"e7144c41.5704","type":"ui_text","z":"9ca52a8a.d12d48","group":"624acab0.30b154","order":3,"width":"3","height":"1","name":"","label":"Operating mode","format":"{{msg.payload}}","layout":"col-center","x":1120,"y":440,"wires":[]},{"id":"6981e1a9.1c385","type":"trigger","z":"9ca52a8a.d12d48","name":"Send Running Status of HeatPump","op1":"Standby","op2":"Running","op1type":"str","op2type":"str","duration":"15","extend":true,"units":"s","reset":"4","bytopic":"all","topic":"topic","outputs":1,"x":880,"y":500,"wires":[["e7144c41.5704","ce829411.bb15f8"]]},{"id":"654c0af3.188134","type":"rbe","z":"9ca52a8a.d12d48","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":790,"y":420,"wires":[["6981e1a9.1c385"]]},{"id":"ce829411.bb15f8","type":"change","z":"9ca52a8a.d12d48","name":"Set Global Variable for HP State","rules":[{"t":"set","p":"HeatPump.Status","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1220,"y":520,"wires":[[]]},{"id":"624acab0.30b154","type":"ui_group","z":"","name":"Heat Pump Reporting","tab":"720f2dcc.ee59b4","order":5,"disp":true,"width":"18","collapse":true},{"id":"720f2dcc.ee59b4","type":"ui_tab","z":"","name":"Heating Controls","icon":"dashboard","order":7,"disabled":false,"hidden":false}]

```

Craig

---

<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:** [26 July 2021 20:27 UTC](https://discourse.nodered.org/t/how-to-tackle-this-one/48031/25 "2021-07-26T20:27:38Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/how-to-tackle-this-one/48031.md?page=1)
