Awesome threading using nurseries

I wrote about a nice threading pattern using Queues for synchronization a while ago. In the meantime, I've stumbled across Trio and I loved their concept of nurseries, which is basically a wrapper around the threads-and-queues concept that also makes sure that threads are properly joined and do not run out of control.

So today I ran across a case where I'd have to query large chunks of data from two systems in parallel, that I would then have to compare and merge into a third data set. Thus I needed a way to start two threads, return stuff from them to the main thread, and join them back together. A nursery came to mind, because it does just that. So that's what I used, and here's the code for it!

Read more…

Obduction: Dive into the metastory

I want to try something new today: Write about philosophical topics, because those have been catching my interest for a while. I'll start looking into the story of the game Obduction which has caught on to me, so I think it's worth exploring. If you haven't played the game yet, lots'a spoilers ahead, so probably go play it first.

Read more…

Processing Prometheus alerts using NodeRED

I'm currently building some home automation stuff using NodeRED. One of the things I need to do is trigger home automation actions from Prometheus: I'm monitoring our Solar panels using it, and I want the shutters to go down whenever it's sunny outside. I have a Prometheus alert rule that tells me when that is. But how can I trigger NodeRED from there?

As an extra challenge, I wanted to see if I can actually do this without writing a single line of code. I do need a couple more nodes this way, but it works and it's not all that complicated. Here's how it's done.

Read more…

NodeRED-based MQTT Browser

I've recently started building stuff with NodeRED, which I really enjoy. Since I'm using MQTT as the central message bus for my system, I find myself regularly in need of knowing the current state of my MQTT topics. There are a couple of tools around, for instance MQTT.fx, which are specifically built for this purpose; but I found that MQTT.fx likes to cause high CPU load when the topic scanner thingy is running. So I'm looking for an alternative, and I thought, why not build it in NodeRED? So that's what I did.

Read more…