I have a situation maybe familiar to other users of wifi connected ip-cameras. Sometimes the connection to one or more is lost for a shorter or longer period. For various network related reasons. At least this happens to me periodically.
So what-to-do? I decided to monitor the connection status for each of my cameras. Using to-me-known and available nodes, it ended up in the very complex looking flow seen below. It works as expected and what I targeted but I would really appriciate very much any suggestion how I can reduce the number of nodes involved
The functionality is as follows:
My video system detects & sends a message when a camera gets connected (Camera found) and when it disconnects (Camera lost). That's great anyway but...I want in addition
- When a camera is lost I want NR to put that information on hold for a defined time
- If the camera is found in the meantime nothing should happen, the information put on hold shall just be resetted
- If the camera is lost longer than the defined time period, the information (Camera lost) shall be sent further, typically to a messaging service (like Telegram in my case)
- Once it is back, the information (Camera found) shall be sent
Below the test flow that I would like to simplify, reducing the number of nodes involved. At the very end below, my complete flow monitoring 8 cameras
[{"id":"910288c9.5f9b48","type":"trigger","z":"a5703ff7.1af6a","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"30","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":570,"y":330,"wires":[["b191be66.bc6c"]]},{"id":"1885c4fd.04d80b","type":"change","z":"a5703ff7.1af6a","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":390,"wires":[["910288c9.5f9b48"]]},{"id":"96656c40.2e642","type":"delay","z":"a5703ff7.1af6a","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":560,"y":450,"wires":[["1885c4fd.04d80b","50fe2dbc.ec8624"]]},{"id":"50fe2dbc.ec8624","type":"switch","z":"a5703ff7.1af6a","name":"","property":"'42'","propertyType":"flow","rules":[{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":840,"y":450,"wires":[["b191be66.bc6c"]]},{"id":"48c5371d.736648","type":"change","z":"a5703ff7.1af6a","name":"","rules":[{"t":"set","p":"'42'","pt":"flow","to":"status.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":390,"wires":[[]]},{"id":"2f6b0c6f.70ca74","type":"status","z":"a5703ff7.1af6a","name":"","scope":["910288c9.5f9b48"],"x":810,"y":330,"wires":[["48c5371d.736648"]]},{"id":"b191be66.bc6c","type":"debug","z":"a5703ff7.1af6a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1030,"y":230,"wires":[]},{"id":"209344f.28672bc","type":"inject","z":"a5703ff7.1af6a","name":"","topic":"","payload":"Camera lost","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":330,"wires":[["910288c9.5f9b48"]]},{"id":"ce0d26d7.9f5fd8","type":"inject","z":"a5703ff7.1af6a","name":"","topic":"","payload":"Camera found","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":450,"wires":[["96656c40.2e642"]]}]