Skip to main content

Posts

Project time

My wife is a sports coach. She does this at multiple levels, including personal training. What that means is the need to manage training sessions. So, smart-guy here said "I could probably build you a simple booking app". Well, if I'd been listening harder I probably would have heard the sound of all the things I didn't know about web development about to fall on me. So, let's start at the start. HTML, CSS, and Javascript. Good, good, and meh. But JS is simple enough that me and Stackoverflow can muddle by. So, I think, that's the client side. So what about the backend? Well, I think, I know Python. What about that? I looked at Django and Flask and decided that it's relative simplicity meant Flask was the framework for me. Well, it turned out that it does work for me and the way I think, but suddenly I'm finding that the client/backend split is not clean in the world of Flask. Two weeks later and I have several functions that render the pages...

Context in Node-Red

It's probably not news to anyone willing to read documentation, but I was able to simplify a number of Node-Red flows recently after a primer on context. In Node-Red, each function node has a self-contained context. Variables are local to that node and nothing is permanent. Unless you use a different context. It is possible to set flow-level and global-level variables that can be used to store values, provide them to multiple other nodes without links, and give the illusion of memory to Node-Red. Setting flow context uses simple syntax: flow.set( 'name of the variable' , 'value of the variable' ) This new flow-level variable can be called anywhere in the same Flow tab. This is great for recording values that don't change every time the flow runs (e.g. a maximum recorded value), or need to be used in isolation from the pathway that generates them. Calling the value is relatively simple as well: var varName = flow.get( ' name of the varia...

And now for something completely...not plants...

After reading a neat little project by Nick Sypteras where he hacked a Staples "Easy" button to send him an alert when someone was at his cube entrance ( Blog post is here ), I was inspired. I borrowed Nick's Micropython code from his Github (link is in his article) and modified it. My goal was to create a quick notification tool for my team. I work in a fast-paced job where I will often need to leave my desk for meetings or for other urgent reasons, leaving my remote team members talking to an absent person in Slack. A person who often needs to approve their current actions. Most of my meetings require around an hour of time, so my focus was on that duration. As such, I modified Nick's code to have three buttons: Green - I am back from wherever I've been. Yellow - I will be away for up to an hour. Red - I will be away for over an hour. I like traffic light systems. My thinking was that green is a "go" for questions/comms; yellow is a "s...

Some redemption

I finally got my watering to work consistently. All it took was replacing the MOSFET with a switch relay and some persistence in getting the damn ESP8266 to connect to the network for more than 5 minutes. I also had my first crop: green beans (or as they seem to be called in the US, string beans). Still waiting on the tomatoes, but I fear the aphids may have undone the good work so far. So, here's the setup: Two window boxes featuring, from left to right, carrots, green/string beans, tomatoes, and strawberry. The white PVC pipe has drill holes to provide water with a length of flexible tubing entering it on the left, supplying the pipe, and the right end of the pipe emptying back into the reservoir. A design issue with this simple setup is that the pipe is too high - it can easily erode un-mulched soil. In a better-designed setup, I would have the reservoir lower than the return so that the pipe can sit on the soil. The reservoir: Nothing fancy here. A 12v DC pump su...