DEV Community

ChungWei Wei
ChungWei Wei

Posted on • Originally published at kmp.tw on

[IOT] Raspberry Install Home Assistant

Install Dependency

apt-get install -y python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata
Enter fullscreen mode Exit fullscreen mode

Create HA User

useradd -rm homeassistant
Enter fullscreen mode Exit fullscreen mode

Create Virtual ENV

mkdir /srv/homeassistant
chown homeassistant:homeassistant /srv/homeassistant

# Change User
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate
Enter fullscreen mode Exit fullscreen mode

Install HomeAssistant And Package

python3 -m pip install wheel
pip3 install homeassistant
Enter fullscreen mode Exit fullscreen mode

Use hass To Start HA Process

hass
Enter fullscreen mode Exit fullscreen mode

Use Browser Visit http://ha:8123

Trouble Shoot

If You Get When You Run hass

(homeassistant) homeassistant@raspberrypi:~ $ hass
Traceback (most recent call last):
  File "/srv/homeassistant/bin/hass", line 10, in <module>
    sys.exit(main())
.
.
.
.
ImportError: cannot import name 'contextfilter' from 'jinja2' (/srv/homeassistant/lib/python3.7/site-packages/jinja2/__init__.py)
Enter fullscreen mode Exit fullscreen mode

Sulotions

(homeassistant) homeassistant@raspberrypi:~ $ pip uninstall jinja2
Uninstalling Jinja2-3.1.1:
  Would remove:
    /srv/homeassistant/lib/python3.7/site-packages/Jinja2-3.1.1.dist-info/*
    /srv/homeassistant/lib/python3.7/site-packages/jinja2/*
Proceed (y/n)? y
  Successfully uninstalled Jinja2-3.1.1
(homeassistant) homeassistant@raspberrypi:~ $ pip install jinja2==3.0.3
Enter fullscreen mode Exit fullscreen mode

Top comments (0)