sensor2notion
I build this project for my personal use case, but feel free to adopt it for your's.
An year ago I started tracking my habits in a Notion database, things such as- What time I woke up? and went to bed? My total screen time. If I exercised and listened to Music in a day, how many cups I had in a day and what was my overall mood throughout the day.
I noticed any day where I had more then 3 cups of coffee or had coffee after 7PM that day I felt really anxious, it was later verified once I cut down my caffeine intake. With this project I want to add few more things in that database such as Temperature, Humidity and Air Quality with a hope to find some patterns in order to better improve my habits and lifestyle.
- Fetch outside temperature and Air Quality of your area from OpenWeatherMap API(free tier subscription should be more than enough).
- Fetch Inside temperature and Humidity using sensors
- Upload this as entry to your habit tracking DB with a date and other fields as new row every morning at 5AM UTC every morning, can be override using
TIME
env variable
I've created a small Notion template here which you can adapt for your use case. just click the hyperlink and duplicate into your notion workspace.
- A Raspberry Pi computer
- 16GB Micro-SD Card (recommended Sandisk Extreme Pro SD cards)
- 5v Power supply
- Raspberry Pi SenseHAT (currently supported)
- balenaCloud account (free)
- Notion Integration (free) -- go to developers.notion.com > create an integration with write access and invite that intergation to your notion page using share button
- balenaEtcher (optional)(free) - to flash the SD card with balenaOS
- balenaCLI (optional)(free) - if using balena push to deploy the fleet
You can deploy this app to a new balenaCloud fleet in one click using the button below:
Or, you can create a fleet in your balenaCloud dashboard and balena push
this code to it, the traditional way.
The following Device Configuration variables are required, these can be set at balenaCloud dashboard :
Name | Value |
---|---|
WEATHER_API_KEY | API key received after signing up on http://openweathermap.org/ |
TEMP_UNIT | default is metric but can imperial or kelvin |
LAT | Latitude of your location |
LON | Longitude of your location |
NOTION_API_KEY | API key received from notion |
DATABASE_ID | Page ID of notion database |
TIME | Time at which new notion row is created with data every day (default 05:00 AM UTC) |