diff --git a/Docker/Dockerfile b/Docker/Dockerfile new file mode 100644 index 0000000..940bfcb --- /dev/null +++ b/Docker/Dockerfile @@ -0,0 +1,72 @@ +FROM alpine:latest + +RUN apk --no-cache add \ + make \ + g++ \ + gcc \ + git \ + bash \ + sudo \ + pkgconf \ + openssl-dev \ + python3 \ + python3-dev \ + py3-pip \ + build-base \ + autoconf \ + automake + +RUN apk --no-cache add \ + npm \ + nodejs + +RUN apk --no-cache add \ + libtool \ + libusb \ + libusb-dev \ + libudev-zero \ + libffi-dev \ + libjpeg-turbo-dev \ + zlib-dev \ + cairo-dev \ + pango-dev \ + pangomm-dev \ + libpng \ + libpng-dev \ + giflib-dev \ + jpeg-dev \ + librsvg-dev \ + giflib \ + freetype-dev + +RUN apk add --no-cache pixman pixman-dev cairo pango + +# Fonts (not all yet installed) +RUN apk add --no-cache font-liberation +RUN fc-cache -f +RUN mkdir /usr/share/fonts/truetype && cp -r /usr/share/fonts/liberation /usr/share/fonts/truetype + +# main repo +RUN git clone https://github.com/tjaworski/AceMagic-S1-LED-TFT-Linux.git /acemagic +# additional theme +RUN git clone https://github.com/Piero24/acemagic-S1-panel-conf.git /acemagic_theme_main +RUN cp -r /acemagic_theme_main/main /acemagic/s1panel/themes/ + +# Just check versions +RUN node -v && npm -v && python3 --version && pip --version && gcc --version && make --version + +# collect packages and build what is needed +WORKDIR /acemagic/s1panel +RUN npm update +WORKDIR /acemagic/s1panel/gui +RUN npm install +RUN npm run build + + +# copy one more theme to container and local config +COPY ./config.json /acemagic/s1panel +ADD ./themes/theme1 /acemagic/s1panel/themes/theme1 + +expose 8686 +WORKDIR /acemagic/s1panel +ENTRYPOINT node main.js diff --git a/Docker/README.md b/Docker/README.md new file mode 100644 index 0000000..b6d676d --- /dev/null +++ b/Docker/README.md @@ -0,0 +1,28 @@ +## Run AceMagic-S1-LED-TFT-Linux in Docker + +Just quick and dirty docker container for running panel control in a Docker. + +This is first step to wrap it in Home assistant addon + +My theme is heavily based on https://github.com/Piero24/acemagic-S1-panel-conf +which is also added to container if you want to use it. + +## How to build locally +```bash +docker build -t acemagic-s1panel . +``` + +## How to run + +```bash +docker run --rm --detach --privileged --name acemagic --device=/dev/ttyUSB0 -v /dev/bus/usb -v /sys/class/net/ -p 8686:8686 acemagic-s1panel:latest +``` + + +## How You can help making it better + +- Clean up packages added to container. I'm not sure that they all are needed. +- Add all font packages needed by main code +- Figure out the correct way of passing network interfaces information. I don't like the idea of using host network for such a container. +- Make better screens +- Make Portrait layout diff --git a/Docker/config.json b/Docker/config.json new file mode 100644 index 0000000..d76787a --- /dev/null +++ b/Docker/config.json @@ -0,0 +1,116 @@ +{ + "listen": "0.0.0.0:8686", + "theme": "themes/theme1/landscape.json", + "poll": 500, + "refresh": 1600, + "heartbeat": 60000, + "debug_update": false, + "theme_list": [ + { + "name": "a simple demo portrait orientation", + "config": "themes/simple_demo/portrait_simple.json" + }, + { + "name": "Theme1", + "config": "themes/theme1/landscape.json" + }, + { + "name": "main", + "config": "themes/main/landscape_main.json" + } + ], + "sensors": [ + { + "module": "sensors/clock.js" + }, + { + "module": "sensors/calendar.js" + }, + { + "module": "sensors/cpu_usage.js", + "config": { + "max_points": 300 + } + }, + { + "module": "sensors/cpu_temp.js", + "config": { + "max_points": 300, + "fahrenheit": false + } + }, + { + "module": "sensors/cpu_power.js", + "config": { + "max_points": 300 + } + }, + { + "module": "sensors/network.js", + "config": { + "interface": "wlp3s0", + "max_points": 300 + } + }, + { + "module": "sensors/network.js", + "config": { + "interface": "enp2s0", + "max_points": 300 + } + }, + { + "module": "sensors/network.js", + "config": { + "interface": "enp4s0", + "max_points": 300 + } + }, + { + "module": "sensors/memory.js", + "config": { + "max_points": 300 + } + }, + { + "module": "sensors/space.js", + "config": { + "name": "root", + "mount_point": "/", + "max_points": 300 + } + }, + { + "module": "sensors/weather.js", + "config": { + "name": "Moscow", + "country": "RU", + "imperial": false, + "forecast": 1 + } + } + ], + "widgets": [ + "widgets/text.js", + "widgets/custom_bar.js", + "widgets/line_chart.js", + "widgets/doughnut_chart.js", + "widgets/bar_chart.js", + "widgets/image.js", + "widgets/iconify.js", + "widgets/weather_icon.js" + ], + "canvas": { + "width": 320, + "height": 170, + "pixel": "RGB16_565" + }, + "device": "1-8:1.1", + "led_config": { + "device": "/dev/ttyUSB0", + "theme": 2, + "speed": 3, + "intensity": 3 + }, + "portrait": true +} diff --git a/Docker/run.sh b/Docker/run.sh new file mode 100644 index 0000000..b24a249 --- /dev/null +++ b/Docker/run.sh @@ -0,0 +1 @@ +docker run --rm --detach --privileged --name acemagic --device=/dev/ttyUSB0 -v /dev/bus/usb -v /sys/class/net/ -p 8686:8686 acemagic-s1panel:latest diff --git a/Docker/themes/theme1/imgs/80s_city.png b/Docker/themes/theme1/imgs/80s_city.png new file mode 100644 index 0000000..d6b0127 Binary files /dev/null and b/Docker/themes/theme1/imgs/80s_city.png differ diff --git a/Docker/themes/theme1/imgs/city.png b/Docker/themes/theme1/imgs/city.png new file mode 100644 index 0000000..f47a6a7 Binary files /dev/null and b/Docker/themes/theme1/imgs/city.png differ diff --git a/Docker/themes/theme1/imgs/neon_street.png b/Docker/themes/theme1/imgs/neon_street.png new file mode 100644 index 0000000..4b3287c Binary files /dev/null and b/Docker/themes/theme1/imgs/neon_street.png differ diff --git a/Docker/themes/theme1/landscape.json b/Docker/themes/theme1/landscape.json new file mode 100644 index 0000000..0155bfd --- /dev/null +++ b/Docker/themes/theme1/landscape.json @@ -0,0 +1,837 @@ +{ + "orientation": "landscape", + "refresh": "update", + "screens": [ + { + "id": 1, + "name": "main1", + "background": "#000000", + "duration": 40, + "widgets": [ + { + "id": 2, + "group": 1, + "name": "text", + "rect": { + "x": 181, + "y": 34, + "width": 116, + "height": 50 + }, + "sensor": true, + "value": "clock", + "format": "{0}", + "refresh": 1000, + "debug_frame": false, + "font": "41px Garamond", + "color": "#878787", + "align": "center" + }, + { + "id": 4, + "group": 1, + "name": "text", + "rect": { + "x": 175, + "y": 116, + "width": 134, + "height": 40 + }, + "sensor": true, + "value": "calendar", + "format": "{1}", + "refresh": 1000, + "debug_frame": false, + "font": "lighter 20px Garamond", + "color": "#878787", + "align": "center" + }, + { + "id": 5, + "group": 1, + "name": "doughnut_chart", + "rect": { + "x": 10, + "y": 25, + "width": 55, + "height": 55 + }, + "sensor": true, + "value": "cpu_usage", + "format": "{0}", + "refresh": 1000, + "debug_frame": false, + "used": "#00e600", + "free": "#4d4d4d", + "rotation": "", + "cutout": "", + "circumference": "" + }, + { + "id": 6, + "group": 1, + "name": "doughnut_chart", + "rect": { + "x": 10, + "y": 100, + "width": 55, + "height": 55 + }, + "sensor": true, + "value": "memory", + "format": "{2}", + "refresh": 1000, + "debug_frame": false, + "used": "#00e600", + "free": "#4d4d4d", + "rotation": "", + "cutout": "", + "circumference": "" + }, + { + "id": 7, + "group": 1, + "name": "iconify", + "rect": { + "x": 22, + "y": 41, + "width": 30, + "height": 30 + }, + "sensor": true, + "value": "cpu_usage", + "format": "memory", + "refresh": 1000, + "debug_frame": false, + "iconSet": "mdi", + "color": "#4d4d4d" + }, + { + "id": 8, + "group": 1, + "name": "iconify", + "rect": { + "x": 24, + "y": 118, + "width": 26, + "height": 25 + }, + "sensor": true, + "value": "memory", + "format": "memory-alt", + "refresh": 1000, + "debug_frame": false, + "iconSet": "material-symbols", + "color": "#4d4d4d" + }, + { + "id": 9, + "group": 1, + "name": "text", + "rect": { + "x": 10, + "y": 76, + "width": 57, + "height": 15 + }, + "sensor": true, + "value": "cpu_usage", + "format": "{0}%", + "refresh": 1000, + "debug_frame": false, + "font": "bold 13px Arial", + "color": "#878787", + "align": "center" + }, + { + "id": 10, + "group": 1, + "name": "text", + "rect": { + "x": 10, + "y": 152, + "width": 57, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "{2}%", + "refresh": 1000, + "debug_frame": false, + "font": "bold 12px Arial", + "color": "#878787", + "align": "center" + }, + { + "id": 11, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 25, + "width": 35, + "height": 35 + }, + "sensor": true, + "value": "cpu_usage", + "format": "CPU", + "refresh": 1000, + "debug_frame": false, + "font": "bold 15px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 12, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 50, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "cpu_temp", + "format": "Temp: {0}°C", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 13, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 68, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "cpu_power", + "format": "Watt: {0}W", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 14, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 105, + "width": 35, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "RAM", + "refresh": 1000, + "debug_frame": false, + "font": "bold 15px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 15, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 125, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "Use: {14}", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 16, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 143, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "Swap: {15}", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + } + ], + "wallpaper": "themes/theme1/imgs/neon_street.png" + }, + { + "id": 2, + "name": "main2", + "background": "#000000", + "duration": 40, + "widgets": [ + { + "id": 2, + "group": 1, + "name": "text", + "rect": { + "x": 181, + "y": 34, + "width": 116, + "height": 50 + }, + "sensor": true, + "value": "clock", + "format": "{0}", + "refresh": 1000, + "debug_frame": false, + "font": "41px Garamond", + "color": "#878787", + "align": "center" + }, + { + "id": 4, + "group": 1, + "name": "text", + "rect": { + "x": 175, + "y": 116, + "width": 134, + "height": 40 + }, + "sensor": true, + "value": "calendar", + "format": "{1}", + "refresh": 1000, + "debug_frame": false, + "font": "lighter 20px Garamond", + "color": "#878787", + "align": "center" + }, + { + "id": 5, + "group": 1, + "name": "doughnut_chart", + "rect": { + "x": 10, + "y": 25, + "width": 55, + "height": 55 + }, + "sensor": true, + "value": "cpu_usage", + "format": "{0}", + "refresh": 1000, + "debug_frame": false, + "used": "#00e600", + "free": "#4d4d4d", + "rotation": "", + "cutout": "", + "circumference": "" + }, + { + "id": 6, + "group": 1, + "name": "doughnut_chart", + "rect": { + "x": 10, + "y": 100, + "width": 55, + "height": 55 + }, + "sensor": true, + "value": "memory", + "format": "{2}", + "refresh": 1000, + "debug_frame": false, + "used": "#00e600", + "free": "#4d4d4d", + "rotation": "", + "cutout": "", + "circumference": "" + }, + { + "id": 7, + "group": 1, + "name": "iconify", + "rect": { + "x": 22, + "y": 41, + "width": 30, + "height": 30 + }, + "sensor": true, + "value": "cpu_usage", + "format": "memory", + "refresh": 1000, + "debug_frame": false, + "iconSet": "mdi", + "color": "#4d4d4d" + }, + { + "id": 8, + "group": 1, + "name": "iconify", + "rect": { + "x": 24, + "y": 118, + "width": 26, + "height": 25 + }, + "sensor": true, + "value": "memory", + "format": "memory-alt", + "refresh": 1000, + "debug_frame": false, + "iconSet": "material-symbols", + "color": "#4d4d4d" + }, + { + "id": 9, + "group": 1, + "name": "text", + "rect": { + "x": 10, + "y": 76, + "width": 57, + "height": 15 + }, + "sensor": true, + "value": "cpu_usage", + "format": "{0}%", + "refresh": 1000, + "debug_frame": false, + "font": "bold 13px Arial", + "color": "#878787", + "align": "center" + }, + { + "id": 10, + "group": 1, + "name": "text", + "rect": { + "x": 10, + "y": 152, + "width": 57, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "{2}%", + "refresh": 1000, + "debug_frame": false, + "font": "bold 12px Arial", + "color": "#878787", + "align": "center" + }, + { + "id": 11, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 25, + "width": 35, + "height": 35 + }, + "sensor": true, + "value": "cpu_usage", + "format": "CPU", + "refresh": 1000, + "debug_frame": false, + "font": "bold 15px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 12, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 50, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "cpu_temp", + "format": "Temp: {0}°C", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 13, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 68, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "cpu_power", + "format": "Watt: {0}W", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 14, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 105, + "width": 35, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "RAM", + "refresh": 1000, + "debug_frame": false, + "font": "bold 15px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 15, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 125, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "Use: {14}", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 16, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 143, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "Swap: {15}", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + } + ], + "wallpaper": "themes/theme1/imgs/city.png" + }, + { + "id": 3, + "name": "main3", + "background": "#000000", + "duration": 40, + "widgets": [ + { + "id": 2, + "group": 1, + "name": "text", + "rect": { + "x": 181, + "y": 34, + "width": 116, + "height": 50 + }, + "sensor": true, + "value": "clock", + "format": "{0}", + "refresh": 1000, + "debug_frame": false, + "font": "41px Garamond", + "color": "#878787", + "align": "center" + }, + { + "id": 4, + "group": 1, + "name": "text", + "rect": { + "x": 175, + "y": 116, + "width": 134, + "height": 40 + }, + "sensor": true, + "value": "calendar", + "format": "{1}", + "refresh": 1000, + "debug_frame": false, + "font": "lighter 20px Garamond", + "color": "#878787", + "align": "center" + }, + { + "id": 5, + "group": 1, + "name": "doughnut_chart", + "rect": { + "x": 10, + "y": 25, + "width": 55, + "height": 55 + }, + "sensor": true, + "value": "cpu_usage", + "format": "{0}", + "refresh": 1000, + "debug_frame": false, + "used": "#00e600", + "free": "#4d4d4d", + "rotation": "", + "cutout": "", + "circumference": "" + }, + { + "id": 6, + "group": 1, + "name": "doughnut_chart", + "rect": { + "x": 10, + "y": 100, + "width": 55, + "height": 55 + }, + "sensor": true, + "value": "memory", + "format": "{2}", + "refresh": 1000, + "debug_frame": false, + "used": "#00e600", + "free": "#4d4d4d", + "rotation": "", + "cutout": "", + "circumference": "" + }, + { + "id": 7, + "group": 1, + "name": "iconify", + "rect": { + "x": 22, + "y": 41, + "width": 30, + "height": 30 + }, + "sensor": true, + "value": "cpu_usage", + "format": "memory", + "refresh": 1000, + "debug_frame": false, + "iconSet": "mdi", + "color": "#4d4d4d" + }, + { + "id": 8, + "group": 1, + "name": "iconify", + "rect": { + "x": 24, + "y": 118, + "width": 26, + "height": 25 + }, + "sensor": true, + "value": "memory", + "format": "memory-alt", + "refresh": 1000, + "debug_frame": false, + "iconSet": "material-symbols", + "color": "#4d4d4d" + }, + { + "id": 9, + "group": 1, + "name": "text", + "rect": { + "x": 10, + "y": 76, + "width": 57, + "height": 15 + }, + "sensor": true, + "value": "cpu_usage", + "format": "{0}%", + "refresh": 1000, + "debug_frame": false, + "font": "bold 13px Arial", + "color": "#878787", + "align": "center" + }, + { + "id": 10, + "group": 1, + "name": "text", + "rect": { + "x": 10, + "y": 152, + "width": 57, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "{2}%", + "refresh": 1000, + "debug_frame": false, + "font": "bold 12px Arial", + "color": "#878787", + "align": "center" + }, + { + "id": 11, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 25, + "width": 35, + "height": 35 + }, + "sensor": true, + "value": "cpu_usage", + "format": "CPU", + "refresh": 1000, + "debug_frame": false, + "font": "bold 15px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 12, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 50, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "cpu_temp", + "format": "Temp: {0}°C", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 13, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 68, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "cpu_power", + "format": "Watt: {0}W", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 14, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 105, + "width": 35, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "RAM", + "refresh": 1000, + "debug_frame": false, + "font": "bold 15px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 15, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 125, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "Use: {14}", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + }, + { + "id": 16, + "group": 1, + "name": "text", + "rect": { + "x": 70, + "y": 143, + "width": 85, + "height": 15 + }, + "sensor": true, + "value": "memory", + "format": "Swap: {15}", + "refresh": 1000, + "debug_frame": false, + "font": "12px Arial", + "color": "#878787", + "align": "left" + } + ], + "wallpaper": "themes/theme1/imgs/80s_city.png" + } + ] +}