Some Help about my flow

Hello all after long time I need some help, I think it should be basic.
My flow is I share below. Im greatfull for your helps.
I take some digital input from outside device, just port is on/off information.

1st question is : pin36 connected one output with relay. There is 2 situation, one of them 1 other is 0.
is it possible to take only 1 situation ? Becasuse I also write this 1/0 situation to database and just I need only 1 situation. For 0 situation I dont need and dont want to write to DB, please how can I do this ?

2nd question is : I use and write pin36 and pin37 situation to sqlite db and as I wrote above only getting data from SQL to any counter for visualizing (like dashboard).
Basically how many times pin triggered I want to show it with dahboard. 10-11-12.... etc times.

3rd question is : if pin36 situation 1 (active) after 40 second , how can I show notification on the screen ? If pin36 situation long time up this notification will appear on the screen. Turn the pin36 situation off will disapperar this notification.

Icreated this topic because I dont know too many javascript and other language coding.

Thanks for your helps and feedbacks.

[{"id":"50876597.46d69c","type":"dsm","z":"26872415.20b90c","name":"acil_stop_durumu","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"0\": \"sta.fill='green';msg.background='green';msg.label='AS';\",\n        \"1\": \"sta.fill='red';msg.background='red';msg.label='AS';\"\n    }\n}","x":340,"y":620,"wires":[["3bcc1a82.0e2246","d0b6abfe.f9fa28"]]},{"id":"c2c6e692.cd8708","type":"dsm","z":"26872415.20b90c","name":"kapi_durumu","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"1\": \"sta.fill='green';msg.background='green';msg.label='K';\",\n        \"0\": \"sta.fill='red';msg.background='red';msg.label='K';\"\n    }\n}","x":340,"y":80,"wires":[["b3d5b671.8c12e8","aa69a903.0626a8"]]},{"id":"b3d5b671.8c12e8","type":"ui_button","z":"26872415.20b90c","name":"","group":"776ed49f.0fbf3c","order":2,"width":"2","height":"2","passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"date","topic":"","x":470,"y":140,"wires":[[]]},{"id":"bf251d9c.adc69","type":"rpi-gpio in","z":"26872415.20b90c","name":"","pin":"38","intype":"down","debounce":"25","read":false,"x":140,"y":80,"wires":[["c2c6e692.cd8708"]]},{"id":"aa69a903.0626a8","type":"template","z":"26872415.20b90c","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO 'kapi_durumu' ('durum','epoc') VALUES ({{payload}},{{pyload}});","output":"str","x":640,"y":120,"wires":[["1f75811c.593ccf"]]},{"id":"1f75811c.593ccf","type":"sqlite","z":"26872415.20b90c","mydb":"c61768f.c3efe98","sqlquery":"msg.topic","sql":"","name":"ip_cekili","x":880,"y":280,"wires":[["ab7742c2.6738c"]]},{"id":"3aa0c82d.5ab9f8","type":"dsm","z":"26872415.20b90c","name":"sensör_durumu","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"1\": \"sta.fill='green';msg.background='red';msg.label='S';\",\n        \"0\": \"sta.fill='red';msg.background='green';msg.label='S';\"\n    }\n}","x":330,"y":240,"wires":[["94e1b73c.283198","ef1f0537.b14e88"]]},{"id":"94e1b73c.283198","type":"ui_button","z":"26872415.20b90c","name":"","group":"776ed49f.0fbf3c","order":3,"width":"2","height":"2","passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"date","topic":"","x":430,"y":320,"wires":[[]]},{"id":"ef1f0537.b14e88","type":"template","z":"26872415.20b90c","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO 'kapi_durumu' ('durum','epoc') VALUES ({{payload}},{{pyload}});","output":"str","x":620,"y":280,"wires":[["1f75811c.593ccf"]]},{"id":"d69afc75.9a51e","type":"rpi-gpio in","z":"26872415.20b90c","name":"","pin":"40","intype":"down","debounce":"25","read":false,"x":150,"y":260,"wires":[["3aa0c82d.5ab9f8"]]},{"id":"5e0c4d70.ebda64","type":"dsm","z":"26872415.20b90c","name":"Ip_durumu","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"1\": \"sta.fill='green';msg.background='green';msg.label='I';\",\n        \"0\": \"sta.fill='red';msg.background='red';msg.label='I';\"\n    }\n}","x":310,"y":420,"wires":[["5f756410.98c65c","dd6901d7.7957e"]]},{"id":"5f756410.98c65c","type":"ui_button","z":"26872415.20b90c","name":"","group":"776ed49f.0fbf3c","order":4,"width":"2","height":"2","passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"date","topic":"","x":490,"y":480,"wires":[[]]},{"id":"69b71ed2.32b6e","type":"rpi-gpio in","z":"26872415.20b90c","name":"","pin":"36","intype":"down","debounce":"25","read":false,"x":140,"y":420,"wires":[["5e0c4d70.ebda64"]]},{"id":"dd6901d7.7957e","type":"template","z":"26872415.20b90c","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO 'ip_durumu' ('ip_durumu') VALUES ({{payload}});\n","output":"str","x":660,"y":420,"wires":[["1f75811c.593ccf"]]},{"id":"ab7742c2.6738c","type":"debug","z":"26872415.20b90c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1120,"y":280,"wires":[]},{"id":"3bcc1a82.0e2246","type":"ui_button","z":"26872415.20b90c","name":"","group":"776ed49f.0fbf3c","order":4,"width":"2","height":"2","passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"date","topic":"","x":490,"y":680,"wires":[[]]},{"id":"d0b6abfe.f9fa28","type":"template","z":"26872415.20b90c","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO 'sensor_durumu' ('sensor_durumu','epoc') VALUES ({{payload}},{{pyload}});","output":"str","x":660,"y":620,"wires":[["1f75811c.593ccf"]]},{"id":"513b3477.df45cc","type":"rpi-gpio in","z":"26872415.20b90c","name":"","pin":"37","intype":"down","debounce":"25","read":false,"x":150,"y":640,"wires":[["50876597.46d69c"]]},{"id":"776ed49f.0fbf3c","type":"ui_group","z":"","name":"Hol 7","tab":"21c61860.cde7e8","disp":true,"width":"6","collapse":false},{"id":"c61768f.c3efe98","type":"sqlitedb","z":"","db":"/var/www/html/database/kapi","mode":"RWC"},{"id":"21c61860.cde7e8","type":"ui_tab","z":"","name":"Mercedes-Benz Türk AŞ Kamyon Fabrikası Hol Kapıları","icon":"dashboard"}]

Anyone who help to me ?

How about you make a simple version of your flow.

Inject node (set to 0) and another Inject node (set to 1) and connect them to the GPIO node pointing to the pin you want to use.

Deploy that and see what happens.

Looking at your flow (not importing it but just looking at what I can see on the screen) you say you are not into programming.
Fair enough. Nor am I.

But why are you using a DSM node? (From what I can tell)

You are making your life more difficult than it needs to be.

Stick to the nodes supplied by default and make the things happen you want to do with them.

Including the DSM node is really not helping yourself.
I have tried many times to use it and have failed. If you do get it working: good on you.

But there are trigger nodes, delay nodes and a whole lot more that if done right will/should do what you want.

As to the SQL stuff..... I'm staying away from that altogether.
Other people may like to use it, but they won't have your database and so can't test what you want to do.

For now either work on getting the indications working or some smaller part.
I fear you are taking on way too much at once and are confused by what is going on.

I have been using NR for .... a while. I am still confused quite often.

I think the problem is that we don't understand the questions. I suggest just asking one question at a time, and try and explain again what the problem is.

Thank you for your answer. As I said I dont know how can I achive this is.
I used .dsm node because 2 years ago someone adviced to me. how can use delay or trigger node I dont know.

Dear @Colin I will explain it step by step again.

1st question is this : if raspberry pi any GPIO triggered (for example GPIO 5) , I want to count it how many times triggered, thats it. And showed it counter with dashboard

2nd question is: If any GPIO triggered (for example GPIO 5) , while its triggered still more than 30 second , is it possible to show notification GPIO5 is still triggered ?

Have a look at node-red-contrib-counter (node) - Node-RED
When looking for a node or flow for a task it is always worth searching flows.nodered.org

Sorry, I don't understand 'while it triggered still more than 30 seconds`.
Also what do you mean by triggered? The GPIO node will give an output each time it changes from 0 to 1 or 1 to 0.

Hello @Colin I added a video for explanation , hope this time will be understable.

[https://www.youtube.com/watch?v=g_hLA_yreZ8]

For the check that the output stays high for 40 seconds use a Trigger node configured like this.

When the input goes high it will start a timer and after 40 seconds it will send the message configured there, but if it goes low then the timer will be reset until it goes high again.

For the second problem you can use a Switch node to only pass the high values from the GPIO node.
image
So messages with payload of 1 will go to the output and other messages will be blocked.
Then you can count those messages.

Dear @Colin Im greatfull for your helps. Second problem is done thanks you.
My first problem trigger node is I didnt success it, maybe I put node wrong place, could you please define me one more time.You can see below photo

Select those nodes and export them using the Export feature in the menu, or Ctrl+E. Then past it here. Use the </> button at the top of the forum entry window when pasting it here. Then I can see how you have configured the nodes.

Edit: You have put the trigger node after the switch node. Make sure you understand how the trigger works and you will see that it has to go direct from the pin as the 0 message is used to reset the timer. If it is after the Switch node then it will not receive the 0 messages.

Hello @Colin this is mu flow. Thank you for your helps

[{"id":"a62e3ef4.641a5","type":"dsm","z":"773f3771.dcacc8","name":"kapi_durumu","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"1\": \"sta.fill='green';msg.background='green';msg.label='K';\",\n        \"0\": \"sta.fill='red';msg.background='red';msg.label='K';\"\n    }\n}","x":320,"y":60,"wires":[["44b9d0a4.7c2b8","2aace167.f27b8e","1bc7a1c9.09b48e"]]},{"id":"44b9d0a4.7c2b8","type":"ui_button","z":"773f3771.dcacc8","name":"","group":"f3de209f.b746","order":2,"width":"2","height":"2","passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"date","topic":"","x":490,"y":120,"wires":[[]]},{"id":"bb6cb0b4.3af2c","type":"rpi-gpio in","z":"773f3771.dcacc8","name":"","pin":"38","intype":"down","debounce":"25","read":false,"x":100,"y":60,"wires":[["a62e3ef4.641a5"]]},{"id":"1bc7a1c9.09b48e","type":"template","z":"773f3771.dcacc8","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO 'kapi_durumu' ('durum','epoc') VALUES ({{payload}},{{pyload}});","output":"str","x":820,"y":120,"wires":[["e96eee93.a1f08"]]},{"id":"2aace167.f27b8e","type":"trigger","z":"773f3771.dcacc8","op1":"","op2":"High Voltage","op1type":"nul","op2type":"str","duration":"10","extend":false,"units":"s","reset":"0","bytopic":"all","name":"","x":670,"y":40,"wires":[[]]},{"id":"e96eee93.a1f08","type":"sqlite","z":"773f3771.dcacc8","mydb":"e35ee04b.a8bff","sqlquery":"msg.topic","sql":"","name":"ip_cekili","x":960,"y":220,"wires":[["c41353ea.70a55"]]},{"id":"c41353ea.70a55","type":"debug","z":"773f3771.dcacc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1220,"y":260,"wires":[]},{"id":"f3de209f.b746","type":"ui_group","z":"","name":"Hol 7","tab":"6f5ce300.48f7bc","disp":true,"width":"6","collapse":false},{"id":"e35ee04b.a8bff","type":"sqlitedb","z":"","db":"/var/www/html/database/deneme","mode":"RWC"},{"id":"6f5ce300.48f7bc","type":"ui_tab","z":"","name":"Mercedes-Benz Türk AŞ Kamyon Fabrikası Hol Kapıları","icon":"dashboard"}]

That isn't a Switch node, it is a dsm node, whatever that is.

Also you haven't made the change I suggested in my last post, though perhaps you did not see the edit I made.

Sorry I have do this, could you please look it again ?

[{"id":"44b9d0a4.7c2b8","type":"ui_button","z":"773f3771.dcacc8","name":"","group":"f3de209f.b746","order":2,"width":"2","height":"2","passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"date","topic":"","x":510,"y":300,"wires":[[]]},{"id":"bb6cb0b4.3af2c","type":"rpi-gpio in","z":"773f3771.dcacc8","name":"","pin":"38","intype":"down","debounce":"25","read":false,"x":200,"y":200,"wires":[["fe3bfcce.584d8"]]},{"id":"1bc7a1c9.09b48e","type":"template","z":"773f3771.dcacc8","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO 'kapi_durumu' ('durum','epoc') VALUES ({{payload}},{{pyload}});","output":"str","x":800,"y":180,"wires":[["e96eee93.a1f08"]]},{"id":"e96eee93.a1f08","type":"sqlite","z":"773f3771.dcacc8","mydb":"e35ee04b.a8bff","sqlquery":"msg.topic","sql":"","name":"ip_cekili","x":980,"y":180,"wires":[[]]},{"id":"c41353ea.70a55","type":"debug","z":"773f3771.dcacc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":990,"y":340,"wires":[]},{"id":"fe3bfcce.584d8","type":"switch","z":"773f3771.dcacc8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":200,"wires":[["44b9d0a4.7c2b8","46df1bf4.087594"]]},{"id":"46df1bf4.087594","type":"trigger","z":"773f3771.dcacc8","op1":"","op2":"Cihaz kirmizi","op1type":"nul","op2type":"str","duration":"5","extend":false,"units":"s","reset":"0","bytopic":"all","name":"","x":560,"y":200,"wires":[["1bc7a1c9.09b48e","c41353ea.70a55"]]},{"id":"f3de209f.b746","type":"ui_group","z":"","name":"Hol 7","tab":"6f5ce300.48f7bc","disp":true,"width":"6","collapse":false},{"id":"e35ee04b.a8bff","type":"sqlitedb","z":"","db":"/var/www/html/database/deneme","mode":"RWC"},{"id":"6f5ce300.48f7bc","type":"ui_tab","z":"","name":"Mercedes-Benz Türk AŞ Kamyon Fabrikası Hol Kapıları","icon":"dashboard"}]

following @Colin 's advice and little improvising, i have created below flow. see if this works for you.

you may need to install ttb-node-red-counter node.

the timer is set for 10 seconds.

count_only_ones

[{"id":"474ef19fcca961ac","type":"trigger","z":"c0b4d8b015901a0c","name":"","op1":"","op2":"Signal High for 10 Seconds","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"0","bytopic":"all","topic":"topic","outputs":1,"x":410,"y":620,"wires":[["837f741d366e108d","a498f45da7ff2e3b"]]},{"id":"4b50c145e1d04396","type":"function","z":"c0b4d8b015901a0c","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":235,"y":620,"wires":[["474ef19fcca961ac","e14be39ac1c97485","1a689109c2452ecc"]],"l":false},{"id":"a7ff57320c9ce345","type":"function","z":"c0b4d8b015901a0c","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":235,"y":460,"wires":[["1a689109c2452ecc","e14be39ac1c97485","474ef19fcca961ac"]],"l":false},{"id":"837f741d366e108d","type":"debug","z":"c0b4d8b015901a0c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":770,"y":620,"wires":[]},{"id":"a498f45da7ff2e3b","type":"change","z":"c0b4d8b015901a0c","name":"","rules":[{"t":"set","p":"bc","pt":"msg","to":"green","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"ACTIVE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":560,"wires":[["293b0cd9e997faa7"]]},{"id":"8161ee026998dd9f","type":"inject","z":"c0b4d8b015901a0c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"1","payloadType":"num","x":130,"y":620,"wires":[["4b50c145e1d04396"]]},{"id":"e14be39ac1c97485","type":"counter","z":"c0b4d8b015901a0c","inc":1,"name":"Low Counter","x":550,"y":360,"wires":[["30e8dc2960b72c7d","f69cc816466ad671"]]},{"id":"1a689109c2452ecc","type":"switch","z":"c0b4d8b015901a0c","name":"allow only 1 ","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":390,"y":460,"wires":[["802a360d72c833dc"]]},{"id":"a888feec296405b0","type":"inject","z":"c0b4d8b015901a0c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":130,"y":460,"wires":[["a7ff57320c9ce345"]]},{"id":"293b0cd9e997faa7","type":"ui_button","z":"c0b4d8b015901a0c","name":"","group":"2e75a2da420be146","order":13,"width":"10","height":"3","passthru":false,"label":"High Signal Status {{status}}","tooltip":"","color":"","bgcolor":"{{bc}}","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":770,"y":560,"wires":[[]]},{"id":"7dac1698b2f81831","type":"function","z":"c0b4d8b015901a0c","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":235,"y":360,"wires":[["802a360d72c833dc","0aa05ecc422bd942","e14be39ac1c97485"]],"l":false},{"id":"30e8dc2960b72c7d","type":"debug","z":"c0b4d8b015901a0c","name":"TOTAL of 1 and 0","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":790,"y":380,"wires":[]},{"id":"f69cc816466ad671","type":"ui_text","z":"c0b4d8b015901a0c","group":"2e75a2da420be146","order":0,"width":0,"height":0,"name":"","label":"TOTAL Counter","format":"{{msg.payload}}","layout":"row-spread","className":"","x":780,"y":340,"wires":[]},{"id":"802a360d72c833dc","type":"counter","z":"c0b4d8b015901a0c","inc":1,"name":"High Counter","x":550,"y":460,"wires":[["137c326fc5b813f7","7233f0a84aab42e0"]]},{"id":"0aa05ecc422bd942","type":"change","z":"c0b4d8b015901a0c","name":"","rules":[{"t":"set","p":"bc","pt":"msg","to":"red","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"INACTIVE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":520,"wires":[["293b0cd9e997faa7"]]},{"id":"4c69e425fed0384f","type":"inject","z":"c0b4d8b015901a0c","name":"Reset","props":[{"p":"reset","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":130,"y":360,"wires":[["7dac1698b2f81831"]]},{"id":"137c326fc5b813f7","type":"debug","z":"c0b4d8b015901a0c","name":"Total of Only 1","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":780,"y":480,"wires":[]},{"id":"7233f0a84aab42e0","type":"ui_text","z":"c0b4d8b015901a0c","group":"2e75a2da420be146","order":0,"width":0,"height":0,"name":"","label":"High Counter","format":"{{msg.payload}}","layout":"row-spread","className":"","x":770,"y":440,"wires":[]},{"id":"2e75a2da420be146","type":"ui_group","name":"Group 1","tab":"5c6a50542da72995","order":1,"disp":false,"width":"10","collapse":false,"className":""},{"id":"5c6a50542da72995","type":"ui_tab","name":"Tab 10","icon":"dashboard","order":2}]

I dont have rpi-gpio in node installed, so cant check , check below if this works.

[{"id":"474ef19fcca961ac","type":"trigger","z":"068aa9aeb78a234b","name":"","op1":"","op2":"Signal High for 10 Seconds","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"0","bytopic":"all","topic":"topic","outputs":1,"x":450,"y":360,"wires":[["837f741d366e108d","a498f45da7ff2e3b"]]},{"id":"4b50c145e1d04396","type":"function","z":"068aa9aeb78a234b","name":"ADD YOUR INPUT HERE","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":230,"y":360,"wires":[["474ef19fcca961ac","e14be39ac1c97485","1a689109c2452ecc"]]},{"id":"837f741d366e108d","type":"debug","z":"068aa9aeb78a234b","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":810,"y":360,"wires":[]},{"id":"a498f45da7ff2e3b","type":"change","z":"068aa9aeb78a234b","name":"","rules":[{"t":"set","p":"bc","pt":"msg","to":"green","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"ACTIVE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":300,"wires":[["293b0cd9e997faa7"]]},{"id":"bb6cb0b4.3af2c","type":"rpi-gpio in","z":"068aa9aeb78a234b","name":"","pin":"38","intype":"down","debounce":"25","read":false,"x":150,"y":280,"wires":[["4b50c145e1d04396"]]},{"id":"e14be39ac1c97485","type":"counter","z":"068aa9aeb78a234b","inc":1,"name":"Low Counter","x":590,"y":100,"wires":[["30e8dc2960b72c7d","f69cc816466ad671"]]},{"id":"1a689109c2452ecc","type":"switch","z":"068aa9aeb78a234b","name":"allow only 1 ","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":200,"wires":[["802a360d72c833dc"]]},{"id":"293b0cd9e997faa7","type":"ui_button","z":"068aa9aeb78a234b","name":"","group":"2e75a2da420be146","order":13,"width":"10","height":"3","passthru":false,"label":"High Signal Status {{status}}","tooltip":"","color":"","bgcolor":"{{bc}}","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":810,"y":300,"wires":[[]]},{"id":"7dac1698b2f81831","type":"function","z":"068aa9aeb78a234b","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":275,"y":100,"wires":[["802a360d72c833dc","0aa05ecc422bd942","e14be39ac1c97485"]],"l":false},{"id":"30e8dc2960b72c7d","type":"debug","z":"068aa9aeb78a234b","name":"TOTAL of 1 and 0","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":830,"y":120,"wires":[]},{"id":"f69cc816466ad671","type":"ui_text","z":"068aa9aeb78a234b","group":"2e75a2da420be146","order":0,"width":0,"height":0,"name":"","label":"TOTAL Counter","format":"{{msg.payload}}","layout":"row-spread","className":"","x":820,"y":80,"wires":[]},{"id":"802a360d72c833dc","type":"counter","z":"068aa9aeb78a234b","inc":1,"name":"High Counter","x":590,"y":200,"wires":[["137c326fc5b813f7","7233f0a84aab42e0"]]},{"id":"0aa05ecc422bd942","type":"change","z":"068aa9aeb78a234b","name":"","rules":[{"t":"set","p":"bc","pt":"msg","to":"red","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"INACTIVE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":260,"wires":[["293b0cd9e997faa7"]]},{"id":"4c69e425fed0384f","type":"inject","z":"068aa9aeb78a234b","name":"Reset","props":[{"p":"reset","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":170,"y":100,"wires":[["7dac1698b2f81831"]]},{"id":"137c326fc5b813f7","type":"debug","z":"068aa9aeb78a234b","name":"Total of Only 1","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":820,"y":220,"wires":[]},{"id":"7233f0a84aab42e0","type":"ui_text","z":"068aa9aeb78a234b","group":"2e75a2da420be146","order":0,"width":0,"height":0,"name":"","label":"High Counter","format":"{{msg.payload}}","layout":"row-spread","className":"","x":810,"y":180,"wires":[]},{"id":"2e75a2da420be146","type":"ui_group","name":"Group 1","tab":"5c6a50542da72995","order":1,"disp":false,"width":"10","collapse":false,"className":""},{"id":"5c6a50542da72995","type":"ui_tab","name":"Tab 10","icon":"dashboard","order":1}]

My counter is always 1 and 0 not counting, when I trig pin 38
GIF 15.02.2022 16-17-55

OK, the counter node you are using does not update the count in msg.payload but msg.count

replace msg.payload with msg.count and see if it helps

since the OP requested a simple flow without any reset and buttons on the dashboard, posting here a simple flow

[{"id":"57e1549777b1a6f0","type":"switch","z":"961871ad35315f98","name":"allow only 1 ","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":940,"wires":[["1827ad38d0dcb9e5"],["32ee05c08355e111"]]},{"id":"f3b7d067d60c9845","type":"function","z":"961871ad35315f98","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":940,"wires":[["24226d0cedfd8953","57e1549777b1a6f0"]]},{"id":"1827ad38d0dcb9e5","type":"change","z":"961871ad35315f98","name":"High","rules":[{"t":"set","p":"bc","pt":"msg","to":"green","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"HIGH","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":940,"wires":[["8510c26a603772eb"]]},{"id":"32ee05c08355e111","type":"change","z":"961871ad35315f98","name":"Low","rules":[{"t":"set","p":"bc","pt":"msg","to":"red","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"LOW","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":980,"wires":[["8510c26a603772eb"]]},{"id":"05de5f80c625f460","type":"rpi-gpio in","z":"961871ad35315f98","name":"","pin":"20","intype":"down","debounce":"25","read":false,"bcm":true,"x":220,"y":940,"wires":[["f3b7d067d60c9845"]]},{"id":"24226d0cedfd8953","type":"trigger","z":"961871ad35315f98","name":"","op1":"","op2":"Signal High for 10 Seconds","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"0","bytopic":"all","topic":"topic","outputs":1,"x":590,"y":980,"wires":[["4c06febc088be801"]]},{"id":"8510c26a603772eb","type":"ui_button","z":"961871ad35315f98","name":"PIN STATUS","group":"2e75a2da420be146","order":13,"width":"10","height":"3","passthru":false,"label":"PIN STATUS {{msg.status}}","tooltip":"","color":"","bgcolor":"{{bc}}","className":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":950,"y":960,"wires":[[]]},{"id":"4c06febc088be801","type":"ui_toast","z":"961871ad35315f98","position":"dialog","displayTime":"","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"","x":790,"y":1040,"wires":[[]]},{"id":"2e75a2da420be146","type":"ui_group","name":"Group 1","tab":"5c6a50542da72995","order":1,"disp":false,"width":"10","collapse":false,"className":""},{"id":"5c6a50542da72995","type":"ui_tab","name":"Tab 10","icon":"dashboard","order":1}]

and as a subflow

[{"id":"695d6428fea64b8e","type":"subflow","name":"Subflow 1","info":"","in":[{"x":60,"y":80,"wires":[{"id":"f3b7d067d60c9845"}]}],"out":[{"x":920,"y":100,"wires":[{"id":"8b36a73ae22d5812","port":0}]},{"x":540,"y":120,"wires":[{"id":"24226d0cedfd8953","port":0}]}]},{"id":"f3b7d067d60c9845","type":"function","z":"695d6428fea64b8e","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":80,"wires":[["24226d0cedfd8953","57e1549777b1a6f0"]]},{"id":"57e1549777b1a6f0","type":"switch","z":"695d6428fea64b8e","name":"allow only 1 ","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":80,"wires":[["1827ad38d0dcb9e5"],["32ee05c08355e111"]]},{"id":"24226d0cedfd8953","type":"trigger","z":"695d6428fea64b8e","name":"","op1":"","op2":"Signal High for 10 Seconds","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"0","bytopic":"all","topic":"topic","outputs":1,"x":390,"y":120,"wires":[[]]},{"id":"1827ad38d0dcb9e5","type":"change","z":"695d6428fea64b8e","name":"High","rules":[{"t":"set","p":"bc","pt":"msg","to":"green","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"HIGH","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":80,"wires":[["8b36a73ae22d5812"]]},{"id":"32ee05c08355e111","type":"change","z":"695d6428fea64b8e","name":"Low","rules":[{"t":"set","p":"bc","pt":"msg","to":"red","tot":"str"},{"t":"set","p":"status","pt":"msg","to":"LOW","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":120,"wires":[["8b36a73ae22d5812"]]},{"id":"8b36a73ae22d5812","type":"function","z":"695d6428fea64b8e","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":780,"y":100,"wires":[[]]},{"id":"1a8343ada8430271","type":"subflow:695d6428fea64b8e","z":"961871ad35315f98","name":"Pin Status Monitoring","x":500,"y":940,"wires":[["8510c26a603772eb"],["4c06febc088be801"]]},{"id":"05de5f80c625f460","type":"rpi-gpio in","z":"961871ad35315f98","name":"","pin":"20","intype":"down","debounce":"25","read":false,"bcm":true,"x":300,"y":940,"wires":[["1a8343ada8430271"]]},{"id":"8510c26a603772eb","type":"ui_button","z":"961871ad35315f98","name":"PIN STATUS","group":"2e75a2da420be146","order":13,"width":"10","height":"3","passthru":false,"label":"PIN STATUS {{msg.status}}","tooltip":"","color":"","bgcolor":"{{bc}}","className":"","icon":"","payload":"1","payloadType":"num","topic":"topic","topicType":"msg","x":730,"y":900,"wires":[[]]},{"id":"4c06febc088be801","type":"ui_toast","z":"961871ad35315f98","position":"dialog","displayTime":"","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"","x":730,"y":960,"wires":[[]]},{"id":"2e75a2da420be146","type":"ui_group","name":"Group 1","tab":"5c6a50542da72995","order":1,"disp":false,"width":"10","collapse":false,"className":""},{"id":"5c6a50542da72995","type":"ui_tab","name":"Tab 10","icon":"dashboard","order":1}]

1 Like

Im greatfull for your aşk helps.
Thank you very much.
just for information , is it any node for example it will send 10second 1 signal and 10second 0 signal ?