Skip to content

Instantly share code, notes, and snippets.

@skylord123
Created August 25, 2023 16:24
Show Gist options
  • Save skylord123/434a97ba513287046731b9e07b6e506a to your computer and use it in GitHub Desktop.
Save skylord123/434a97ba513287046731b9e07b6e506a to your computer and use it in GitHub Desktop.
Node-RED flow to auto restart Neolink when camera stream fails
[{"id":"d1ad8db0c33b93c1","type":"http in","z":"582717cf.467f78","name":"","url":"/xeoma/problem-detector","method":"post","upload":false,"swaggerDoc":"","x":290,"y":3000,"wires":[["3dbd5c276585c1c7"]]},{"id":"3dbd5c276585c1c7","type":"function","z":"582717cf.467f78","name":"Parse pieces","func":"msg.matches = /^(.+) ([^\\s]+) (\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}) (.+)$/gm.exec(msg.payload.report);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":230,"y":3040,"wires":[["09c6b6d133b1891c","47d6268561b58ae4"]]},{"id":"09c6b6d133b1891c","type":"debug","z":"582717cf.467f78","name":"debug 78","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":420,"y":3040,"wires":[]},{"id":"47d6268561b58ae4","type":"switch","z":"582717cf.467f78","name":"is Neolink camera","property":"matches[1]","propertyType":"msg","rules":[{"t":"regex","v":"Driveway|Front Yard Door|Back Yard","vt":"str","case":true}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":3080,"wires":[["03f5c1dd3c0111a4"]]},{"id":"03f5c1dd3c0111a4","type":"switch","z":"582717cf.467f78","name":"Issue is \"No camera stream\"","property":"matches[4]","propertyType":"msg","rules":[{"t":"eq","v":"No camera stream","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":280,"y":3120,"wires":[["cd9b5b1dbf0ccddb"]]},{"id":"31db82ecc9bcf717","type":"comment","z":"582717cf.467f78","name":"Auto restart Neolink when camera stream fails in Xeoma","info":"","x":360,"y":2960,"wires":[]},{"id":"ebed08c2b8dd5790","type":"debug","z":"582717cf.467f78","name":"debug 79","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":3200,"wires":[]},{"id":"fe1ebf85b9d0329c","type":"switch","z":"582717cf.467f78","name":"Is container running","property":"payload.State.Status","propertyType":"msg","rules":[{"t":"eq","v":"running","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":3160,"wires":[["ee811fd7075f76eb"],[]]},{"id":"cd9b5b1dbf0ccddb","type":"docker-container-actions","z":"582717cf.467f78","name":"","config":"deb74f735a89eef3","container":"neolink","containertype":"str","action":"inspect","options":"","optionstype":"str","image":"","imagetype":"str","pullimage":false,"deletecontainer":false,"stream":false,"createOptions":"","startOptions":"","createOptionsType":"json","startOptionsType":"json","x":250,"y":3160,"wires":[["fe1ebf85b9d0329c"]]},{"id":"fa453cac5e601eff","type":"docker-container-actions","z":"582717cf.467f78","name":"Restart Neolink Container","config":"deb74f735a89eef3","container":"neolink","containertype":"str","action":"restart","options":"","optionstype":"str","image":"","imagetype":"str","pullimage":false,"deletecontainer":false,"stream":false,"createOptions":"","startOptions":"","createOptionsType":"json","startOptionsType":"json","x":450,"y":3200,"wires":[["ebed08c2b8dd5790"]]},{"id":"ee811fd7075f76eb","type":"trigger","z":"582717cf.467f78","name":"Restart limiter","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"40","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":240,"y":3200,"wires":[["fa453cac5e601eff"]]},{"id":"deb74f735a89eef3","type":"docker-configuration","host":"/var/run/docker.sock","port":""}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment