Which one?
If it is the one from @bart the command is shown:
npm install bartbutenaers/node-red-contrib-button-events#triple_and_double_clicks
Which one?
If it is the one from @bart the command is shown:
npm install bartbutenaers/node-red-contrib-button-events#triple_and_double_clicks
Nope! Bart has already said in his previous post that he has not yet published the recent changes to npm yet, and it can only be installed direct from Bart's repo.
You are unable to install the recent update direct from npm or node-RED's manage palette, which the OP has requested
Oh, sorry... I am way out of the conversation and probably should have not replied.
But I got a notification and read it as I saw it.
Been there, done that
@johntdyer,
I need to finish some parts, together with @tsknightstorm. But she has a very busy personal life at the moment. So I assume somewhere in august, as soon as we both have time.
Bart
Bart has now published a beta release. If someone is happy to help testing, we would appreciate it.
Hello all,
I also looking for a solution to dim my light in CamperVan.
I have connected to a Raspberry Pi with your Sonoff Zigbee dongle and a philips hue button via Zigbee2Mqtt learned.
I would like to control it so that:
1x press = light on 20%
2x press = 40%
3x press = 60%
4x press = 80%
5x press = 100%
Press 1x long = light off
for alternatives I am of course open (for example keep switch pressed etc.)
Finally the whole thing has to be sent via MQTT to a Wemos D2 mini. The dimming is then done via a Mosfet.
Is this feasible and can someone help me here or send a flow that I can adapt.
That shouldn't be too hard to do.
My node would go most of the way to doing what you want.
You may need to declare what the messages need to be though.
If/when I get time I could make a demo version though.
Hello,
thank you for your fast answer.
The system itself already exists.
Currently it works so that everything is controlled via a touchscreen.
I would "only" have to integrate the Zigbee button into the system.
You haven't told me what the messages need to be.
Does the Zigbee
send both an up
and down
message when the button is pressed?
If it doesn't it will be hard to detect a long press.
Here is a NEARLY WORKING example.
[{"id":"4be6db179f2af0b9","type":"subflow","name":"Press count","info":"Used to count button presses and send the number in a message.\nSet the *timeout* value in the `delay` variable.\n\nThen send the output message into a `switch` node to do wonderful things.\n\nThe output message is a `number`.","category":"","in":[{"x":60,"y":330,"wires":[{"id":"a457eafcdad07d0b"}]}],"out":[{"x":820,"y":210,"wires":[{"id":"900cc4787c0480a4","port":0}]}],"env":[{"name":"delay","type":"num","value":"","ui":{"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#D8BFD8","icon":"node-red-dashboard/ui_button.png","status":{"x":820,"y":370,"wires":[{"id":"900476fafffa3ae3","port":0}]}},{"id":"c2137fa8aec03468","type":"inject","z":"4be6db179f2af0b9","name":"Reset","repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":280,"y":290,"wires":[["5188ca7c92884164"]]},{"id":"de02a7b5bf7954d2","type":"trigger","z":"4be6db179f2af0b9","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"0.5","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":300,"y":250,"wires":[["a14dd5822f1f6015","900cc4787c0480a4"]]},{"id":"5188ca7c92884164","type":"change","z":"4be6db179f2af0b9","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"foo","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":250,"wires":[["d5314c210f7d9a76"]]},{"id":"d5314c210f7d9a76","type":"counter","z":"4be6db179f2af0b9","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":460,"y":330,"wires":[["6a5f10e31345b897","bb0e17c295353204"]]},{"id":"6a5f10e31345b897","type":"change","z":"4be6db179f2af0b9","name":"Flow set","rules":[{"t":"set","p":"count","pt":"flow","to":"count","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":280,"wires":[[]]},{"id":"a457eafcdad07d0b","type":"change","z":"4be6db179f2af0b9","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"delay","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":145,"y":330,"wires":[["d5314c210f7d9a76","de02a7b5bf7954d2"]],"l":false},{"id":"a14dd5822f1f6015","type":"change","z":"4be6db179f2af0b9","name":"","rules":[{"t":"delete","p":"delay","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":250,"wires":[["5188ca7c92884164"]],"l":false},{"id":"900cc4787c0480a4","type":"function","z":"4be6db179f2af0b9","name":"","func":"msg.payload = flow.get(\"count\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":210,"wires":[[]]},{"id":"bb0e17c295353204","type":"function","z":"4be6db179f2af0b9","name":"CounterValue","func":"node.status({text: \"Counting \" + msg.count});\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":330,"wires":[[]]},{"id":"900476fafffa3ae3","type":"status","z":"4be6db179f2af0b9","name":"","scope":["bb0e17c295353204"],"x":670,"y":370,"wires":[[]]},{"id":"368441726da6ee2d","type":"switch","z":"61bbf627ae47ef79","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":6,"x":530,"y":370,"wires":[["eb54e503b5d97e8c"],["f181fd63da81183e"],["160f7a1381ce6497"],["4a85fa0b5cdb8740"],["14373e93f065b9ac"],["b7b26884eb6dad18"]]},{"id":"2408dde860e38d1e","type":"subflow:4be6db179f2af0b9","z":"61bbf627ae47ef79","name":"","env":[{"name":"delay","value":"500","type":"num"}],"x":360,"y":370,"wires":[["8c5f32e93ce2032d","368441726da6ee2d"]]},{"id":"eb54e503b5d97e8c","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"20% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":310,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"f181fd63da81183e","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"40% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":350,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"160f7a1381ce6497","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"60% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":390,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"4a85fa0b5cdb8740","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"80% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":430,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"14373e93f065b9ac","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"100% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":470,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"b7b26884eb6dad18","type":"change","z":"61bbf627ae47ef79","name":"Wipe","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":520,"wires":[["23049a79b40fe27a","3fd47f6616a9cca0"]]},{"id":"a8a93eacebc03ec5","type":"inject","z":"61bbf627ae47ef79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":370,"wires":[["2408dde860e38d1e"]]},{"id":"eb74d0ccc1eef85e","type":"switch","z":"61bbf627ae47ef79","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Up","vt":"str"},{"t":"eq","v":"Down","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":420,"wires":[["2408dde860e38d1e","a938402218c16029"],["544b88e0a5acdbc3"]]},{"id":"fce5c98a896cee68","type":"change","z":"61bbf627ae47ef79","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":320,"wires":[["2408dde860e38d1e"]]},{"id":"8c5f32e93ce2032d","type":"debug","z":"61bbf627ae47ef79","name":"debug 54","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":310,"wires":[]},{"id":"3fd47f6616a9cca0","type":"debug","z":"61bbf627ae47ef79","name":"Light brightness","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":940,"y":380,"wires":[]},{"id":"23049a79b40fe27a","type":"ui_text","z":"61bbf627ae47ef79","group":"d646d4608d936642","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","className":"","x":940,"y":470,"wires":[]},{"id":"c6f481318e118641","type":"ui_template","z":"61bbf627ae47ef79","group":"d646d4608d936642","name":"vol -","order":79,"width":1,"height":1,"format":"<div id=\"VolDown\">\n <md-button class=\"md-button TV-HDMI\" aria-label=\"VolDown\">\n <span style=\"color:{{msg.colour}}\" class=\"fa fa-minus remote-icon\"> </span>\n </md-button>\n</div>\n\n<script>\n\n(function($scope) {\n \n$('#VolDown').on('touchstart mousedown', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"topic\":\"VolDown\",\"payload\": \"Down\"});\n});\n\n$('#VolDown').on('touchend mouseup', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"topic\":\"VolDown\",\"payload\": \"Up\"});\n});\n \n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":190,"y":470,"wires":[["248a731374d2e269","eb74d0ccc1eef85e"]]},{"id":"a938402218c16029","type":"change","z":"61bbf627ae47ef79","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":420,"wires":[["544b88e0a5acdbc3"]]},{"id":"544b88e0a5acdbc3","type":"delay","z":"61bbf627ae47ef79","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":540,"y":560,"wires":[["b1457747009dbc0b"]]},{"id":"08eed27cd045d4d0","type":"inject","z":"61bbf627ae47ef79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":320,"wires":[["fce5c98a896cee68"]]},{"id":"b1457747009dbc0b","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":560,"wires":[["23049a79b40fe27a"]]},{"id":"248a731374d2e269","type":"debug","z":"61bbf627ae47ef79","name":"debug 55","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":200,"y":530,"wires":[]},{"id":"d646d4608d936642","type":"ui_group","name":"Group 1","tab":"1f97ed5dea097aaa","order":1,"disp":true,"width":6},{"id":"1f97ed5dea097aaa","type":"ui_tab","name":"Example","icon":"dashboard","order":45,"disabled":false,"hidden":false}]
You just need to work out how to negate the message that turns the light back on to 20% after it is turned off.
FULLY WORKING version.
You have to hold the button for 3
seconds to turn the light OFF
[{"id":"4be6db179f2af0b9","type":"subflow","name":"Press count","info":"Used to count button presses and send the number in a message.\nSet the *timeout* value in the `delay` variable.\n\nThen send the output message into a `switch` node to do wonderful things.\n\nThe output message is a `number`.","category":"","in":[{"x":60,"y":330,"wires":[{"id":"a457eafcdad07d0b"},{"id":"df8cb339f3aed3ba"}]}],"out":[{"x":820,"y":210,"wires":[{"id":"900cc4787c0480a4","port":0}]}],"env":[{"name":"delay","type":"num","value":"","ui":{"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#D8BFD8","icon":"node-red-dashboard/ui_button.png","status":{"x":820,"y":370,"wires":[{"id":"900476fafffa3ae3","port":0}]}},{"id":"c2137fa8aec03468","type":"inject","z":"4be6db179f2af0b9","name":"Reset","repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":300,"y":290,"wires":[["5188ca7c92884164"]]},{"id":"de02a7b5bf7954d2","type":"trigger","z":"4be6db179f2af0b9","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"0.5","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":320,"y":250,"wires":[["a14dd5822f1f6015","900cc4787c0480a4"]]},{"id":"5188ca7c92884164","type":"change","z":"4be6db179f2af0b9","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"foo","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":250,"wires":[["d5314c210f7d9a76"]]},{"id":"d5314c210f7d9a76","type":"counter","z":"4be6db179f2af0b9","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":470,"y":330,"wires":[["6a5f10e31345b897","bb0e17c295353204"]]},{"id":"6a5f10e31345b897","type":"change","z":"4be6db179f2af0b9","name":"Flow set","rules":[{"t":"set","p":"count","pt":"flow","to":"count","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":280,"wires":[[]]},{"id":"a457eafcdad07d0b","type":"change","z":"4be6db179f2af0b9","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"delay","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":145,"y":330,"wires":[["d5314c210f7d9a76","de02a7b5bf7954d2"]],"l":false},{"id":"a14dd5822f1f6015","type":"change","z":"4be6db179f2af0b9","name":"","rules":[{"t":"delete","p":"delay","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":425,"y":250,"wires":[["5188ca7c92884164"]],"l":false},{"id":"900cc4787c0480a4","type":"function","z":"4be6db179f2af0b9","name":"","func":"msg.payload = flow.get(\"count\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":210,"wires":[[]]},{"id":"bb0e17c295353204","type":"function","z":"4be6db179f2af0b9","name":"CounterValue","func":"node.status({text: \"Counting \" + msg.count});\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":330,"wires":[[]]},{"id":"900476fafffa3ae3","type":"status","z":"4be6db179f2af0b9","name":"","scope":["bb0e17c295353204"],"x":670,"y":370,"wires":[[]]},{"id":"df8cb339f3aed3ba","type":"switch","z":"4be6db179f2af0b9","name":"","property":"reset","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":180,"y":210,"wires":[["397e91b8f88a8919"]]},{"id":"397e91b8f88a8919","type":"delay","z":"4be6db179f2af0b9","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":310,"y":210,"wires":[["900cc4787c0480a4"]]},{"id":"368441726da6ee2d","type":"switch","z":"61bbf627ae47ef79","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":6,"x":530,"y":370,"wires":[["eb54e503b5d97e8c"],["f181fd63da81183e"],["160f7a1381ce6497"],["4a85fa0b5cdb8740"],["14373e93f065b9ac"],["b7b26884eb6dad18"]]},{"id":"2408dde860e38d1e","type":"subflow:4be6db179f2af0b9","z":"61bbf627ae47ef79","name":"","env":[{"name":"delay","value":"500","type":"num"}],"x":360,"y":370,"wires":[["8c5f32e93ce2032d","368441726da6ee2d"]]},{"id":"eb54e503b5d97e8c","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"20% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":310,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"f181fd63da81183e","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"40% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":350,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"160f7a1381ce6497","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"60% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":390,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"4a85fa0b5cdb8740","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"80% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":430,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"14373e93f065b9ac","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"100% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":470,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"b7b26884eb6dad18","type":"change","z":"61bbf627ae47ef79","name":"Wipe","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":520,"wires":[["23049a79b40fe27a","3fd47f6616a9cca0"]]},{"id":"a8a93eacebc03ec5","type":"inject","z":"61bbf627ae47ef79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":370,"wires":[["2408dde860e38d1e"]]},{"id":"fce5c98a896cee68","type":"change","z":"61bbf627ae47ef79","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":270,"wires":[["2408dde860e38d1e"]]},{"id":"9011504eb312ea1b","type":"gate","z":"61bbf627ae47ef79","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"storeName":"memory","x":340,"y":440,"wires":[["2408dde860e38d1e"]]},{"id":"8c5f32e93ce2032d","type":"debug","z":"61bbf627ae47ef79","name":"debug 54","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":310,"wires":[]},{"id":"3fd47f6616a9cca0","type":"debug","z":"61bbf627ae47ef79","name":"Light brightness","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":940,"y":380,"wires":[]},{"id":"23049a79b40fe27a","type":"ui_text","z":"61bbf627ae47ef79","group":"d646d4608d936642","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","className":"","x":940,"y":470,"wires":[]},{"id":"08eed27cd045d4d0","type":"inject","z":"61bbf627ae47ef79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":270,"wires":[["fce5c98a896cee68"]]},{"id":"eb74d0ccc1eef85e","type":"switch","z":"61bbf627ae47ef79","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Up","vt":"str"},{"t":"eq","v":"Down","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":480,"wires":[["a938402218c16029","9011504eb312ea1b"],["544b88e0a5acdbc3"]]},{"id":"69ba4d7ee9b81cd5","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":505,"y":500,"wires":[["9011504eb312ea1b"]],"l":false},{"id":"b1457747009dbc0b","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":560,"wires":[["23049a79b40fe27a"]]},{"id":"c6f481318e118641","type":"ui_template","z":"61bbf627ae47ef79","group":"d646d4608d936642","name":"vol -","order":79,"width":1,"height":1,"format":"<div id=\"VolDown\">\n <md-button class=\"md-button TV-HDMI\" aria-label=\"VolDown\">\n <span style=\"color:{{msg.colour}}\" class=\"fa fa-minus remote-icon\"> </span>\n </md-button>\n</div>\n\n<script>\n\n(function($scope) {\n \n$('#VolDown').on('touchstart mousedown', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"topic\":\"VolDown\",\"payload\": \"Down\"});\n});\n\n$('#VolDown').on('touchend mouseup', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"topic\":\"VolDown\",\"payload\": \"Up\"});\n});\n \n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":190,"y":530,"wires":[["248a731374d2e269","eb74d0ccc1eef85e"]]},{"id":"a938402218c16029","type":"change","z":"61bbf627ae47ef79","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":480,"wires":[["544b88e0a5acdbc3"]]},{"id":"544b88e0a5acdbc3","type":"delay","z":"61bbf627ae47ef79","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":540,"y":560,"wires":[["b1457747009dbc0b","48a1be336e584b23"]]},{"id":"48a1be336e584b23","type":"trigger","z":"61bbf627ae47ef79","name":"","op1":"close","op2":"open","op1type":"str","op2type":"str","duration":"3","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":455,"y":500,"wires":[["69ba4d7ee9b81cd5"]],"l":false},{"id":"248a731374d2e269","type":"debug","z":"61bbf627ae47ef79","name":"debug 55","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":200,"y":590,"wires":[]},{"id":"d646d4608d936642","type":"ui_group","name":"Group 1","tab":"1f97ed5dea097aaa","order":1,"disp":true,"width":6},{"id":"1f97ed5dea097aaa","type":"ui_tab","name":"Example","icon":"dashboard","order":45,"disabled":false,"hidden":false}]
puuh this heavy
I have imported the two flows.
and inserted the hue button.
I have many errors and am a bit overloaded
First identify which node is sending those msgs. If you click on the digits after node:
in the debug, it will flash the node that sent that meg.
From the text of the message, the msg.payload needs to be a nuvmber so add a debug node to the output of the node feeding the node that spews out the debug and look to see what it contains. It could be you are sending a string that contains a number.
So which node is generating the error?
What are you doing to that node?
The more information you provide, the easier it will be to help you
That code you posted is the subflow
.
You shouldn't be changing that part.
This is the flow - again:
[{"id":"4be6db179f2af0b9","type":"subflow","name":"Press count","info":"2023 01 17\n==========\nUsed to count button presses and send the number in a message.\n\nIf `msg.payload` == `reset` then `0` is sent out.\nHandy if you want to also include a *reset* ability.\n\nSet the *timeout* value in the `delay` variable.\n_This controls how long between presses before it stops counting._\n\nThen send the output message into a `switch` node to do wonderful things.\n\nThe output message is a `number`.","category":"","in":[{"x":60,"y":270,"wires":[{"id":"df8cb339f3aed3ba"}]}],"out":[{"x":870,"y":210,"wires":[{"id":"900cc4787c0480a4","port":0}]}],"env":[{"name":"delay","type":"num","value":"","ui":{"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#D8BFD8","icon":"node-red-dashboard/ui_button.png","status":{"x":870,"y":370,"wires":[{"id":"900476fafffa3ae3","port":0}]}},{"id":"c2137fa8aec03468","type":"inject","z":"4be6db179f2af0b9","name":"Reset","repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":350,"y":290,"wires":[["5188ca7c92884164"]]},{"id":"de02a7b5bf7954d2","type":"trigger","z":"4be6db179f2af0b9","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"0.5","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":370,"y":250,"wires":[["a14dd5822f1f6015","900cc4787c0480a4"]]},{"id":"5188ca7c92884164","type":"change","z":"4be6db179f2af0b9","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"foo","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":250,"wires":[["d5314c210f7d9a76"]]},{"id":"d5314c210f7d9a76","type":"counter","z":"4be6db179f2af0b9","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":520,"y":330,"wires":[["6a5f10e31345b897","bb0e17c295353204"]]},{"id":"6a5f10e31345b897","type":"change","z":"4be6db179f2af0b9","name":"Flow set","rules":[{"t":"set","p":"count","pt":"flow","to":"count","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":280,"wires":[[]]},{"id":"a457eafcdad07d0b","type":"change","z":"4be6db179f2af0b9","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"delay","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":275,"y":330,"wires":[["d5314c210f7d9a76","de02a7b5bf7954d2"]],"l":false},{"id":"a14dd5822f1f6015","type":"change","z":"4be6db179f2af0b9","name":"","rules":[{"t":"delete","p":"delay","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":475,"y":250,"wires":[["5188ca7c92884164"]],"l":false},{"id":"900cc4787c0480a4","type":"function","z":"4be6db179f2af0b9","name":"","func":"msg.payload = flow.get(\"count\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":210,"wires":[[]]},{"id":"bb0e17c295353204","type":"function","z":"4be6db179f2af0b9","name":"CounterValue","func":"node.status({text: \"Counting \" + msg.count});\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":330,"wires":[[]]},{"id":"900476fafffa3ae3","type":"status","z":"4be6db179f2af0b9","name":"","scope":["bb0e17c295353204"],"x":720,"y":370,"wires":[[]]},{"id":"df8cb339f3aed3ba","type":"switch","z":"4be6db179f2af0b9","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"reset","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":150,"y":270,"wires":[["397e91b8f88a8919"],["a457eafcdad07d0b"]]},{"id":"397e91b8f88a8919","type":"delay","z":"4be6db179f2af0b9","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":360,"y":210,"wires":[["900cc4787c0480a4"]]},{"id":"368441726da6ee2d","type":"switch","z":"61bbf627ae47ef79","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":6,"x":530,"y":370,"wires":[["eb54e503b5d97e8c"],["f181fd63da81183e"],["160f7a1381ce6497"],["4a85fa0b5cdb8740"],["14373e93f065b9ac"],["b7b26884eb6dad18"]]},{"id":"2408dde860e38d1e","type":"subflow:4be6db179f2af0b9","z":"61bbf627ae47ef79","name":"","env":[{"name":"delay","value":"500","type":"num"}],"x":360,"y":370,"wires":[["8c5f32e93ce2032d","368441726da6ee2d"]]},{"id":"eb54e503b5d97e8c","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"20% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":310,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"f181fd63da81183e","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"40% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":350,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"160f7a1381ce6497","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"60% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":390,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"4a85fa0b5cdb8740","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"80% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":430,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"14373e93f065b9ac","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"100% brightness","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":470,"wires":[["3fd47f6616a9cca0","23049a79b40fe27a"]]},{"id":"b7b26884eb6dad18","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Light OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":520,"wires":[["23049a79b40fe27a","3fd47f6616a9cca0"]]},{"id":"a8a93eacebc03ec5","type":"inject","z":"61bbf627ae47ef79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":370,"wires":[["2408dde860e38d1e"]]},{"id":"b1457747009dbc0b","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":580,"wires":[["2408dde860e38d1e"]]},{"id":"fce5c98a896cee68","type":"change","z":"61bbf627ae47ef79","name":"Reset","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":270,"wires":[["2408dde860e38d1e","c5be9bf8e7969338"]]},{"id":"9011504eb312ea1b","type":"gate","z":"61bbf627ae47ef79","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"storeName":"memory","x":340,"y":440,"wires":[["2408dde860e38d1e"]]},{"id":"8c5f32e93ce2032d","type":"debug","z":"61bbf627ae47ef79","name":"debug 54","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":310,"wires":[]},{"id":"3fd47f6616a9cca0","type":"debug","z":"61bbf627ae47ef79","name":"Light brightness","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":940,"y":380,"wires":[]},{"id":"23049a79b40fe27a","type":"ui_text","z":"61bbf627ae47ef79","group":"d646d4608d936642","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","className":"","x":940,"y":470,"wires":[]},{"id":"544b88e0a5acdbc3","type":"delay","z":"61bbf627ae47ef79","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":400,"y":580,"wires":[["b1457747009dbc0b","48a1be336e584b23"]]},{"id":"08eed27cd045d4d0","type":"inject","z":"61bbf627ae47ef79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":270,"wires":[["fce5c98a896cee68"]]},{"id":"c5be9bf8e7969338","type":"debug","z":"61bbf627ae47ef79","name":"debug 57","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":540,"y":260,"wires":[]},{"id":"eb74d0ccc1eef85e","type":"switch","z":"61bbf627ae47ef79","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Up","vt":"str"},{"t":"eq","v":"Down","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":480,"wires":[["a938402218c16029","9011504eb312ea1b"],["544b88e0a5acdbc3"]]},{"id":"69ba4d7ee9b81cd5","type":"change","z":"61bbf627ae47ef79","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":365,"y":520,"wires":[["9011504eb312ea1b"]],"l":false},{"id":"a938402218c16029","type":"change","z":"61bbf627ae47ef79","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":480,"wires":[["544b88e0a5acdbc3"]]},{"id":"48a1be336e584b23","type":"trigger","z":"61bbf627ae47ef79","name":"","op1":"close","op2":"open","op1type":"str","op2type":"str","duration":"3","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":315,"y":520,"wires":[["69ba4d7ee9b81cd5"]],"l":false},{"id":"c6f481318e118641","type":"ui_template","z":"61bbf627ae47ef79","group":"d646d4608d936642","name":"vol -","order":79,"width":1,"height":1,"format":"<div id=\"VolDown\">\n <md-button class=\"md-button TV-HDMI\" aria-label=\"VolDown\">\n <span style=\"color:{{msg.colour}}\" class=\"fa fa-minus remote-icon\"> </span>\n </md-button>\n</div>\n\n<script>\n\n(function($scope) {\n \n$('#VolDown').on('touchstart mousedown', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"topic\":\"VolDown\",\"payload\": \"Down\"});\n});\n\n$('#VolDown').on('touchend mouseup', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"topic\":\"VolDown\",\"payload\": \"Up\"});\n});\n \n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":190,"y":530,"wires":[["248a731374d2e269","eb74d0ccc1eef85e"]]},{"id":"248a731374d2e269","type":"debug","z":"61bbf627ae47ef79","name":"debug 55","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":200,"y":590,"wires":[]},{"id":"d646d4608d936642","type":"ui_group","name":"Group 1","tab":"1f97ed5dea097aaa","order":1,"disp":true,"width":6},{"id":"1f97ed5dea097aaa","type":"ui_tab","name":"Example","icon":"dashboard","order":45,"disabled":false,"hidden":false}]
There are some non-standard nodes.
node-red-contrib-simple-gate
Your BUTTON goes where the template
node is.
The red box, by the way.
The two inject
nodes:
The top one is more for resetting. (with 1 cross over it)
The second one (with 2 crosses) was used for testing.
But it was replaced by the template
node because it sends both up
and down
messages.
Sorry I didn't explain that better at the start.
But the flow (as posted) does what you said you wanted.
So if you look at the GUI side and press the button you would see what you asked for happening.
Hello,
I am making some progress.
When the button is pressed, these three statuses are set:
However, I do not know exactly what I have to enter at the COUNTER. the Node I had to install first.
The gate is open.
Do the button and the lamp have to be inserted in the Press Count? There I get the Device inserted, but these do not go online. But in the normal node it works.
Furthermore I have always after the deploy an error: Error: , Remote I/O error
when i press the button, i let send only the action from button via the setting: payload output. this works: on/off
but a debug after the lamp always sends:
{"brightness":144,"linkquality":196,"state":"ON","update":{"state":"idle"}}
I need to see what debug 59
is sending you.
Honestly though that second screen shot: WRONG!
You should NOT be touching the contents of the subflow
(press counter
).
This is how you use the flow I posted.
The messages coming from the Hue Button (what ever)
node should be Up
and Down
when the button is pressed and released.
Can you do that?
If you can't: This whole things is USELESS.
Ok, slight clarification:
There needs to be DIFFERENT messages when the button is pressed and released.