How to log sensor values to Notion using balena
We found this great project done by Ayan Pahwa at Belena. It is not only inspiring but a great way to get started with numerous technologies.
The Project
I was thinking about habits, and the quote, “What gets measured, gets improved,”; stood out to me. It’s possibly the reason I started tracking my daily habits a couple years ago. I log my routine in a Notion habit-tracking page. It includes things such as ‘what time do I wake up?’ and ‘when do I go to sleep’. It even tracks if I exercised and meditated during a day. I also have it tracking ‘how many cups of coffee have I consumed?’; my screen time, my overall mood, and summary of my day. Last year; I noticed a strange pattern that any day where I had more than 3-4 cups of coffee led to a day of anxiousness. After initial tracking, it turned out to be quite true when I finally cut down on my daily caffeine consumption. Similarly, the days I listen to music are generally the days where I feel motivated and happy. It totally blew away my mind how tightly and intuitively our mood is coupled with our daily habits.

This year; I decided to add more external parameters to my habit tracker with a motive to improve and have better control on my mood and overall lifestyle. I’m going to log values of some sensors such as Temperature, Humidity, and Air Quality; to the same page and see if they could indicate any trends over the coming few months.
How this works
Nowadays, we have better control on our home’s environment thanks to smart thermostats and air purifiers; and I want this data piping into my project. I also decided to add Weather data (fetched from a weather provider API) of my location on the same page, to be aware about the difference of my surroundings and my home environment.Overall, I’m going to add following data to my Habit tracker page:
Data fetched from Weather API
- Outside Temperature (OpenWeatherMap)
- Air Quality (OpenWeatherMap)
Data fetched from Indoor Sensors
- Date (system)
- Indoor Temperature (SenseHAT)
- Indoor Humidity (SenseHAT)
Seeing how Notion released their beta API sometime back. And being a Notion power-user, I’m always looking forward to hacking it; and this project seems perfect to introduce Notion to the world of physical computing. The overall idea is to use the Raspberry Pi sitting on my desk to fetch outside weather data, read values from indoor sensors, and log it to my Habit Tracker Page as a new row every day around 5:00 AM my time (configurable) and the rest of the things like – wake Up time, sleep time, exercise, meditation and caffeine intake, I can add manually on my own. All that said, let’s get to the build.
For the full tutorial: https://www.balena.io/blog/log-sensor-values-to-notion-using-balena/