This commit is contained in:
Mats Tornberg
2025-11-22 17:35:24 +01:00
parent 0596fe60fa
commit 87660c7d1d
12 changed files with 34 additions and 39 deletions

View File

@@ -35,7 +35,8 @@ COPY go.sum .
RUN go mod download
COPY main.go .
COPY telldus ./telldus
COPY pkg ./pkg
# Build the Go application
RUN go build main.go

Binary file not shown.

16
main.go
View File

@@ -1,11 +1,11 @@
package main
import (
"app/datastore"
"app/devices"
"app/mqtt"
"app/telldus"
daemon "app/telldus-daemon"
"app/pkg/datastore"
"app/pkg/devices"
"app/pkg/mqtt"
"app/pkg/telldus"
daemon "app/pkg/telldus-daemon"
"encoding/json"
"log"
"net/http"
@@ -25,8 +25,6 @@ var eventMgr *devices.EventManager
const maxEvents = 1000
func main() {
// Initialize daemon manager
daemonMgr = daemon.New()
@@ -140,8 +138,6 @@ func main() {
log.Fatal(http.ListenAndServe(httpPort, setupRoutes()))
}
func getRawEvents(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(eventMgr.GetRawEvents())
@@ -355,5 +351,3 @@ func getSensor(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(sensor)
}

View File

@@ -1,9 +1,9 @@
package devices
import (
"app/datastore"
"app/mqtt"
"app/telldus"
"app/pkg/datastore"
"app/pkg/mqtt"
"app/pkg/telldus"
"fmt"
"log"
"strconv"

View File

@@ -1,8 +1,8 @@
package devices
import (
"app/datastore"
"app/telldus"
"app/pkg/datastore"
"app/pkg/telldus"
"fmt"
"log"
)

View File

@@ -1,8 +1,8 @@
package mqtt
import (
"app/datastore"
"app/telldus"
"app/pkg/datastore"
"app/pkg/telldus"
"fmt"
"log"
)

View File

@@ -1,8 +1,8 @@
package mqtt
import (
"app/datastore"
"app/telldus"
"app/pkg/datastore"
"app/pkg/telldus"
"fmt"
mqtt "github.com/eclipse/paho.mqtt.golang"

View File

@@ -9,7 +9,7 @@ import (
"syscall"
"time"
"app/telldus"
"app/pkg/telldus"
)
// Manager handles the telldusd daemon lifecycle