myqcontroller v1.1.3
MyQController
SmartThings integration for MyQ Garage Doors and Switches Based on ady642/HomeCloudHub
Installation
1. Install the SmartApp
- Go to your SmartThings IDE
- Go to My SmartApps link
- Click on Settings button
- Click Add new repository
- Enter owner
aromka, nameMyQController, branchmaster. - Click Save
- Click on the Update from Repo button
- Select the
MyQController (master)repository Check the application, check Publish, and click Execute Update
2. Install Device Handlers
- Go to My Device Handlers
- Click on Update from Repo button and select
MyQController (master) - Select devices that you want to install (Garage Door, Switch)
- check Publish, and click Execute Update
3. Installing Local Server
Prerequisites: You must have node and npm installed on your system.
- Run
git clone https://github.com/aromka/myqcontroller.gitfrom directory where you want the server installed - Run
npm install - Find out the IP and Port of your SmartThings hub
- either from your router,
- or go to My Hubs in SmartThings IDE and look for
localIPandlocalSrvPortTCP
- Copy
server/config/config.json.exampletoserver/config/config.json - Open
server/config/config.jsonfile and setipandportvariables - Save and close config file
4. Running and Using SmartThings App
- Run the server
node serverfrommyqcontrollerdirectory - Open SmartThings app
- Go to Marketplace -> SmartApps tab
- Scroll down and go to MyApps
- Select MyQ Controller
- Enter the IP of your local server
(This should be pc/mac that's running node server. You can find this out by going to Network Preferences, usually it's something like
192.168.0.5. If you have firewall enabled, make sure to open port42457) - Enter your MyQ username and password (Your credentials are stored in your SmartThings account, and never used or shared outside of this SmartApp)
- Press Next
- If you entered everything correctly, you should see success confirmation message
- Press Done
- Your devices should appear in My Home -> Things
You should also see all the devices that were found, as well as any commands sent in your console running the server
Raspberry Pi setup
Installing on a fresh copy of Raspbian NOOB on Raspberry Pi 3
You can either do this through Raspberry Pi's console, or ssh to it from your mac / pc.
If you want to ssh and run the commands from your mac, the default "Raspbian" OS will automatically broadcast its presence on your network under the mDNS name raspberrypi. If you are using Mac or Linux, you can reach your Pi easily:
ssh pi@raspberrypi.localThe default username for Raspbian is pi and the password is raspberry.
Once you login, update the system and install npm:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get npmOptionally create a folder where you want to store MyQController app
mkdir ~/Apps
cd ~/Apps
git clone https://github.com/aromka/myqcontroller.git
cd myqcontroller && npm installUpdate config.json file
cd ~/Apps/myqcontroller/server/config
cp config.json.example config.json
nano config.jsonAnd set your SmartThings Hub's IP and port. Now run the server. Find out your Raspberry Pi's IP address on your local network (you will need to set it in the app)
hostname -IRun the server
node serverAnd update the IP in MyQ Controller SmartApp in the SmartThings app.
Running the server on the background / after bootup
You can add a command to your /etc/rc.local
sudo nano /etc/rc.localand add the following content right before exit 0
exec 2> /tmp/rc.local.log # send stderr from rc.local to a log file
exec 1>&2 # send stdout to the same log file
set -x # tell sh to display commands before execution
node /home/pi/Apps/myqcontroller/server &This will run the MyQController server after raspberry pi boots up, and will log the output to /tmp/rc.local.log file.
Restart the system
sudo rebootYou can tail the logs to make sure everything works as expected
tail -f /tmp/rc.local.log Known issues
When you PC / Mac restarts when running a node server, you might get a different IP address, so app settings need to be update to assign the new IP.
If you run a server first time, and shortly kill it, and run it again - duplicate devices might be created, as it seems like ST doesn't return newly created devices within first few minutes. You can simply go and delete those duplicate devices to solve this.