SmartThings integration for MyQ Garage Doors and Switches Based on ady642/HomeCloudHub
- 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
- 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
Prerequisites: You must have node and npm installed on your system.
- Run
git clone https://github.com/aromka/myqcontroller.git
from 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
localIP
andlocalSrvPortTCP
- Copy
server/config/config.json.example
toserver/config/config.json
- Open
server/config/config.json
file and setip
andport
variables - Save and close config file
- Run the server
node server
frommyqcontroller
directory - 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
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.local
The 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 npm
Optionally 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 install
Update config.json file
cd ~/Apps/myqcontroller/server/config
cp config.json.example config.json
nano config.json
And 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 -I
Run the server
node server
And update the IP in MyQ Controller SmartApp in the SmartThings app.
You can add a command to your /etc/rc.local
sudo nano /etc/rc.local
and 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 reboot
You can tail the logs to make sure everything works as expected
tail -f /tmp/rc.local.log
-
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.