☰
Current Page
Main Menu
Home
Home
Editing Pixie
Edit
Preview
H1
H2
H3
default
Set your preferred keybinding
default
vim
emacs
markdown
Set this page's format to
Markdown
Plain Text
Pod
RDoc
reStructuredText
Rendering unavailable for
AsciiDoc
BibTeX
Creole
MediaWiki
Org-mode
Textile
Help 1
Help 1
Help 1
Help 2
Help 3
Help 4
Help 5
Help 6
Help 7
Help 8
Autosaved text is available. Click the button to restore it.
Restore Text
--- title: Pixie --- Implements : [Automation Hub][1] Hostname : pixie0 Make : Raspberry Pi 2 Model : B+ Software : Debian Jessie, [Home Assistant][2] Purchased : 2015-05-14 £42 (kit) from CPC Delivered : 2015-05-15 [[_TOC_]] # Static ttyUSB for zwave and rfxcom Aeonlabs Z-Stick S2 is `/dev/ttyUSB21`, Rfxcom is `/dev/ttyUSB22` `/etc/udev/rules.d/99-usb-serial.rules`: SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="ttyUSB21" SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A1XHAXCI", SYMLINK+="ttyUSB22" # RTC <https://raw.githubusercontent.com/piface/PiFace-Real-Time-Clock/master/install-piface-real-time-clock.sh> * Enable I2C * `apt-get install i2c-tools` # Home-Assistant mysql Database CREATE DATABASE hass; GRANT ALL PRIVILEGES ON hass.* TO 'hass'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES; ## Fix Host Blocked error <https://dev.mysql.com/doc/refman/5.7/en/blocked-host.html> mysql> SET GLOBAL max\_connect\_errors=10000; mysql> flush hosts; # OpenZWave ## Upgrading sudo su hass . /srv/hass/hass_venv/bin/activate cd /srv/hass/src/python-openzwave git pull origin cd openzwave git pull origin cd .. make build make install ## Upgrading via python-openzwave Using openzwave dev branch from github: . /srv/hass/hass_venv/bin/activate pip install python_openzwave --install-option="--flavor=dev" --no-deps --ignore-installed --no-cache-dir # [LetsEncrypt][29] Certbot is now installed as a package. ## Renewing 1. Leave nginx running 2. Allow iptables 80 tcp input 3. Enable 80 port forward on router to pixie3 ``` uci show firewall.@redirect[1].name # confirm the key uci set firewall.@redirect[1].enabled=1 uci changes uci commit firewall reload_config ``` 4. Run `sudo certbot renew --nginx` 5. Check cert `openssl x509 -text -in /etc/letsencrypt/live/ha.home.whalebarn.com/cert.pem` 6. Disallow iptables 80 and disable 80 port forward ``` uci show firewall.@redirect[1].name # confirm the key uci set firewall.@redirect[1].enabled=0 uci changes uci commit firewall reload_config ``` 7. Restart nginx ## Renewing from Git (Obsolete) As above except: 1. Run `sudo ~pi/src/letsencrypt/certbot-auto renew --nginx` 2. Check cert `openssl x509 -text -in /etc/letsencrypt/live/ha.home.whalebarn.com/cert.pem` # Fix nginx startup ## Missing `/var/log/nginx` Fails to start after boot because `/var/log/nginx` hasn't been created Add to `/etc/systemd/system/multi-user.target.wants/nginx.service` ExecStartPre=/bin/bash -c 'mkdir -p /var/log/nginx; /usr/sbin/nginx -t -q -g "daemon on; master_process on;"' to create the log dir and run nginx config test New solution. Copy and customize `nginx.service`: [Unit] Description=A high performance web server and a reverse proxy server After=network.target [Service] Type=forking PIDFile=/run/nginx.pid PermissionsStartOnly=true # do the mkdir as root ExecStartPre=-/bin/mkdir -p /var/log/nginx # create log dir, tolerate failure ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;' ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;' ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid TimeoutStopSec=5 KillMode=mixed [Install] WantedBy=multi-user.target ## Can't connect to Upstream Make nginx depend on home-assistant startup. sudo mkdir -p /etc/systemd/system/nginx.service.d sudo vim /etc/systemd/system/nginx.service.d/override.conf Create `/etc/systemd/system/nginx.service.d/override.conf`: [Unit] Wants=home-assistant.service After=home-assistant.service # Python with PyEnv Manage python version upgrades with pyenv. <http://www.knight-of-pi.org/pyenv-for-python-version-management-on-raspbian-stretch/> sudo apt-get install bzip2 libbz2-dev libreadline6 libreadline6-dev libffi-dev libssl1.0-dev sqlite3 libsqlite3-dev -y git clone git://github.com/yyuu/pyenv.git .pyenv echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc . ~/.bashrc System-wide install of 3.8.5: mkdir tmp sudo su # otherwise TMPDIR doesn't affect the pyenv subshell... TMPDIR=`pwd`/tmp .pyenv/plugins/python-build/bin/python-build 3.8.5 /usr/local/python-3.8.5/ # Zwave2Mqtt Chose this over ozwdaemon (which requires a custom build of QT 5.12!) ## Build openzwave Version 1.6+. User `pi` mkdir -p src/open-zwave git clone https://github.com/OpenZWave/open-zwave.git # tag v1.6 failed with gcc 6.3 git checkout -b live master make sudo make install ## Install node and npm User `hass` sudo apt-get install npm # npm config set registry https://registry.npmjs.org # unnecessary? # https://github.com/nebrius/raspi-serial/issues/8 sudo npm install -g npm # upgraded to 6.14.8, old /usr/bin/npm still 1.4.21 sudo npm install -g n sudo n stable # upgraded to node v12.18.4 ## Build zwave2mqtt User `hass` mkdir -p src/zwave2mqtt # though actually I just pushed v4.0.3 and "live" from canard git clone https://github.com/OpenZWave/Zwave2Mqtt npm install # takes a long time because it's freaking 571MB of stuff npm run build ## Other issues * After building with node v8 then upgrading to node v12 had to reinstall fibers `npm install fibers` before doing `npm run build` * More version issues so `npm rebuild` [1]: AutomationHub [2]: http://home-assistant.io [24]: Pixie?action=sourceblock&num=1 [25]: Pixie?action=sourceblock&num=2 [27]: Pixie?action=sourceblock&num=3 [28]: Pixie?action=sourceblock&num=4 [29]: LetsEncrypt [30]: Pixie?action=sourceblock&num=5 [32]: Pixie?action=sourceblock&num=6 [33]: Pixie?action=sourceblock&num=7 [35]: Pixie?action=sourceblock&num=8 [36]: Pixie?action=sourceblock&num=9 [37]: Pixie?action=sourceblock&num=10 <!-- vim: filetype=markdown -->
Uploading file...
Sidebar
# SideBar * [Home][1] * [Projects][2] * * * <!-- --> * [Code][3] * [Tech][4] * [Network][5] * [MediaCentre][6] * [UAV][7] * * * <!-- --> * [Travel][8] * [Music][9] * [Horse Riding][10] * [Study][11] * [Games][12] * [Other Activities][13] * * * <!-- --> * [Car][14] * [House][15] * [Watch][16] * [Clothing][17] * [Miscellany][18] * * * [1]: /Home [2]: /Projects [3]: /Code/Code [4]: /Tech/Tech [5]: /Network/Network [6]: /MediaCentre/MediaCentre [7]: /UAV/UAV [8]: /Travel/Travel [9]: /Music/Music [10]: /HorseRiding/HorseRiding [11]: /Study/Study [12]: /Games/Games [13]: /Do/Do [14]: /Car/Car [15]: /House/House [16]: /Watch/Watch [17]: /Clothing/Clothing [18]: /Miscellany/Miscellany <!-- vim: filetype=markdown -->
Edit message:
Cancel