Hopefully this works and formats properly. This is my first Node-Red project and I know it's rather large but if anyone feels like taking a look at it and providing constructive feedback I'd appreciate it. I can't really show just one piece of the project because it all works together so I don't think pieces would make sense.
If I should have shared this differently please let me know.
I started playing around with Node-Red in an attempt to make a training prop for my local fire department that would stop a timer when a bucket was filled to a certain level. It started with a Pi Zero with a float switch and a couple of LEDs and as I ran into various issues and thought of two new things to add for every one I managed to successfully implement it morphed into this.
I had to deal with a couple of obstacles where I'm still not completely satisfied with my solutions. I had to come up with a way to make sure the date and time are correct once I decided to add a logging capability but the UI control doesn't work quite like I want to if a 2nd user connects, or the first user disconnects and reconnects, so I'm still trying to figure that out but overall I'm mostly looking for any suggestions on ways to simplify or make the program more efficient.
Thanks to everyone who contibutes to Node-Red so I can mess around with this kind of stuff in my spare time!
Edited to add: This project is running on a Pi 3 B+ with Node-Red 0.20.5 and Node.JS 10.15.3
The Rasbian image is based on Patrick Murrays ControlPi from GitLab.
Edited again to add some photos
20190529 Training Tool.json (79.1 KB)
Here is the flow that handles the start, water level tracking, and event timing for Prop 1. This is mirrored on another flow for prop 2.
Here is the logic for the LEDs and their virtual counterparts on the UI.
Here is the Keypad to limit access to the "Tech Page" in the UI. This took me quite a while and rather pleased with the result although I'm sure I'm more proud of it now than I will be in a few years when I have more experience lol.
Here is the main page of the UI where data can be entered and the props run separately or timed against each other.
And here are a couple of photos of my hardware assembly. Everything except the Pi came from either Amazon or my scrap pile. This box works quite well as a waterproof case to protect the electronics during a session. It does get a bit warm inside sitting out on the apron in the sun and I have a shutdown built into the flow if the CPU temp gets too high, but that hasn't happened yet. We try to keep it shaded which helps.