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-configsudo apt-get update
sudo apt-get upgrade -yDevelopment 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 mosquittoChoose 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: passwordsudo systemctl restart home-assistant@homeassistant.servicechack 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 nodejsInstructions here: Smarter-Smart-Things-with-MQTT-and-Home-Assistant
only the 'SMARTTHINGS DEVICE' and 'SMARTTHINGS APP' parts.
sudo npm install -g smartthings-mqtt-bridgesudo smartthings-mqtt-bridgeexit with [ctrl] [c]
this file is automaticly create after first start of 'smartthings-mqtt-bridge'
sudo nano config.ymlhost: mqtt://localhost
username: user
password: passwordsudo smartthings-mqtt-bridgesudo mosquitto_sub -u user -P password -v -t '#'exit both with [ctrl] [c]
sudo npm install -g --unsafe-perm homebridgesudo npm install -g homebridge-homeassistanthomebridgeexit 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.
homebridgeinstall Forefer (harmony-api dependency)
sudo npm install forever -ggit clone https://github.com/maddox/harmony-api.git harmony_apisudo harmony_api/script/bootstrapsudo 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/serversudo 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 -gsudo apt-get updatesudo 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 startupsudo 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