Trigger node not responding as expected (Flashing vLED)

I have been trying for hours to write script to dynamically vary the flash rate of a silly vLED on the desktop... always worked for the first flash, then nada. Skipping that for now...

Then I discovered the Trigger node... should do the trick very nicely.

send it msg.reset it resets
send it msg.delay (with payload as the delay settings it will use) it changes it's frequency

But it doesn't respond the way the directions say it should. It simply keeps on with the preset settings (in this case 250ms)

What am I missing??

image

[{"id":"af1708dc.4e6ce8","type":"tab","label":"Flasher","disabled":false,"info":""},{"id":"1cd530d8.0510bf","type":"ui_led","z":"af1708dc.4e6ce8","order":2,"group":"85815d64.6c718","width":"2","height":"2","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#0000ff","value":"true","valueType":"bool"},{"color":"#000000","value":"false","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":610,"y":300,"wires":[]},{"id":"efde91d9.e81c1","type":"toggle","z":"af1708dc.4e6ce8","name":"","onOffTopic":"","onValue":"true","onType":"bool","offValue":"false","offType":"bool","toggleTopic":"","toggleValue":"togglenow","toggleType":"str","passOnOff":"ifChanged","x":470,"y":300,"wires":[["1cd530d8.0510bf"]]},{"id":"95c7325.18127d","type":"ui_slider","z":"af1708dc.4e6ce8","name":"Frequency","label":"slider","tooltip":"","group":"85815d64.6c718","order":0,"width":0,"height":0,"passthru":true,"outs":"end","topic":"delay","topicType":"msg","min":"32","max":"2000","step":1,"x":150,"y":320,"wires":[["c6b10cae.c126a","40d1b12f.76016"]]},{"id":"40d1b12f.76016","type":"debug","z":"af1708dc.4e6ce8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":330,"y":360,"wires":[]},{"id":"c6b10cae.c126a","type":"trigger","z":"af1708dc.4e6ce8","name":"Trigger","op1":"togglenow","op2":"false","op1type":"str","op2type":"bool","duration":"-500","extend":false,"overrideDelay":true,"units":"ms","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":320,"y":300,"wires":[["efde91d9.e81c1"]]},{"id":"bafe11a7.88056","type":"ui_button","z":"af1708dc.4e6ce8","name":"","group":"85815d64.6c718","order":2,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"reset","topicType":"msg","x":150,"y":280,"wires":[["c6b10cae.c126a"]]},{"id":"85815d64.6c718","type":"ui_group","name":"","tab":"bb7236c.d277cc8","order":2,"disp":true,"width":"6","collapse":false},{"id":"bb7236c.d277cc8","type":"ui_tab","name":"Flashing LED","icon":"dashboard","disabled":false,"hidden":false}]

image

OK... reset works IF you include the text "reset"... this is NOT what the docs say :stuck_out_tongue:
image

Well.. I guess it does include that option :blush:

image

The help states...

delay

Sets the delay, in milliseconds, to be applied to the message. This option only applies if the node is configured to allow the message to override the configured default delay interval.

reset

If a message is received with this property, any timeout or repeat currently in progress will be cleared and no message triggered.

The important parts being "message" "with this property"

as in msg.reset and msg.delay


So, for the dynamic delay, add a change node after slider, set msg.delay to msg.payload

For the reset, add a change node after the button and set msg.reset to boolean true

1 Like

This is what I was reading :blush:

image

I will try that now...

OK... that worked, thanks :smiley:

But it is strange that just setting the slider node to msg.payload didn't?? (which I believe I had tried...)

My (now) working flow...

image

[{"id":"af1708dc.4e6ce8","type":"tab","label":"Flasher","disabled":false,"info":""},{"id":"1cd530d8.0510bf","type":"ui_led","z":"af1708dc.4e6ce8","order":2,"group":"85815d64.6c718","width":"2","height":"2","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#0000ff","value":"true","valueType":"bool"},{"color":"#000000","value":"false","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":570,"y":320,"wires":[]},{"id":"efde91d9.e81c1","type":"toggle","z":"af1708dc.4e6ce8","name":"","onOffTopic":"","onValue":"true","onType":"bool","offValue":"false","offType":"bool","toggleTopic":"","toggleValue":"togglenow","toggleType":"str","passOnOff":"ifChanged","x":570,"y":260,"wires":[["1cd530d8.0510bf"]]},{"id":"95c7325.18127d","type":"ui_slider","z":"af1708dc.4e6ce8","name":"Frequency","label":"slider","tooltip":"","group":"85815d64.6c718","order":0,"width":0,"height":0,"passthru":false,"outs":"end","topic":"delay","topicType":"msg","min":"32","max":"2000","step":1,"x":150,"y":320,"wires":[["97729620.9d6d08"]]},{"id":"c6b10cae.c126a","type":"trigger","z":"af1708dc.4e6ce8","name":"Trigger","op1":"togglenow","op2":"false","op1type":"str","op2type":"bool","duration":"-250","extend":false,"overrideDelay":true,"units":"ms","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":360,"y":260,"wires":[["efde91d9.e81c1"]]},{"id":"bafe11a7.88056","type":"ui_button","z":"af1708dc.4e6ce8","name":"","group":"85815d64.6c718","order":2,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"reset","payloadType":"str","topic":"reset","topicType":"msg","x":150,"y":280,"wires":[["c6b10cae.c126a"]]},{"id":"97729620.9d6d08","type":"change","z":"af1708dc.4e6ce8","name":"Magic beans ;)","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":320,"wires":[["c6b10cae.c126a"]]},{"id":"85815d64.6c718","type":"ui_group","name":"","tab":"bb7236c.d277cc8","order":2,"disp":true,"width":"6","collapse":false},{"id":"bb7236c.d277cc8","type":"ui_tab","name":"Flashing LED","icon":"dashboard","disabled":false,"hidden":false}]

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