Awesome Open Source
Awesome Open Source
Overall Setup Icon

Raspberry Pi 3 side:

1. Apache2 and PHP5 properly installed (see here)

Assign a static IP address to your raspberry on your local network. This project works only if your Hub and raspberry are on same network (otherwise the HubAction won't work and you need to implement external HTTPrequest instead)

Optional: 1 USB dongle BT-LE (Plugable Dual-Mode BT-LE/BT model USB-BT4LE) I didn't make it with the internal BT-LE of the Pi using the oringinal image on it, I used this external one then. Then recently, the Raspberry Pi internal BTLE works fine using Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux< image from the Raspberry website (or above)

2. Additional installation on Raspberry:

Bluez (

BluePy (

requests (

netifaces (python -m pip install netifaces)

3. This project files installation:

  • Put in Raspberry /var/www/html folder the file : airmentorpro2.php
  • Put in /home/pi the python script
  • Put in /home/pi the python script (this file uses wlan0 as interface. You can change the code to use eth0 or other)
  • Create a folder "lib" in /home/pi
  • Put in /home/pi/lib the 2 files and
  • This is mandatory the 2 files are in a lib folder and the lib folder at the same location as
  • In /etc/rc.local, just before the exit 0 (last line):
  • add: sudo /usr/bin/python /home/pi/ [your AirMentor MAC] [your hci#] &

    Example: sudo /usr/bin/python /home/pi/ fe:ed:fa:ce:be:ef 0 & 

  • add: /usr/bin/python /home/pi/ &
  • Smarthings IDE side:

  • with a github enabled SmartThings IDE (see here), import the namespace philippeportesppo and repository AirMentorPro2_SmartThings on master branch
  • and the following device handlers and smartapps:


  • AirMentor Pro UPnP Service Manager : the smartapp managing the ssdp discover.
  • IAQ_vent : the smartapp managing vents and AC fans upon air quality notification
  • Notify Me When for AirMentor Pro : the smartapp managing events and notify you about the air quality.
  • Device Handler:

  • Air Mentor Pro 2 : the device handler to access the AirMentor Pro 2
  • If you cannot access github integration, you might have to create the devicehandler and smartapps manually from the code.

    SmartThing Mobile app:

  • Go to Smartapps section and add the AirMentor Pro UPnP Service Manager smartapp from "My Apps"
  • Start the research, few seconds later the pi will be discovered, select it, press next and save.
  • AirMentor Pro 2 will be added


    use pollster smartapp to cadence the polling (every 5min) otherwise, Smartthing known issue will let the DTH stoping the polling after 24h or so.

    Hope you like it.

    Support via PayPal

  • Related Awesome Lists
    Top Programming Languages
    Top Projects

    Get A Weekly Email With Trending Projects For These Topics
    No Spam. Unsubscribe easily at any time.
    Python (821,947
    Php (287,697
    Raspberry (22,366
    Iot (11,982
    Groovy (8,466
    Bt (1,020
    Smartthings (638
    Air Quality (289
    Weather Icons (147
    Pollution (78
    Weather Underground (39
    Smartapp (24
    Device Handler (7
    Dth (4