PIR object counter using two

Hello, I have two PIR sensors that I would like to use to count people coming in and out of door. The sensors are placed one in front of the other. So depending on if PIR sensor on pin 38 is tripped first then PIR sensor on pin 40 is tripped second, it will display a "1" on a dashboard. If the direction entering is reversed the the number will subtract and will move back to "0" on the dashboard. I am having issues with the flow of this and here are the outputs of the PIR sensors. Any ideas? I dont know if it should be a python code that does the work or can a flow handle this?

First PIR:
topic: "pi/38"
payload: 1
_msgid: "10ab8360.997c8d"

Second PIR:
topic: "pi/40"
payload: 1
_msgid: "cd61bb0.a8a0e48"

Thanks.

Please don't open multiple threads for the same topic.

You have already opened this one: PIR People counter