From 790b174a9e283f15362e6096328486cd63c380a9 Mon Sep 17 00:00:00 2001 From: Mats Tornberg Date: Sat, 22 Nov 2025 15:57:36 +0000 Subject: [PATCH] more refinements --- .devcontainer/Dockerfile | 28 +++++ .devcontainer/devcontainer.json | 33 ++++++ Dockerfile | 14 +-- chip | 1 - db/telldus.db | Bin 65536 -> 65536 bytes go.mod | 15 ++- go.sum | 12 +- main.go | 189 ++++++++++++++++++++++++++++++++ 8 files changed, 270 insertions(+), 22 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json delete mode 160000 chip diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..ba91c2f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,28 @@ +FROM golang:1.25.4-bookworm + +# Install dependencies for telldus-core +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + libssl-dev \ + libavahi-client-dev \ + libglib2.0-dev \ + libftdi-dev \ + libconfuse-dev \ + nodejs \ + npm \ + && rm -rf /var/lib/apt/lists/* + +# Build telldus-core +COPY ./telldus-core /usr/src/telldus-core +WORKDIR /usr/src/telldus-core +RUN cmake . \ + && make \ + && make install \ + && ldconfig + +# Set workdir for the project +WORKDIR /workspaces/go-telldus-matter + +ENV GO111MODULE=on +ENV CGO_ENABLED=1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c89dcf0 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +{ + "name": "Go Telldus Matter Dev", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "workspaceFolder": "/workspaces/go-telldus-matter", + "runArgs": [ + "--privileged" + ], + "mounts": [ + "source=/dev/bus/usb,target=/dev/bus/usb,type=bind", + "source=${localWorkspaceFolder}/tellstick.conf,target=/etc/tellstick.conf,type=bind" + ], + "containerEnv": { + "MQTT_URL": "10.10.3.12:1883", + "MQTT_USER": "telldus-dev", + "MQTT_PASSWORD": "" + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.Go", + "ms-vscode.vscode-typescript-next" + ], + "settings": { + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true + } + } + }, + "postCreateCommand": "go mod download && cd frontend && npm install" +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8a20968..e88d973 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,17 +50,7 @@ RUN cp -r dist /go/src/app/ # Set workdir back WORKDIR /go/src/app -# Create startup script -RUN echo '#!/bin/bash\n\ -/usr/local/sbin/telldusd --nodaemon &\n\ -TELLDUSD_PID=$!\n\ -./main &\n\ -MAIN_PID=$!\n\ -trap "kill $MAIN_PID $TELLDUSD_PID; exit" INT TERM\n\ -wait $MAIN_PID\n\ -kill $TELLDUSD_PID' > start.sh && chmod +x start.sh - EXPOSE 8080 -# Run the application -CMD ["./start.sh"] \ No newline at end of file +# Run the application (it will manage telldusd internally) +CMD ["./main"] \ No newline at end of file diff --git a/chip b/chip deleted file mode 160000 index 9548aca..0000000 --- a/chip +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9548aca151d8b629ce208f9304a2f80e27be405b diff --git a/db/telldus.db b/db/telldus.db index 0153ce0ba2b93870af8414e0261e1fe10ff418a1..c6143a2645d139f9963203e3f209bd847ab35b6e 100644 GIT binary patch delta 502 zcmZo@U}$%q_@CRY*xK z%S=u!NzKVgDJ_nN@Zt?OYs=hZW|QUZWZ>=G%%M=vD!H>;pW0J91p ze+`k47Ly?^6SJ@_h!FzKsFONBy$LifI5RM5A