bonjours a tous,
quand je j'appuie sur A puis sur B ma variable "compteur" ne s'incremente pas
alors que dans l'autre sens (B puis A) mon "compteur" monte
quelqu'un pourrais me dire comment faire pour que ça monte peut importe le sens d'appuie
merci de votre aide
Hello everyone,
when I press A then B my variable "counter" does not increment
while in the other direction (B then A) my "counter" goes up
someone could tell me how to make it go up no matter what sense of support
Thank you for your help
[{"id":"3861b0a.555ca5","type":"function","z":"3dafcb6f.c00894","name":"","func":"if (msg.payload == \"0\") {\n msg.fourche = \"AC\"\nreturn msg;\n} else if (msg.payload == \"1\") {\n msg.fourche = \"AD\"\nreturn msg;\n}","outputs":1,"noerr":0,"x":290,"y":380,"wires":[["46999e10.3514a"]]},{"id":"42a272a2.c6224c","type":"function","z":"3dafcb6f.c00894","name":"","func":"if (msg.payload == \"0\") {\n msg.fourchebis = \"BC\"\nreturn msg;\n} else if (msg.payload == \"1\") {\n msg.fourchebis = \"BD\"\nreturn msg;\n}","outputs":1,"noerr":0,"x":290,"y":420,"wires":[["46999e10.3514a"]]},{"id":"46999e10.3514a","type":"join","z":"3dafcb6f.c00894","name":"","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":470,"y":400,"wires":[["3257806d.a6861"]]},{"id":"3257806d.a6861","type":"function","z":"3dafcb6f.c00894","name":"","func":"var fourche = msg.payload[1].fourche;\nvar fourchebis = msg.payload[0].fourchebis ;\nif ((fourche === \"AC\") && (fourchebis === \"BC\")){\n msg.alarm = \"on\"\nreturn msg;\n} else {\nmsg.alarm = \"off\"\n return msg;\n}","outputs":1,"noerr":0,"x":630,"y":400,"wires":[["2a21901d.6cbf1"]]},{"id":"ac38e032.d8f16","type":"debug","z":"3dafcb6f.c00894","name":"compte","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":980,"y":400,"wires":[]},{"id":"eb2e0580.8b91d8","type":"inject","z":"3dafcb6f.c00894","name":"0 A","topic":"","payload":"0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":380,"wires":[["3861b0a.555ca5"]]},{"id":"7edb3e4.be15ec","type":"inject","z":"3dafcb6f.c00894","name":"0 B","topic":"","payload":"0","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":420,"wires":[["42a272a2.c6224c"]]},{"id":"2a21901d.6cbf1","type":"function","z":"3dafcb6f.c00894","name":"compteur","func":"// Get the current value of the 'count' context property - default to 0\nvar compte = flow.get(\"compte\")||0;\n\n//if (msg.topic === \"init\") {\n // set its value locally\n// count = msg.payload;\n//} \nif ((msg.alarm === \"on\") && (compte< 30)) {\n compte++;\n} else if (msg.alarm === \"off\") {\n compte=0;\n}else if (compte === 30){\n msg.alarmstatu = \"go\";\n compte = 0;\n}else if (compte > 30){\ncompte = 0;\n}\nflow.set('compte',compte);\nmsg.payload = compte;\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":400,"wires":[["ac38e032.d8f16"]]}]