Skip to main content

Getting HADashboard up and running on Jessie for use with Home Assistant

HADashboard is a very cool dashboard for use with Home Assistant. I’ve tested the installation process on a Raspberry Pi1 version B (yes I know) and although it took nearly a whole day to get working, work it does and by golly, does it look good. More info on GitHub here https://github.com/home-assistant/hadashboard
  1. First step is to install docker on your Raspberry Pi if you have never done that before:
    curl -sSL get.docker.com | sh
  2. If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like:
    sudo usermod -aG docker pi
  3. Set Docker to auto-start:
    sudo systemctl enable docker
More info here and credit to Alex Ellis http://blog.alexellis.io/getting-started-with-docker-on-raspberry-pi/



Installing HADashboard for Home Assistant on Jessie
  1. Clone the Repository:
    Clone the hadashboard repository to the current local directory on your machine.
    git clone https://github.com/home-assistant/hadashboard.git
  2. Change your working directory to the repository root. Moving forward, we will be working from this directory:
    cd hadashboard
  3. Install the hadashboard docker file:
    Raspberry pi needs to use a different docker build file so the build command is slightly different:
    docker build -f Docker-raspi/Dockerfile -t hadashboard . (Don’t forget the full stop (.) at the end. N.B This took 5hrs on a Pi1 B so be prepared to wait).
  4. Next, in the ./lib directory, copy the ha_conf.rb.example file to ha_conf.rb and edit its settings to reflect your installation, pointing to the machine Home Assistant is running on and adding your api_key.

    $ha_url = "http://10.0.2.17:8123"
    $ha_apikey = "your key"

    $ha_url is a reference to your home assistant installation and must include the correct port number and scheme (http:// or https:// as appropriate)
    $ha_apikey should be set to your key if you have one, otherwise it can remain blank.

    The file also contains example newsfeeds for the News widget:

    $news_feeds = {
      "Traffic" => "http://api.sr.se/api/rss/traffic/2863",
      "News" => http://feeds.bbci.co.uk/news/rss.xml,
    }

    You can leave these alone for now or if you prefer customize them as described in the News widget section here https://github.com/home-assistant/hadashboard#news.
  5. Make a copy of dashboards/example.erb and call it 'main.erb', then edit this file to reference the items you want to display and control and to get the layout that you want. Leave the original example.erb intact and unchanged so that you don't run into problems when trying to update using the git commands mentioned later in "Updating the Dashboard". Full instructions here https://github.com/home-assistant/hadashboard#configuring-the-dashboard-all-installations.
  6. In the directory /home/pi/hadashboard/hapush, copy the hapush.cfg.example file to hapush.cfg then edit it to reflect your environment. This is what mine looks like.

    ha_url = "http://10.0.2.17:8123"
    ha_key =
    dash_host = "10.0.2.17:3030"
    dash_dir="/app/dashboards"
    logfile = "/app/hapush/hapush.log"
  7. You are now ready to run the docker image.
    docker run --name="hadashboard" -d -v /home/pi/hadashboard/dashboards:/app/dashboards -v /home/pi/hadashboard/lib/ha_conf.rb:/app/lib/ha_conf.rb -v /home/pi/hadashboard/hapush:/app/hapush --net=host hadashboard (all in one line)

    You may need to double check your paths are correct for mapping to the dashboards, ha_conf.rb and hapush locations? These are for my Pi with a standard Jessie install.
  8. You should get back something like this meaning your container has at least started:
    0aac704f2093dd10ff0413f0e77c50769c5c569ee25fd57cb67ee1d338e51f3b
  9. You should now be able to go to <ipaddressofyourPi>:3030/main to see the example hadashboard. By default, if you do not append the /main it will load the example file <ipaddressofyourPi>:3030/example
DEBUGGING STEPS
  1. Test your docker instance:
    docker ps -a
  2. This should return:
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
    0aac704f2093        hadashboard         "/bin/sh -c '/app/hap"   About an hour ago   Up 59 minutes                           hadashboard
    You need the “Container ID” for the next step.
  3. Using the container ID, inspect the logs:
    docker logs xxxxxxx (Transpose xxxxxxx with your container ID).
  4. To restart your docker container:
    docker restart <yourcontainerID>
  5. To check all of your file mappings and to make sure everything is supposed to be where it supposed to be, try this:
    docker exec -t -i <yourcontainerID> /bin/bash then,

    ls /app/hapush/ should give you:

    root@raspberrypi:/app# ls /app/hapush/
    hapush.cfg  hapush.cfg.example  hapush.log  hapush.py
    root@raspberrypi:/app#

    ls /app/dashboards should give you:

    root@raspberrypi:/app# ls /app/dashboards
    example.erb  layout.erb  main.erb
    root@raspberrypi:/app#
  6. Navigate to /home/pi/hadashboard/hapush/hapush.log using WinSCP to see what is going on. If everything is OK, there should only be two lines:

    2016-10-18 21:48:27,891 INFO Reading dashboard: /app/dashboards/main.erb
    2016-10-18 21:48:27,948 INFO Reading dashboard: /app/dashboards/example.erb
For the more adventurous out there that even know what a docker-compose.yaml file is, user @snizzleorg has provide some information on starting the docker containers using a better method. More info here https://github.com/home-assistant/hadashboard#starting-at-reboot


“I personally prefer docker-compose to create and run the images:
This is my docker-compose.yaml file for hadashboard:”
---
home-assistant:
  build: Dockerfile-rpi
  restart: always
  net: "host"
  volumes:
    - '/etc/localtime:/etc/localtime:ro'
    - '/etc/timezone:/etc/timezone:ro'
    - '/etc/home-assistant/hadashboard/dashboards:/app/dashboards
    - '/etc/home-assistant/hadashboard/config/:/app/lib/
    - '/etc/home-assistant/hadashboard/hapush/:/app/hapush/


Good luck and may the force be with you.
Post your issues in GitHub here https://github.com/home-assistant/hadashboard/issues

Comments

  1. I'm looking to do this and don't really know what I'm doing so I was looking for a guy to like this. Issue I'm having is with the following step:

    Install the hadashboard docker file:
    Raspberry pi needs to use a different docker build file so the build command is slightly different:
    docker build -f Docker-raspi/Dockerfile -t hadashboard . (Don’t forget the full stop (.) at the end. N.B This took 5hrs on a Pi1 B so be prepared to wait)

    When I type that in my response back is cannot connect to the docker Daemon is the doctor Damon running on this host? Any idea what's going on there?

    ReplyDelete
    Replies
    1. Do you install Docker per steps 1, 2 and 3?

      Delete
    2. This is a bit old, but for others in the future the docker commands must be run with sudo. Otherwise you will get the above error.

      Delete
  2. Hmmm, Step 7 crashes for me, and of course, I don't know what I'm doing:

    Unable to find image 'hadashboard:latest' locally
    Pulling repository docker.io/library/hadashboard
    docker: Error: image library/hadashboard:latest not found.
    See 'docker run --help'.

    ReplyDelete

Post a Comment

Popular posts from this blog

Using ESPEasy with Home Assistant via MQTT

Preface: I've just started playing around with Home Assistant on a Raspberry Pi and exploring the world of MQTT to control devices on the network. Learning curve is a bit steep but worth the effort as MQTT is very fast. The hardware and software tools I'm using are as follows: 2 x Sonoff relay units 2 x NodeMCU Boards ESPEasy firmware (must be version 121 or above as that contains the MQTT 'retain' flag option. Home Assistant software on Raspberry Pi2 MQTT Test Software: PC: MQTT.fx Android: MQTT Dashboard

My Notepad++ tricks when editing YAML files in Home Assistant

To comment out a whole section in one go: Highlight the text you want to comment out and use CTRL + Q. If you do this at the start of a line, it will only comment that line. CTRL + Q is toggle mode (comment on/off). CTRL + K will allow you to add multiple comments one after the other.

Installing ha-bridge on your Raspberry Pi

EDIT: Updated 14th June 2017 to reflect version 4.5.5. Default port is now 80 to keep Google Home happy and service now supports MQTT! Advice on backups also added 7th Feb. Version 4x also supports adding a Home Assistant instance which is great! Want to control your Vera, Harmony hub or Home Assistant entities with your Amazon echo or Google Home? ha-bridge is the best way to achieve that and installation is actually quite easy and takes less than 5 minutes. Here are the steps.