Skip to content

Integration of Co-Asia/Air-Mentor Pro 2 into SmartThings environment over BT-LE using Raspberry Pi and Weather Underground weather forecasts.

Notifications You must be signed in to change notification settings

philippeportesppo/AirMentorPro2_SmartThings

Repository files navigation

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:

3. This project files installation:

  • Put in Raspberry /var/www/html folder the file : airmentorpro2.php
  • Put in /home/pi the python script airmentorpro2.py
  • Put in /home/pi the python script ssdp_server.py (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 ssdp.py and upnp_http_server.py.
  • This is mandatory the 2 files are in a lib folder and the lib folder at the same location as ssdp_server.py
  • In /etc/rc.local, just before the exit 0 (last line):
  • add: sudo /usr/bin/python /home/pi/airmentorpro2.py [your AirMentor MAC] [your hci#] &

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

  • add: /usr/bin/python /home/pi/ssdp_server.py &
  • 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:

    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

    IMPORTANT:

    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