Disclosure: We earn a commission from some links on this page. Details
Add a real button to Home Assistant
One press for "movie mode" or "goodnight", from a button you built.
Drafted with AI assistance, fact-checked and approved by RackedPrice.
- Plug a Qwiic Button into your Pi with a Qwiic cable.
Install SparkFun's Qwiic Button Python library, linked from its page.
Into the same sensors folder as our room sensor how-to sets up.
~/sensors/bin/pip install sparkfun-qwiic-button- Run its example. Pressing the button prints a message.
Send the press to Home Assistant over MQTT, like the room sensor does.
Set up MQTT as in the room sensor how-to. Then publish a message like
pressedto a topic likehome/office/buttoneach time it's pressed.In Home Assistant, make the press run a scene.
Settings > Automations & scenes > Create automation. Trigger: MQTT, topic
home/office/button. Action: Scene, activate, and pick yours.
Want every detail? Read the full guide
Build the whole project
Temperature, humidity and real CO2 readings in Home Assistant from plug-in SparkFun sensors on a Raspberry Pi, plus an optional status screen and power monitoring.
What you'll need
- Qwiic Button (red light)Check price at SparkFun
- Qwiic pHAT v2.0Check price at SparkFun
- Qwiic Cable KitCheck price at SparkFun
SparkFun doesn't share prices with us, so check the price on its page.
More make and tinker how-tos
Set up your first Raspberry Pi
A tiny computer for learning, projects and small home servers.
30 minutesPlug sensors into a Pi (no soldering)
SparkFun's Qwiic cables click in one way only. No soldering, no wiring mistakes.
20 minutesMake a room temperature sensor
See a room's temperature and humidity in Home Assistant, from a sensor you put together.
1 hour