Showing posts with label Home Assistant. Show all posts
Showing posts with label Home Assistant. Show all posts

26 January, 2020

Setting up Home Assistant on Raspberry Pi using generic Linux host method



Recently my installation of Home Assistant died. It appears that I burned up the SD card. I can no longer read the SD Card. When I run gparted against the SD card, the card mounts in read-only mode. After a bit of research, I came up with a plan.

Rough Plan


  • Install the latest Raspbian Buster image
  • Reconfigure the Pi to run from a hard drive
  • Install Home Assistant using the generic Linux host method

Steps

  • Downloaded Raspbian Buster with desktop from the Raspberry Pi website
  • Using balenaEtcher to flash Buster to an SD card (8GB)
  • Booted the Pi for the first time
  • Setup the language, keyboard, and timezone. 
    • Changed the pi user's password
    • Selected the WiFi network
    • Updated the software
  • Updated the packages
    • sudo apt update
    • sudo apt upgrade
    • sudo reboot
  • Followed the directions from the blog post 'Quick SD to SSD on the pi 4'
    • use the utility 'SD Card Copier' to copy the SD card to the hard drive
    • run 'sudo blkid' to get the UUID of the SD sard and the hard drive
    • backup the file /boot/cmdline.txt
    • edit the file /boot/cmdline.txt. Change the partuuid from using the SD card to the hard drive
    • reboot
    • Note: must leave the SD card in the Raspberry Pi
  • Changed the hostname of the Pi
  • Enabled SSH on the Pi
  • Setup ssh key on my main PC
    • ssh-keygen
    • ssh-copy -i ~/.ssh/key-name pi@ip.address
    • ssh-add
  • Disable Password Authentication on the Pi
    • sudo nano /etc/ssh/sshd_config
      • Uncommented the line 'PasswordAuthentication yes'
      • changed yes to no
  • Set a static IP for the Pi
    • edit /etc/dhcpcd.conf
      • added
        • interface wlan0
        • static ip_address=XXX.XXX.XXX.XXX
        • static routers=XXX.XXX.XXX.XXX
        • static domain_name_servers=XXX.XXX.XXX.XXX
    • reboot
  • Changed Pi Configuration to boot to cli
  • Followed the directions from the blog post 'Install Docker and Docker Compose on Raspberry pi 4(Raspbian Buster)'
    • curl -sSL get.docker.com | sh
    • sudo usermod -aG docker pi
    • sudo apt-get install libffi-dev libssl-dev
    • sudo apt install python3-dev
    • sudo apt-get install -y python3 python3-pip
    • sudo pip3 install docker-compose
  • Followed installer for a generic Linux system
    • sudo apt install bash
    • sudo apt install jq
    • sudo apt install curl
    • sudo apt install avahi-daemon
    • sudo apt install dbus
    • sudo apt install apparmor-utils
  • curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s -- -m raspberrypi4-64
  • Setup Home Assistant
There was an issue with Home Assistant connecting to the internet. I removed the changes to /etc/dhcpcd.config. This seems to have helped. 

02 September, 2019

Setting up Home Assistant

What is Home Assistant?

"Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server." - https://www.home-assistant.io

I like to think of Home Assistant as the central hub to connect and control devices around my home. Most of the home automation items (light bulb and light switches) are just fancy remote-controlled devices. The hub should give me a way to control devices from different vendors, a way to step automations (turn on lights when at certain times), and a little future-proofing. 

Why Home Assistant?

Basically three reasons, the first is I have a Raspberry Pi 3B+ not dedicated to anything yet. The second is the price of Home Assistant. Lastly, I want the ability to tinker with the software.

Setup


  • Downloaded install image 
    • Raspberry Pi 3 Mobel b and B+ 64bit
  • Used GParted to repartition an old 32GB SD card
  • Flashed the image to the SD card
  • Connected or inserted the Raspberry Pi to 
    • Monitor
    • Keyboard
    • Mouse
    • Network - hard wire for now
    • the newly flashed SD card
    • power
  • Wait
    • This can take a while
      • Allow 20 or so minutes 
      • An updated version of the software is being downloaded and installed
      • I got the message 'IPv6: ADDRCOF(NETDEV_UP): wlan0: link is not ready'. 
        • I cycled the power to the Pi.
        • Same message appeared
        • hit return a few times
        • got a login prompt
        • the default username is root

  • Add wireless
    • Using the info from 'Using nmcli to set a static IPV4 address'
    • Got to Hassio login prompt then ran the following commands
      • login
      • nmcli connection show
      • nmcli radio
      • nmcli device
      • nmcli device wifi rescan
      • nmcli device wifi list
      • nmcli device wifi connect {SSID Nane} password {password}
      • nmcli device 
      • nmcli con edit "{connection Name}"
        • print ipv4
        • set ipv4.addresses {IP of my choice}
        • set ipv4.dns {DNS address}
        • set ipv4.gateway {gateway address}
        • save
        • print ipv4
        • quit
      • nmcli con reload
    • rebooted the Pi
      • unplugged the hardwire
      • Tested wireless
        • navigated to {IP}:8123
  • First-time setup
    • After navigating to IP:8123
    • followed prompts on the screen

Resources

Home Assistant


balenaEtcher
GParted
nmcli

Challenging myself to learn something new

I have recently set a big challenge for myself. I want to know about Machine Learning . To add to the challenge, I am trying out usin...