Home Assistantが動かない!
特に、Androidアプリはエラー画面が出て前に進みません。
Python環境をアップデートして動かなくなったのかしら?
と、思いましたが、PCのブラウザからアクセスすると、単に証明書の期限切れでアクセスできなかったようです。
そこで、証明書をコピーしてからhomeassistantデーモンが起動するように、起動スクリプトを変更するとともに、cronで週1回再起動するように仕込みます。
まず、Gentooなので、/etc/local.d配下にスクリプトを配置していますので、そこを書き換えます。
また、コピー元フォルダはLet's Encryptを利用している前提で記載しています。
(hogehoge.netがドメイン名ですね。)
/etc/local.d/homeassistant.start
#!/bin/sh /bin/cp -Lf /etc/letsencrypt/live/hogehoge.net/privkey.pem /home/homeassistant/.homeassistant /bin/cp -Lf /etc/letsencrypt/live/hogehoge.net/fullchain.pem /home/homeassistant/.homeassistant /bin/chown homeassistant:homeassistant /home/homeassistant/.homeassistant/privkey.pem /bin/chown homeassistant:homeassistant /home/homeassistant/.homeassistant/fullchain.pem /bin/chmod 600 /home/homeassistant/.homeassistant/privkey.pem /bin/chmod 600 /home/homeassistant/.homeassistant/fullchain.pem sudo -u homeassistant -H /home/homeassistant/bin/hass --pid-file /home/homeassistant/hass.pid --daemon > /var/log/home-assistant.log 2>&1 echo "Homeassistant Started"
さらに、週に1回homeassistantを再起動させます。
/etc/cron.weekly/homeassistant.sh
#!/bin/sh /etc/local.d/homeassistant.stop sleep 1 /etc/local.d/homeassistant.start
これで、証明書問題でHome Assistantアプリが起動しない! なんてことがなくなるハズです。