Giter Club home page Giter Club logo

homeassistant_smarththings_homebridge's Introduction

HomeAssistant_SmarthThings_Homebridge

My setup process to install and configuration of Hassbian to work with SmartThings and HomeBridge

Intgrate to HomeAssistant the following:

  • Mosquitto
  • Samba
  • SmartThings
  • HomeBridge
  • Harmony-api

โš ๏ธ note

only tested on Raspberry Pi 3 with Hassbian after clean install and you already have home assistant up and running.

Installation Instructions

Set up your local and update

sudo raspi-config

'apt-get' Update Preperations

sudo apt-get update
sudo apt-get upgrade -y

Install Avahi (HomeKit Support)

Development headers for the Avahi Apple Bonjour compatibility library

sudo apt-get install -y libavahi-compat-libdnssd-dev

Install Samba and Mosquitto with '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.
If you use the install guide as is, the username is 'user' and password 'password'

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

configure mosquitto-mqtt in homeAssistant conf

sudo nano /home/homeassistant/.homeassistant/configuration.yaml

past this at the end of the file:

## mosquitto mqtt server
mqtt:
  broker: localhost
  port: 1883
  client_id: home-assistant-1
  username: user
  password: password

restart home-assistant

sudo systemctl restart [email protected]

chack you can see the 'mqtt' domain in hass services http://localhost:8123/dev-service

Install node.js 7.x and npm

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 -

install Node.js v7.x and npm

sudo apt-get install -y nodejs

install smartthings-mqtt-bridge (link smartthings devices to hass)

Instructions here: Smarter-Smart-Things-with-MQTT-and-Home-Assistant

only the 'SMARTTHINGS DEVICE' and 'SMARTTHINGS APP' parts.

install smartthings to mqtt bridge (pull devices from SmartThing's 'MQTT Bridge' smartapp)

sudo npm install -g smartthings-mqtt-bridge

run it once

sudo smartthings-mqtt-bridge

exit with [ctrl] [c]

configure smartthings-mqtt-bridge

this file is automaticly create after first start of 'smartthings-mqtt-bridge'

sudo nano config.yml

config mqtt in smartthings-mqtt-bridge

host: mqtt://localhost
username: user
password: password

chack the bridge is publish events

open 2 terminal windows
first:
sudo smartthings-mqtt-bridge

second:

sudo mosquitto_sub -u user -P password -v -t '#'

exit both with [ctrl] [c]

install homebridge (HomeKit suppoot)

sudo npm install -g --unsafe-perm homebridge

install homebridge homeassistant support plugin

sudo npm install -g homebridge-homeassistant

run once

homebridge

exit with [ctrl] [c]

Configure smartthings-mqtt-bridge in homebridge

sudo nano /home/pi/.homebridge/config.json # or .homebridge/config.json

past this:

{
   "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.

run homebridge and chack you get updates from '[HomeAssistant]'

homebridge

Install Harmony API

install Forefer (harmony-api dependency)

sudo npm install forever -g

download harmony api from github

git clone https://github.com/maddox/harmony-api.git harmony_api

Install Harmony API

sudo harmony_api/script/bootstrap

config mqtt in harmony api

sudo nano harmony_api/config/config.json

past this:

{
  "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)

open 2 terminal windows

first:

sudo harmony_api/script/server

second:

sudo mosquitto_sub -u user -P password -v -t '#'

look for somthing like 'harmony-api/hubs/...' exit both with [ctrl] [c]

Install pm2

install mp2 to manage the autostart on boot for the 'smartthings-mqtt-bridge', 'homebridge' and 'harmony-api' servivces

sudo npm install pm2 -g

Update stuff for good practice

sudo apt-get update

Configure pm2 autostart

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

Check everything is working

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'

Useful commands

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

homeassistant_smarththings_homebridge's People

Contributors

gilhaz avatar thecellmc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.