[AWTRIX] Initial add (#132)

This commit is contained in:
Max Winterstein
2022-12-27 23:04:39 +01:00
committed by GitHub
parent 13bc6dab8c
commit 589ca18651
18 changed files with 433 additions and 0 deletions

32
awtrix/CHANGELOG.md Normal file
View File

@@ -0,0 +1,32 @@
# Changelog
## [1.0.0] - 2022-12-07
Changes from forked repo:
- Removed stable/beta choice - development has stopped and stable is newer
- Added multiple arch back
- Updated base images
- Changed to openjdk8 - fulfills the needs of AWTRIX and builds on all archs
---
Original CHANGELOG.md below
---
version 0.2.6 disabled hassio-detexction from awtrix server
version 0.2.5 tested with Beta 2025 removed support for Raspi (sorry about that) because there is no openjdk11-jre apk for it
version 0.2.4 tested with Beta 2025 export to /config folder
version 0.2.3 tested with Beta 2024
version 0.1.8 version with new 2.x beta server
version 0.1.5 version with new 2.0 stable server
version 0.0.8 use serial-ports from your host
version 0.0.7: configure "lang"

20
awtrix/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
ARG BUILD_FROM
FROM $BUILD_FROM
WORKDIR /data
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apk add --no-cache openjdk8 wget nginx
COPY rootfs /
ADD https://blueforcer.de/awtrix/stable/awtrix.jar /stable.jar
# Labels
LABEL \
io.hass.name="Awtrix_host" \
io.hass.description="Server for the awtrix-8x32 RGB display." \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION}

36
awtrix/README.md Normal file
View File

