Added Hass CT

This commit is contained in:
2021-10-06 16:23:37 +00:00
parent d524353b3f
commit b5d5531133
5 changed files with 100 additions and 3 deletions

View File

@@ -331,6 +331,13 @@ files:
variants: variants:
- mqtt - mqtt
#FileForMqtt
- path: /opt/Setup
generator: copy
source: CT-Files/hass
variants:
- hass
packages: packages:
manager: apk manager: apk
update: true update: true
@@ -459,6 +466,29 @@ packages:
variants: variants:
- mqtt - mqtt
#PKGS for Hass
- packages:
- git
- python3
- py3-virtualenv
- py3-pip
- python3-dev
- ca-certificates
- libffi-dev
- libressl-dev
- nmap
- iputils
- build-base
- tzdata
- sudo
- jpeg-dev
- zlib-dev
- bash
- mariadb-connector-c-dev
action: install
variants:
- hass
repositories: repositories:
- name: /etc/apk/repositories - name: /etc/apk/repositories
url: |- url: |-
@@ -529,6 +559,7 @@ actions:
- nodered - nodered
- nextcloud - nextcloud
- mqtt - mqtt
- hass
# Enable service for iscsi CT # Enable service for iscsi CT
- trigger: post-files - trigger: post-files

View File

@@ -0,0 +1,31 @@
#!/sbin/openrc-run
CONFIG_DIR=/opt/HomeAssistant/data/
USER=hass
GROUP=hass
PIDFILE=/var/run/homeassistant/homeassistant.pid
CMD="/opt/HomeAssistant/srv/bin/hass"
ARGS="-c ${CONFIG_DIR} --pid-file ${PIDFILE}"
depend() {
use dns
}
start() {
mkdir -p /var/log/homeassistant
chown -R ${USER}.${GROUP} /var/log/homeassistant
mkdir -p /var/run/homeassistant
chown -R ${USER}.${GROUP} /var/run/homeassistant
ebegin "Starting ${SVCNAME}"
start-stop-daemon --pidfile $PIDFILE -u $USER -g $GROUP -b \
-1 /var/log/homeassistant/homeassistant.log \
-2 /var/log/homeassistant/homeassistant.log \
-x $CMD -- $ARGS
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --pidfile $PIDFILE -u $USER -g $GROUP -x $CMD -K -q
eend $?
}

View File

@@ -0,0 +1,25 @@
#!/bin/ash
#Install HomeAssistant
mkdir -p /opt/HomeAssistant/srv
mkdir -p /opt/HomeAssistant/data
touch /opt/HomeAssistant/data/home-assistant.log
addgroup hass
adduser -h /opt/HomeAssistant/data -D -G hass -s /bin/sh hass
chown -R hass:hass /opt/HomeAssistant
sudo -u hass python3 -m venv /opt/HomeAssistant/srv
sudo -u hass sh -c '. /opt/HomeAssistant/srv/bin/activate && pip install --upgrade pip && pip3 install wheel mysqlclient && pip3 install homeassistant'
#Install Home Assistant Community Store
sudo -u hass sh -c 'cd /opt/HomeAssistant/data && wget -O - https://get.hacs.xyz | bash -'
#Update script
mv /opt/Setup/Scripts/UpdateHASS.sh /opt/UpdateHASS.sh
#CleanUp
rm -rf /opt/HomeAssistant/data/.cache/*
rm -rf /build/TMP/usr/lib/python3.9/__pycache__/*
#Setup HomeAssistant service
mv /opt/Setup/Configs/hass.service /etc/init.d/hass
chmod +x /etc/init.d/hass
rc-update add hass

View File

@@ -0,0 +1,4 @@
#!/bin/ash
service hass stop
sudo -u hass sh -c '. /opt/HomeAssistant/srv/bin/activate && pip install --upgrade pip && pip3 install --upgrade homeassistant'
service hass start

View File

@@ -39,12 +39,13 @@ This can be done on a Minimal debian CT (make sure to enable nesting) on the new
| nodered | Alpine | Node-Red | | nodered | Alpine | Node-Red |
| nodejs | Alpine | Basic nodejs install with pm2 | | nodejs | Alpine | Basic nodejs install with pm2 |
| mqtt | Alpine | Mosquitto mqtt broker | | mqtt | Alpine | Mosquitto mqtt broker |
| hass | Alpine | HomeAssistant instance with HACS and mysql support |
## TODO ## TODO
**Begin original list** **Begin original list**
Hass
Mqtt
@@ -177,10 +178,15 @@ lxc.mount.entry: /dev/ttyACM-Zwave dev/ttyACM-Zwave none bind,optional,create=fi
## tvheadend ## tvheadend
**Do first login and setup wizzard in a incognito/Private window, since the authentication system can get confused after setting the new username** **Do first login and setup wizzard in a incognito/Private window, since the authentication system can get confused after setting the new username**
* Tvheadend avalible on http://`<ip>`:9981 * Tvheadend avalible on http://`<ip>`:9981
* Default credentials: setup/setup * Default credentials: setup/setup
* Follow the setup wizzard after login, otherwise authentication will be disabled * Follow the setup wizzard after login, otherwise authentication will be disabled
## hass
* After first start of CT HomeAssistant will finish its instalation this wil take at least 10 minutes
* HomeAssistantavalible on http://`<ip>`:8123
# Further CT documentation # Further CT documentation
## iscsi ## iscsi