Hello everyone, I wanted to share my experience with integrating the Air Mentor Pro 2 air quality monitor into the SmartThings ecosystem using a Raspberry Pi. This journey was a mix of challenges and triumphs, and I hope my experience can help others who might be looking to achieve something similar.
The Challenge
I purchased the Air Mentor Pro 2 about two years ago for its ability to monitor various air quality parameters like CO2, PM2.5, PM10, VOC, temperature, and humidity. While it worked well for its intended purpose, its reliance on Bluetooth LE for connectivity was a significant drawback. It essentially meant that the device was only useful when I was in the same room as it, which wasn’t ideal for a smart home setup.
The Solution
After some research, I discovered that there was no official Wi-Fi support for the Air Mentor Pro 2. However, I came across a GitHub repository that provided a workaround using a Raspberry Pi. The idea was to use the Raspberry Pi to act as a bridge, connecting the Air Mentor Pro 2’s Bluetooth signals to the SmartThings platform.
The Setup
Here’s a brief overview of what I did:
-
Hardware Requirements
- Raspberry Pi 3 (or higher)
- USB Bluetooth dongle (optional, but recommended for reliability)
- Power supply for the Raspberry Pi
- HDMI cable and monitor (for initial setup)
- Ethernet cable or Wi-Fi for internet connectivity
-
Software Setup
- Installed Raspbian (now Raspberry Pi OS) on the Raspberry Pi.
- Set up Apache2 and PHP to host a simple webpage for data display.
- Installed necessary Python libraries like Bluez, Bluepy, and requests.
-
Python Scripts
- Wrote a Python script to continuously poll the Air Mentor Pro 2’s Bluetooth signals and extract the necessary air quality data.
- Another script to fetch weather data from Weather Underground to provide context for the air quality readings.
-
SmartThings Integration
- Created a Device Handler (DTH) in the SmartThings IDE to represent the Air Mentor Pro 2 in the SmartThings ecosystem.
- Developed a SmartApp to handle the scheduling of data polling and status updates.
-
Web Interface
- Hosted a simple webpage on the Raspberry Pi to display real-time air quality data.
- Configured the SmartThings device to refresh the data periodically using HubAction.
The Outcome
After several weeks of tweaking and testing, the setup worked perfectly! The Air Mentor Pro 2 now seamlessly integrates with my SmartThings ecosystem, providing real-time air quality data that I can monitor from anywhere. The integration also allows me to set up routines and automations based on the air quality readings, such as turning on air purifiers when VOC levels spike.
Tips and Tricks
- Static IP for Raspberry Pi: Ensure your Raspberry Pi has a static IP address on your local network to avoid issues with the HubAction functionality.
- Pollster SmartApp: Use the Pollster SmartApp to schedule regular polling of the Air Mentor Pro 2. This helps overcome a known issue where SmartThings might stop polling after 24 hours.
- Icon Adjustments: I had to adjust the icons for iOS devices to ensure they don’t cover the labels. Android users didn’t face this issue.
Conclusion
This project was a fantastic learning experience, and I’m thrilled with the result. It’s incredibly satisfying to see a device that was initially limited in functionality now being a fully integrated part of my smart home setup. If you’re looking to integrate similar devices, I highly recommend exploring the Raspberry Pi route—it’s powerful, flexible, and surprisingly easy to work with once you get the hang of it!
If anyone has questions or needs assistance with their own setup, feel free to reach out. I’d be happy to help!
Best regards,
Philipp