I'm testing some functions and using the inject option works as expected, but I need to use buttons and the behavior is strange.
When using buttons the messages are repeated and the result of the function is wrong and the counter adds up several times even with just one click.
Am I missing something?
[{"id":"d6239213f9f33d98","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"32393c49c17a1533","type":"ha-button","z":"d6239213f9f33d98","name":"teste","version":0,"debugenabled":false,"outputs":1,"entityConfig":"8849e89d9e6c9ed1","outputProperties":[],"x":250,"y":520,"wires":[["ce21d5a89db4fc2a"]]},{"id":"ce21d5a89db4fc2a","type":"function","z":"d6239213f9f33d98","name":"Gerador de comandos","func":"msg.senha = flow.get(\"senhaflow\") || {};\nvar i;\nfor (i = 0; i < msg.senha.length; i++) { msg.senha[i] = msg.senha[i] + 0x30; }\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":520,"wires":[["e294ddf47043dffd"]]},{"id":"e294ddf47043dffd","type":"debug","z":"d6239213f9f33d98","name":"Button ?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"senha","targetType":"msg","statusVal":"","statusType":"auto","x":1000,"y":520,"wires":[]},{"id":"b1e1146df5ec4324","type":"inject","z":"d6239213f9f33d98","name":"Inject Senha","props":[{"p":"senha","v":"[1,2,3,4,5,6]","vt":"bin"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":380,"wires":[["a894df8dc67e8858"]]},{"id":"a894df8dc67e8858","type":"change","z":"d6239213f9f33d98","name":"","rules":[{"t":"set","p":"senhaflow","pt":"flow","to":"senha","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":380,"wires":[["47a8cf7a5a7ece2c"]]},{"id":"47a8cf7a5a7ece2c","type":"debug","z":"d6239213f9f33d98","name":"Inject Senha OK","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"senha","targetType":"msg","statusVal":"","statusType":"auto","x":1020,"y":380,"wires":[]},{"id":"634256b7.2d6818","type":"inject","z":"d6239213f9f33d98","name":"JSON String","props":[{"p":"payload","v":"{\"a\":1}","vt":"str"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"a\":1}","payloadType":"str","x":650,"y":900,"wires":[["a2fe0fc8.095e1"]]},{"id":"a2fe0fc8.095e1","type":"json","z":"d6239213f9f33d98","name":"","property":"payload","action":"","pretty":false,"x":810,"y":900,"wires":[["9a4ce2b8.47698"]]},{"id":"9a4ce2b8.47698","type":"debug","z":"d6239213f9f33d98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":900,"wires":[]},{"id":"80032e2.7c92cd","type":"inject","z":"d6239213f9f33d98","name":"Object","props":[{"p":"payload","v":"{\"a\":1}","vt":"json"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"a\":1}","payloadType":"json","x":630,"y":940,"wires":[["cd40a0f4.4f5ac"]]},{"id":"cd40a0f4.4f5ac","type":"json","z":"d6239213f9f33d98","name":"","property":"payload","action":"","pretty":false,"x":810,"y":940,"wires":[["478b4106.4fd7c"]]},{"id":"478b4106.4fd7c","type":"debug","z":"d6239213f9f33d98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":940,"wires":[]},{"id":"d4193da45aa7857b","type":"change","z":"d6239213f9f33d98","name":"","rules":[{"t":"set","p":"senha","pt":"msg","to":"senhaflow","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":440,"wires":[["8072f4c60228ec49"]]},{"id":"8072f4c60228ec49","type":"function","z":"d6239213f9f33d98","name":"Gerador de comandos","func":"msg.senha = flow.get(\"senhaflow\") || {};\nvar i;\nfor (i = 0; i < msg.senha.length; i++) { msg.senha[i] = msg.senha[i] + 0x30; }\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":740,"y":440,"wires":[["c1e543183f6e03e1"]]},{"id":"ec7ef9ed7988596c","type":"inject","z":"d6239213f9f33d98","name":"Inject for loop","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":290,"y":440,"wires":[["d4193da45aa7857b"]]},{"id":"c1e543183f6e03e1","type":"debug","z":"d6239213f9f33d98","name":"Inject for loop OK","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"senha","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":440,"wires":[]},{"id":"ec964dd4ec3d5f03","type":"ha-button","z":"d6239213f9f33d98","name":"Teste Count","version":0,"debugenabled":false,"outputs":1,"entityConfig":"ff15b2b7b6f131da","outputProperties":[],"x":270,"y":740,"wires":[["4ab66cb451cdd144"]]},{"id":"4ab66cb451cdd144","type":"counter","z":"d6239213f9f33d98","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":520,"y":740,"wires":[["a74f85d6b4803048"]]},{"id":"a74f85d6b4803048","type":"debug","z":"d6239213f9f33d98","name":"Teste Count ???","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"count","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":740,"wires":[]},{"id":"aa5f0364ed1fa230","type":"counter","z":"d6239213f9f33d98","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":520,"y":600,"wires":[["5b724edbdec978d4"]]},{"id":"5b724edbdec978d4","type":"debug","z":"d6239213f9f33d98","name":"Inject Count OK","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"count","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":600,"wires":[]},{"id":"a4086267efbe0cc2","type":"inject","z":"d6239213f9f33d98","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":270,"y":600,"wires":[["aa5f0364ed1fa230"]]},{"id":"dd1541f911e7f121","type":"inject","z":"d6239213f9f33d98","name":"Reset","props":[{"p":"reset","v":" ","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":270,"y":640,"wires":[["aa5f0364ed1fa230","4ab66cb451cdd144"]]},{"id":"8849e89d9e6c9ed1","type":"ha-entity-config","server":"33803899.487d48","deviceConfig":"","name":"teste","version":"6","entityType":"button","haConfig":[{"property":"name","value":"teste"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":true},{"id":"ff15b2b7b6f131da","type":"ha-entity-config","server":"33803899.487d48","deviceConfig":"","name":"Teste Count","version":"6","entityType":"button","haConfig":[{"property":"name","value":"Teste Count"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"33803899.487d48","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]