Shelter-in-Place Journal, Day 192

I’ve been using Indigo for home automation for a couple of years. I haven’t written my own plugins yet (and I hope to avoid doing so), but I have created a few Python scripts to run inside Indigo, and I have set up some fairly complicated trigger/action combinations. So I didn’t expect to have any problems adding a daily Action Group to send the weather to Diane and me.

The Action Group was pretty simple:

Step 1: run a Python program to create the message (combining information from several sources) and write it to a persistent variable in Indigo,

Step 2: send a message with the contents of the variable.

But I kept getting a message with old data – data that had been captured from the previous execution of the action. I added code to the Python program to make sure that the variable was being set properly – it was. I even added a sleep to the Python program to make sure that the new value of the variable had time to propagate – no dice.

I was very confused. I had to take desperate measures: I looked at the online documentation. And there, I discovered that Indigo runs all of the steps in an Action Group in parallel – so the message was being sent before the Python script had had the chance to update the variable. The fix was simple – add a five-second delay to the second step. That’s not five seconds after the first step ends – it’s five seconds from the time the entire Action Group starts.

I’ll have to look at all my other Action Groups and see if I’ve fallen into this trap elsewhere; I suspect that I have, because sometimes, things don’t wind up in the state I expect, and race conditions might well be the cause.

Shelter-in-Place Journal, Day 191

We’ve had the same food processor for a long time – in fact, it came with an instructional video on VHS tape. We didn’t use it very often. Cuisinart recalled the slicing blade in 2016 and the replacement took a long time to arrive – not being able to use the machine didn’t affect our cooking at all.

But that was in the Before Times. Now, we cook at home all the time, and we’ve gotten more adventurous. I find myself grating Parmesan or Pecorino cheese several times a week – I’ve used a Microplane, a box grater, and a rotary grater. All of them work – but they all require a good bit of effort. And, as a programmer, I am professionally lazy.

So today, I decided to dig out the food processor to grate cheese for today’s lunch. It did a fine job, and my hands and wrists didn’t bother me afterwards! And, unlike the manual methods, I didn’t wind up with a couple of millimeters of cheese that I couldn’t grate.

It worked so well that I grated all of the Parmesan and Pecorino in the house – that should hold us for a few weeks.

I wonder what else I’ve been doing the hard way.