Skip to content

Installation

Fredrick Bäcker edited this page Nov 19, 2021 · 9 revisions

There is a couple of ways to get the service to work.

Raspberry PI AutoInstaller

Auto install new or upgrade the project to latest version. You will have the option to allow auto startup at boot.

# Go to folder where to install, e.g. home directory
# This will create and install in ~/broadlink-mqtt-bridge
cd ~/
# NOTE: If you have been running old auto installer, goto folder
# cd /srv/openhab2-conf/

# Run on RPI
bash -c "$(curl -sL https://raw.githubusercontent.com/fbacker/broadlink-mqtt-bridge/master/installers/raspberry.sh)"

# Installation issues? If installing outside home directory run above command with 'sudo'

If auto startup is installed you can control the service with:

// Start
sudo service broadlinkbridge start
// Stop
sudo service broadlinkbridge stop
// Restart
sudo service broadlinkbridge restart
// Status
sudo service broadlinkbridge status

Manually

You can manually install the service and run it on any device.

// install
cd /srv/openhab2-conf/
git clone https://github.com/fbacker/broadlink-mqtt-bridge.git
cd broadlink-mqtt-bridge
npm install

// run it
npm run production

Upgrade to latest version

// To upgrade to latest version
git pull
npm install
// restart service

Autostart on linux

crontab -e
@reboot cd /path-to-service/broadlink-mqtt-bridge && npm run production < /dev/null &

Docker

Running a docker is simple and clutter free. Add path for config and commands. Running as host will use the computers port 3000, 3001.

#Volume /config : folder with a local.json configuration file
#Volume /commands : folder with commands
docker run \
  -v "$PWD/config:/config" \
  -v "$PWD/commands:/commands" \
  --network host \
  fredrickbacker/broadlink-mqtt-bridge

Docker Compose

version: "3.7"
services:
  broadlink-mqtt-bridge:
    image: fredrickbacker/broadlink-mqtt-bridge
    restart: always
    network_mode: host
    volumes:
      - "$PWD/config:/config"
      - "$PWD/commands:/commands"

Home Assistant

  1. Open Supervisor and install Portainer
  2. Disable protection mode and start extension
  3. Open the extension and goto 'containers' and click 'add container'
  4. Set the properties
  • name: broadlink
  • image: fredrickbacker/broadlink-mqtt-bridge:latest
  • Manually network port publishing. host: 3000, container: 3000
  • Manually network port publishing. host: 3001, container: 3001
  1. Click on Volumes and map additional volumes (type: bind)
  • container: /config to /config/.storage/broadlink/config (read only)
  • container: /commands to /config/.storage/broadlink/commands (Writable)

This will start an docker container with broadlink mqtt bridge. Note if running Hassio you need to disable protection mode. SSH into your Hassio and run:

# Go to addons folder
cd addons
# Create broadlink folder for files
mkdir broadlink && cd broadlink
# Create folders to place commands
mkdir commands
# Create folder to place config
mkdir config
# NOTE: See documentation of configuration. To change settings create a local.json file and set values

# Start the container
docker run \
  -v "$PWD/config:/config" \
  -v "$PWD/commands:/commands" \
  --network host \
  fredrickbacker/broadlink-mqtt-bridge
Clone this wiki locally