Keeping it cool: How one engineer uses Contentful to control a fridge in Argentina

Blog header with lightbulb
September 19, 2019


We often talk about how Contentful can do anything and everything. Its flexibility enables you to design your own content models and deliver content to any channel. But what are some of the very edge cases of how to use Contentful? In this post, I’ll describe one unexpected way I used Contentful to solve a very real problem for my father.

Let's start with a bit of context

Let me tell you a story about my dad. My dad is a cardiologist and has been doing medical research for the past 20 years. Two years ago, he decided he wanted more independence. He didn't want to run his practice under the umbrella of another institution, so he opened his own private practice with a colleague.

Opening a private practice for medical research is no easy task. Medical research is highly regulated in my home country of Argentina. A private practice must meet a lot of security and safety regulations before opening to the public.

One big requirement is making sure that the fridges and freezers storing medical samples and prescription drugs are always running. You must be able to prove that action can be taken to preserve their contents in case of power disruptions. Medications and samples exposed to heat go bad quickly; it's an important matter for patient safety and wellbeing. Without the precautions in place, you can’t get approval to run your practice.

This is extremely hard to monitor directly. And the companies doing this kind of monitoring charge thousands upon thousands of dollars every month. It's impossible for small private practices to pay for those services, which means they often can’t open.

We needed to find a solution.

The engineering son to the rescue

After hearing about my father's problem, I started thinking about how we could monitor the status of the electricity in his practice. An idea came to me: we can monitor the power by proxy.

If we monitored something else that requires reliable power, and we detect if that connection is lost, it means one of two things: either there is a problem with the proxy or there really is a problem with the electrical power. For cases of malfunction or disconnection with the proxy, we would get a false positive. But who cares about a few false positives if we're saving thousands of dollars every month! It was a small price to pay for such big savings.

We decided to keep track of internet connectivity as our proxy. We rely upon the internet almost as much as electricity. Perhaps even more so in daylight hours; we’re more likely to notice the internet is off than the lights when the sun is up. Keeping track of internet connectivity would be pretty close to keeping track of electrical power.


To implement this, I used some simple components:

I’ve spent about $100 since the day I set it up almost two years ago. Compared to thousands of dollars per month, the cost makes a lot of sense.

On our RaspberryPi, we run a scheduled job that pings one of our two Lambda functions. This is called the "liveliness check," and it reoccurs every five minutes.

On AWS, the two Lambda functions are orchestrated via the serverless framework. One has an API Gateway to receive the "liveliness check," and the other is on a two minute schedule to check whether the liveliness probe has been sent in the past ten minutes.

How is the "liveliness check" performed, and what does Contentful have to do with it?

Contentful is the centralized and decoupled service that stores the "liveliness check" information, as well as the configuration for the service.

Why store the service configuration in Contentful? My dad's practice is in Argentina, and I live in Berlin. I needed to be able to change the configuration on the fly, remotely and reliably. The "liveliness check" stores the timestamp of the successful call and a randomly generated token. This all sounds pretty reasonable. But here’s the fun part: It’s entirely managed by a single entry that’s always in draft mode.

If you want to learn more about how this is actually implemented (and read a tiny bit of spanish), you can check out the code.


Even though we’ve had about ten false positives over the past two years, we've saved tens of thousands of dollars while successfully meeting the safety criteria required by the Argentinian government. It’s been effective in every way, and my father can run his practice without prohibitive costs.

It doesn't matter how unrealistic your idea may be, or how much it may seem like an edge case. If you think it will solve an actual problem then you might as well try it out and see if it works! You might just save yourself a lot of time, energy and money.

Give it a go — request a Contentful demo.

About the author

Don't miss the latest

Get updates in your inbox
A monthly newsletter to help you build better digital experiences with Contentful.
add-circle remove subtract-circle