2024-06-03
This commit is contained in:
227
_-Review/home-assistant.md
Normal file
227
_-Review/home-assistant.md
Normal file
@ -0,0 +1,227 @@
|
||||
---
|
||||
type: "topic"
|
||||
created: "2024-01-06T01:25:36.065Z"
|
||||
updated: "2024-01-06T01:25:36.065Z"
|
||||
---
|
||||
|
||||
# Home Assistant
|
||||
|
||||
```bash
|
||||
wsl --export Ubuntu "Ubuntu\Ubuntu-Home-Assistant-001.tar"
|
||||
wsl --unregister Ubuntu
|
||||
wsl --import Ubuntu-Home-Assistant Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-001.tar"
|
||||
wsl --export Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-002.tar"
|
||||
del "Ubuntu\Ubuntu-Home-Assistant-002.tar"
|
||||
```
|
||||
|
||||
```yaml
|
||||
Name: Ubuntu-Home-Assistant
|
||||
Command Line: wsl.exe -d Ubuntu-Home-Assistant
|
||||
Tab Title: Ubuntu-Home-Assistant
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo -i
|
||||
apt-get update
|
||||
ip a
|
||||
lsb_release -a
|
||||
apt-get install links unzip nginx git nano ncdu -y
|
||||
ncdu
|
||||
timedatectl set-timezone America/Phoenix
|
||||
timedatectl
|
||||
nano /etc/hosts
|
||||
nano /etc/nginx/sites-available/default
|
||||
echo >/etc/nginx/sites-available/default && nano /etc/nginx/sites-available/default
|
||||
```
|
||||
|
||||
```conf
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
root /var/www/html;
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
server_name _;
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
}
|
||||
server {
|
||||
ssl_certificate 'laundry.phares.myftp.org.crt';
|
||||
ssl_certificate_key 'laundry.phares.myftp.org.key';
|
||||
listen 443 ssl http2;
|
||||
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name laundry.phares.myftp.org;
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://localhost:80/;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
}
|
||||
server {
|
||||
ssl_certificate 'laundry.phares.myftp.org.crt';
|
||||
ssl_certificate_key 'laundry.phares.myftp.org.key';
|
||||
listen 443 ssl http2;
|
||||
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name home-assistant.laundry.phares.myftp.org;
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://localhost:9400/;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
nano /home/mike/laundry.phares.myftp.org.conf
|
||||
echo >/home/mike/laundry.phares.myftp.org.conf && nano /home/mike/laundry.phares.myftp.org.conf
|
||||
```
|
||||
|
||||
```conf
|
||||
[req]
|
||||
default_bits = 2048
|
||||
default_keyfile = laundry.phares.myftp.org.key
|
||||
distinguished_name = req_distinguished_name
|
||||
req_extensions = req_ext
|
||||
x509_extensions = v3_ca
|
||||
|
||||
[req_distinguished_name]
|
||||
countryName = Country Name (2 letter code)
|
||||
countryName_default = US
|
||||
stateOrProvinceName = State or Province Name (full name)
|
||||
stateOrProvinceName_default = Arizona
|
||||
localityName = Locality Name (eg, city)
|
||||
localityName_default = Anthem
|
||||
organizationName = Organization Name (eg, company)
|
||||
organizationName_default = Phares
|
||||
organizationalUnitName = organizationalunit
|
||||
organizationalUnitName_default = Development
|
||||
commonName = Common Name (e.g. server FQDN or YOUR name)
|
||||
commonName_default = laundry.phares.myftp.org
|
||||
commonName_max = 64
|
||||
|
||||
[req_ext]
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[v3_ca]
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[alt_names]
|
||||
DNS.1 = laundry.phares.myftp.org
|
||||
DNS.2 = dashkiosk.laundry.phares.myftp.org
|
||||
DNS.3 = gogs.laundry.phares.myftp.org
|
||||
DNS.4 = nextcloud.laundry.phares.myftp.org
|
||||
DNS.5 = photoprism.laundry.phares.myftp.org
|
||||
DNS.6 = pi-hole.laundry.phares.myftp.org
|
||||
DNS.7 = syncthing.laundry.phares.myftp.org
|
||||
DNS.8 = mike.desktop
|
||||
DNS.9 = desktop-h6jg91b
|
||||
DNS.10 = localhost
|
||||
DNS.11 = 127.0.0.1
|
||||
```
|
||||
|
||||
```bash
|
||||
ls /etc/nginx
|
||||
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/laundry.phares.myftp.org.key -out /etc/nginx/laundry.phares.myftp.org.crt -config /home/mike/laundry.phares.myftp.org.conf
|
||||
ls /etc/nginx
|
||||
nginx -t
|
||||
systemctl restart nginx
|
||||
nginx -s reload
|
||||
exit
|
||||
exit
|
||||
```
|
||||
|
||||
```bash
|
||||
wsl --export Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-002.tar"
|
||||
wsl --unregister Ubuntu-Home-Assistant
|
||||
wsl --import Ubuntu-Home-Assistant Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-002.tar"
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo -i
|
||||
python3 --version
|
||||
apt install software-properties-common
|
||||
add-apt-repository ppa:deadsnakes/ppa
|
||||
[enter]
|
||||
apt update
|
||||
apt-get install -y python3 python3-dev python3-venv python3-pip bluez libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libturbojpeg0-dev tzdata ffmpeg liblapack3 liblapack-dev libatlas-base-dev
|
||||
apt install python3.12 -y
|
||||
ls /usr/bin/python3*
|
||||
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
|
||||
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2
|
||||
update-alternatives --config python3
|
||||
[enter]
|
||||
python3 --version
|
||||
apt install libpython3.12-dev -y
|
||||
apt-cache rdepends python3.12
|
||||
# apt-get install -y libtiff6
|
||||
# apt install python3.10-venv
|
||||
# apt-add-repository universe
|
||||
# apt-get update
|
||||
# apt-get install virtualenv
|
||||
# apt install python3.11-venv
|
||||
apt install python3.12-venv -y
|
||||
# apt install python3.13-venv
|
||||
apt-get install libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev -y
|
||||
apt install pkg-config -y
|
||||
useradd -rm homeassistant
|
||||
mkdir /srv/homeassistant
|
||||
chown homeassistant:homeassistant /srv/homeassistant
|
||||
passwd homeassistant
|
||||
exit
|
||||
exit
|
||||
```
|
||||
|
||||
```bash
|
||||
wsl --export Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-003.tar"
|
||||
wsl --unregister Ubuntu-Home-Assistant
|
||||
wsl --import Ubuntu-Home-Assistant Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-003.tar"
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo -u homeassistant -H -s
|
||||
cd /srv/homeassistant
|
||||
python3 -m venv .
|
||||
source bin/activate
|
||||
pip install --upgrade pip
|
||||
python3 -m pip install wheel
|
||||
pip3 install homeassistant
|
||||
pip3 install homeassistant
|
||||
pip install av
|
||||
pip install ha-av
|
||||
exit
|
||||
exit
|
||||
```
|
||||
|
||||
```bash
|
||||
wsl --export Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-004.tar"
|
||||
wsl --unregister Ubuntu-Home-Assistant
|
||||
wsl --import Ubuntu-Home-Assistant Ubuntu-Home-Assistant "Ubuntu\Ubuntu-Home-Assistant-004.tar"
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo -u homeassistant -H -s
|
||||
cd /srv/homeassistant
|
||||
python3 -m venv .
|
||||
source bin/activate
|
||||
hass
|
||||
# You can now reach your installation via the web interface on http://homeassistant.local:8123.
|
||||
```
|
||||
|
||||
```bash
|
||||
# https://www.youtube.com/watch?v=O7pC1oI86gg
|
||||
# https://tasmota.github.io/docs/About/
|
||||
# https://www.youtube.com/watch?v=fgeZ1O6J4jc
|
||||
# https://www.youtube.com/watch?v=CYvTLw_Wn6I
|
||||
# https://python-kasa.readthedocs.io/en/latest/smartdevice.html
|
||||
# https://zigbee.blakadder.com/plugs.html
|
||||
```
|
Reference in New Issue
Block a user