@@ -0,0 +1,36 @@
# Home Assistant Add-On: AWTRIX
<a href='https://ko-fi.com/MaxWinterstein' target='_blank'><img height='35' style='border:0px;height:46px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com'></a>
## Based on (aka. stolen from) https://github.com/lubeda/repository
Thanks for the work! I just made it work again for Raspberry Pi, and did some tweaking here and there.
---
Original README.md below
---
**This is a beta release of the addon, use at your own risk**
There is no arrangment with blueforcer, so i build this by try and error. It works on my HA and it should work on many other HA. But no guarranty. Be carefull.
# Warning
!!backup all your configs (premiumkey). uninstall the old version!!
## Usage
Access the server via ingress, so no port config is necesarry
The config and the apps folder are accesible as /config/awtrix/apps and /config/awtrix/config. So no ftp is needed
| option | default | usage |
| ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| version | `beta` | select the awtrix host to run beta => https://blueforcer.de/awtrix/beta/awtrix.jar or stable => https://blueforcer.de/awtrix/stable/awtrix.jar |
| lang | `en_EN` | the language used e.g. for the DayOfTheWeeK App set "de_DE" for german |
To go from stable to beta and vice versa you have to rebuild the addon!
See [awtrix homepage](https://docs.blueforcer.de/#/v2/README) for more details

7
awtrix/build.json Normal file
View File

@@ -0,0 +1,7 @@
{
"build_from": {
"armv7": "ghcr.io/hassio-addons/base:13.0.0",
"aarch64": "ghcr.io/hassio-addons/base:13.0.0",
"amd64": "ghcr.io/hassio-addons/base:13.0.0"
}
}

33
awtrix/config.yaml Normal file
View File

@@ -0,0 +1,33 @@
name: AWTRIX
version: 1.0.0
image: ghcr.io/maxwinterstein/homeassistant-addon-awtrix-{arch}
arch:
- armv7
- aarch64
- amd64
slug: awtrix
description: (AWsome maTRIX) is a full color dot matrix that displays applications from simple time display to Fortnite account statistics.
url: https://awtrixdocs.blueforcer.de/#/
startup: system
map:
- config:rw
ingress: true
init: false
panel_icon: mdi:solar-panel-large
ports:
7000/tcp: 7000
7001/tcp: 7001
5568/udp: 5568
backup_exclude:
- "/data/www/*"
ports_description:
7000/tcp: REST API
7001/tcp: communication matrix <-> server
5568/udp: E1.31 Communication (premium only)
stage: experimental
options:
version: stable
lang: en_EN
schema:
version: list(stable)
lang: str

BIN
awtrix/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

BIN
awtrix/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@@ -0,0 +1,52 @@
#!/usr/bin/with-contenv bashio
runfolder="/data"
datafolder="/config"
bashio::log.info "Addon Version 0.2.6 (Awtrix 2.0 beta)"
if bashio::fs.directory_exists "${datafolder}"; then
if ! bashio::fs.directory_exists "${datafolder}/awtrix"; then
mkdir "${datafolder}/awtrix"
bashio::log.info "mkdir /config/awtrix"
fi
if ! bashio::fs.directory_exists "${datafolder}/awtrix/config"; then
mkdir "${datafolder}/awtrix/config"
bashio::log.info "mkdir /config/awtrix/config"
fi
if ! bashio::fs.directory_exists "${datafolder}/awtrix/apps"; then
mkdir "${datafolder}/awtrix/apps"
bashio::log.info "mkdir /config/awtrix/apps"
fi
if ! bashio::fs.directory_exists "${runfolder}/Apps"; then
ln -s "${datafolder}/awtrix/apps" "${runfolder}/Apps"
bashio::log.info "ln -s Apps"
fi
if ! bashio::fs.directory_exists "${runfolder}/config"; then
ln -s "${datafolder}/awtrix/config" "${runfolder}/config"
bashio::log.info "ln -s" "${datafolder}/awtrix/config" "${runfolder}/config"
fi
else
bashio::log.error "No /config folder"
exit
fi
if bashio::config.exists 'lang'; then
lang=$(bashio::config 'lang')
bashio::log.info "Setting lang to ${lang}..."
export LANG=${lang}
fi
cd $runfolder
version=$(bashio::config 'version')
bashio::log.warning "disabling hassio-detection"
export SUPERVISOR_TOKEN=-1
bashio::log.info "Starting awtrix (${version})..."
exec /usr/bin/java -jar /$version.jar --logger=stdout &

View File

@@ -0,0 +1,18 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: grafana
# Configures NGINX
# ==============================================================================
declare ingress_entry
declare ingress_interface
bashio::log.info "Configuring NGINX"
ingress_interface=$(bashio::addon.ip_address)
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/services.d/nginx/run
ingress_entry=$(bashio::addon.ingress_entry)
sed -i "s#%%ingress_entry%%#${ingress_entry}#g" /etc/nginx/servers/ingress.conf

View File

@@ -0,0 +1,96 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@@ -0,0 +1,16 @@
proxy_http_version 1.1;
proxy_ignore_client_abort off;
proxy_read_timeout 86400s;
proxy_redirect off;
proxy_send_timeout 86400s;
proxy_max_temp_file_size 0;
proxy_set_header Accept-Encoding "";
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-WEBAUTH-USER "";

View File

@@ -0,0 +1,6 @@
root /dev/null;
server_name $hostname;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;

View File

@@ -0,0 +1,9 @@
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
ssl_ecdh_curve secp384r1;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;

View File

@@ -0,0 +1,3 @@
upstream backend {
server 127.0.0.1:7000;
}

View File

@@ -0,0 +1,53 @@
# Run nginx in foreground.
daemon off;
# This is run inside Docker.
user root;
# Pid storage location.
pid /var/run/nginx.pid;
# Set number of worker processes.
worker_processes 1;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
# Write error log to the add-on log.
error_log /proc/1/fd/1 error;
# Load dynamic modules.
include /etc/nginx/modules/*.conf;
# Max num of simultaneous connections by a worker process.
events {
worker_connections 512;
}
http {
include /etc/nginx/includes/mime.types;
log_format homeassistant '[$time_local] $status '
'$http_x_forwarded_for($remote_addr) '
'$request ($http_user_agent)';
#access_log /proc/1/fd/1 homeassistant;
access_log /dev/null homeassistant;
client_max_body_size 4G;
default_type application/octet-stream;
gzip on;
keepalive_timeout 65;
sendfile on;
server_tokens off;
tcp_nodelay on;
tcp_nopush on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/includes/upstream.conf;
include /etc/nginx/servers/*.conf;
}

View File

@@ -0,0 +1,35 @@
server {
listen %%interface%%:8099 default_server;
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
#sub_filter_types text/html;
location / {
allow 172.30.32.2;
deny all;
sub_filter "/ws" "%%ingress_entry%%/ws";
sub_filter "/login/ws" "%%ingress_entry%%/login/ws";
sub_filter "/settings/ws" "%%ingress_entry%%/settings/ws";
sub_filter "/logs/ws" "%%ingress_entry%%/logs/ws";
sub_filter "/critical/ws" "%%ingress_entry%%/critical/ws";
sub_filter "/awtrixer/ws" "%%ingress_entry%%/awtrixer/ws";
sub_filter "/about/ws" "%%ingress_entry%%/about/ws";
sub_filter "/map/ws" "%%ingress_entry%%/map/ws";
sub_filter "/matrixstats/ws" "%%ingress_entry%%/matrixstats/ws";
sub_filter "/myapps/ws" "%%ingress_entry%%/myapps/ws";
sub_filter "/stats/ws" "%%ingress_entry%%/stats/ws";
sub_filter "/premium/ws" "%%ingress_entry%%/premium/ws";
sub_filter "/matrixlog/ws" "%%ingress_entry%%/matrixlog/ws";
sub_filter "/arcade/ws" "%%ingress_entry%%/arcade/ws";
sub_filter "/icons/ws" "%%ingress_entry%%/icons/ws";
sub_filter "/audio/ws" "%%ingress_entry%%/audio/ws";
sub_filter "/applist/ws" "%%ingress_entry%%/applist/ws";
sub_filter "/appstore/ws" "%%ingress_entry%%/appstore/ws";
sub_filter "/weather/ws" "%%ingress_entry%%/weather/ws";
sub_filter "/pages" "%%ingress_entry%%/pages";
#sub_filter "../../plugins" "../plugins";
proxy_pass http://backend;
}
}

View File

@@ -0,0 +1,9 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Home Assistant Community Add-on: grafana
# Take down the S6 supervision tree when Nginx fails
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,8 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: awtrix
# Runs the Nginx daemon
# ==============================================================================
bashio::log.info "Starting NGinx..."
exec nginx