This is huge! Thanks to aptalca for creating an arm based Docker container for the Raspberry Pi that allows ha-bridge to run inside the LibreELEC Docker add-on!
First thing you need to do is ensure your Raspberry Pi LibreELEC has a static IP address so you always know how to get to the ha-bridge web interface.
- Kodi > Programs > LibreELEC configuration > Connections then select your active connection (LAN or Wi-Fi) and use the context menu to select ‘Edit’.
- Scroll to IPV4 and change your IP address settings so they are static by using the Manual settings. Of course, you could always create a DHCP lease in your router if you are savvy with that and that is the better way to go.
If you have more than one media player, I recommended settings them with static IP’s next to each other like xxx.xxx.xxx.201, xxx.xxx.xxx.202 etc. In that way, (if you use Android) you can use the excellent SSH Button app by David Grootendorst to create buttons to easily reboot Kodi from your phone or tablet if Kodi ever hangs. Sadly, I have not found a IOS app that’s as nice.
Second thing you need to do (IMPORTANT) is change the web server port that Kodi is using as the default is port 80 which ha-bridge needs to use in order to be compatible with Google Home.
- Kodi > Settings > Services > Control > Web server and change the port to 8080 (or whatever you like) as long as it’s not 80.
Now you can go ahead and get the Docker add-on for LibreELEC made by the devs at LE.
- Kodi > Add-ons > Install from repository > LibreELEC Add-ons > Services > Docker
- Once installed, use the context menu to edit the settings in Docker if you want Kodi to pop-up notifications when your Docker container starts, stops or otherwise farts. Docker > Settings > Notifications. Either select ‘All’ or ‘Custom’.
Now you’re ready to bring down the Docker image file for ha-bridge and start the container.
- Login to your Raspberry Pi (root:libreelec) and run the following command.
- docker run -d --name="habridge" --restart=always --net="host" -e SERVERIP="your-pi’s-ip-address" -e SERVERPORT="80" -v /storage/downloads/habridge:/config:rw -v /etc/localtime:/etc/localtime:ro aptalca/home-automation-bridge-arm
- Replace “your-pi’s-ip-address with the static IP address of your Pi (do not use localhost as this will prevent ha-bridge from ‘seeing’ devices on your network).
- Replace the "/path/to/config" with your choice of location. For LibreELEC, the path must start with /storage as that is the only location that is writeable.
- If the -v /etc/localtime:/etc/localtime:ro mapping causes issues, you can try -e TZ="<timezone>" with the timezone in the format of "America/New_York" instead. Get your time zone here http://www.timezoneconverter.com/cgi-bin/zoneinfo.
- It will take about 5 mins for your Raspberry Pi to download, extract and install the required components.
- After the installation is finished, the ha-bridge container should be running. Test this using docker ps -a. This will list the running containers showing you the container ID and name (habridge).
- Open a browser and navigate to the IP address of your Pi. You should now see the ha-bridge web interface. If you see the Kodi interface, you did not change the Kodi web server port at the start of this guide. Go back and do that then refresh the web page.
Full and comprehensive instructions on configuring ha-bridge are on the GitHub repository https://github.com/aptalca/docker-ha-bridge. Mad props to BWS Systems, the creators of ha-bridge. It really brings your Amazon Echo or Google Home to life. Additional info on the ha-bridge docker image is on the GitHub repository https://github.com/aptalca/docker-ha-bridge (DO NOT use the instructions on the GitHub repository to download and start your container as those instructions are for x86 based processors).
Some Docker commands for controlling your ha-bridge container
- docker ps -a (list all running containers so you can copy the container ID for use in the next commands)
- docker stop <container ID> or <container name> (e.g. docker stop habridge)
- docker start <container ID> or <container name>
- docker restart <container ID> or <container name> (restarts the container downloading the latest ha-bridge build if necessary)
- docker stats <Container ID> (Show statistics including CPU use. Control + C to exit)
- docker logs <Container ID> (Hopefully you’ve already tried this, but if not, start here. This’ll give you the full STDOUT and STDERR from the command that was run initially in your container).
- docker cp <Container ID>:/path/to/useful/file /local-path
Often just getting hold of more log files is enough to sort you out. If you already know what you want, docker cp has your back. Copy any file from any container back out onto your local machine, so you can examine it in depth.
- docker rm <container ID> (removes the container. Stop it first)
- docker rmi aptalca/home-automation-bridge-arm (removes the complete docker image file). Simply use the ‘docker run -d…’ command above to re-download the image and start a new container.