My setup process to install and configuration of Hassbian to work with SmartThings and HomeBridge
- Mosquitto
- Samba
- SmartThings
- HomeBridge
- Harmony-api
only tested on Raspberry Pi 3 with Hassbian after clean install and you already have home assistant up and running.
sudo raspi-config
sudo apt-get update
sudo apt-get upgrade -y
Development headers for the Avahi Apple Bonjour compatibility library
sudo apt-get install -y libavahi-compat-libdnssd-dev
- More info on hassbian-config
sudo hassbian-config install samba
sudo hassbian-config install mosquitto
Choose username and password in the mosquitto install process and wright them down! They will be use for configure mqtt.
To connect to Samba file sharing from Mac: When on the deasktop go to > Go > Connect to Server... or press [cmd] [K] Insert: smb://hassbian.local/homeassistant And log in as 'gest'
Mosquitto is install through systemctl, you can use: sudo systemctl ['start'/'stop'/'enable'/'disable'] mosquitto
sudo nano /home/homeassistant/.homeassistant/configuration.yaml
## mosquitto mqtt server
mqtt:
broker: localhost
port: 1883
client_id: home-assistant-1
username: user
password: password
sudo systemctl restart [email protected]
chack you can see the 'mqtt' domain in hass services http://localhost:8123/dev-service
Adding the NodeSource APT repository for Debian-based distributions repository AND the PGP key for verifying packages
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
Instructions here: Smarter-Smart-Things-with-MQTT-and-Home-Assistant
only the 'SMARTTHINGS DEVICE' and 'SMARTTHINGS APP' parts.
sudo npm install -g smartthings-mqtt-bridge
sudo smartthings-mqtt-bridge
exit with [ctrl] [c]
this file is automaticly create after first start of 'smartthings-mqtt-bridge'
sudo nano config.yml
host: mqtt://localhost
username: user
password: password
sudo smartthings-mqtt-bridge
sudo mosquitto_sub -u user -P password -v -t '#'
exit both with [ctrl] [c]
sudo npm install -g --unsafe-perm homebridge
sudo npm install -g homebridge-homeassistant
homebridge
exit with [ctrl] [c]
sudo nano /home/pi/.homebridge/config.json # or .homebridge/config.json
{
"bridge":{
"name":"Homebridge",
"username":"CC:22:3D:E3:CE:30",
"port":51826,
"pin":"031-45-154"
},
"platforms":[
{
"platform":"HomeAssistant",
"name":"HomeAssistant",
"host":"http://localhost:8123",
"password": "",
"supported_types":[
"binary_sensor",
"climate",
"cover",
"device_tracker",
"fan",
"group",
"input_boolean",
"light",
"lock",
"media_player",
"scene",
"sensor",
"switch"
],
"logging":true
}
]
}
the ["password": "",] is the password you set for home assistant gui, leave blank if you didn't set one.
homebridge
install Forefer (harmony-api dependency)
sudo npm install forever -g
git clone https://github.com/maddox/harmony-api.git harmony_api
sudo harmony_api/script/bootstrap
sudo nano harmony_api/config/config.json
{
"mqtt_host": "mqtt://localhost",
"mqtt_options": {
"port": 1883,
"username": "user",
"password": "password",
"rejectUnauthorized": false
}
}
Chack harmony api is discovering the hub and publish to mqtt (may take a minute to show)
sudo harmony_api/script/server
sudo mosquitto_sub -u user -P password -v -t '#'
look for somthing like 'harmony-api/hubs/...' exit both with [ctrl] [c]
From your Harmony app, go to: Menu > Harmony Setup > Add/Edit Devices & Activities > Remote & Hub > Enable XMPP.
install mp2 to manage the autostart on boot for the 'smartthings-mqtt-bridge', 'homebridge' and 'harmony-api' servivces
sudo npm install pm2 -g
sudo apt-get update
sudo pm2 start smartthings-mqtt-bridge
sudo pm2 start harmony_api/app.js --name harmony-api
sudo pm2 ls # check everything is green
pm2 start homebridge
sudo pm2 save
pm2 save
sudo pm2 startup
pm2 startup
sudo reboot
sudo mosquitto_sub -u user -P password -v -t '#'
start an activity thru Harmony app search for an update like: 'harmony-api/hubs/harmonylrhub/current_activity tv' turn on a switch in SmartThings app search for an update like: 'smartthings/Living Room Light/switch on'
sudo mosquitto_sub -u user -P password -v -t '#'
sudo nano /home/homeassistant/.homeassistant/configuration.yaml
mosquitto_pub -d -u user -P password -t harmony-api/hubs/harmonylrhub/devices/tadiran-ac/command -m off
sudo pm2 start harmonyapi/app.js --name harmony-api
sudo pm2 ls
sudo dd if=/dev/disk2 of=/Users/[USERNAME]/Desktop/hassbian-backup-$(date +%Y%m%d).img