This is huge! Thanks to aptalca for creating an arm based Docker container for the Raspberry Pi (and Odroid C2!) 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.
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.
Some Docker commands for controlling your ha-bridge container
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.
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.
- 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’.
- 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.
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-pathOften 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.
- Additional info about removing Images and Containers can be found here https://tecadmin.net/remove-docker-images-and-containers/
Comments
Post a Comment