Skip to content

Commit

Permalink
Plan: publish restart
Browse files Browse the repository at this point in the history
  • Loading branch information
dpslwk committed Aug 2, 2024
1 parent 2a17761 commit 39ef251
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func main() {
fmt.Printf("parse config file %v failed : %v\n", filename, err.Error())
return
}

// Sanity check webBase - print out a warning if index.html isn't there / can't be read
if _, err := os.Stat(webBase + "/index.html"); os.IsNotExist(err) {
fmt.Printf("Warning: unable to open [%v]; check web base directory is set correctly (pass -w <web base> flag)\n", webBase + "/index.html")
Expand Down Expand Up @@ -115,6 +115,8 @@ func main() {
panic(token.Error())
}

c.Publish(statusResponsetTopic, 0, false, "Restart: " + statusName)

// Start web server
listenAddr := ":" + listenPort
fmt.Printf("Listen on: [%v], web base: [%v]\n", listenAddr, webBase)
Expand All @@ -137,7 +139,7 @@ func doorStateHandler(client mqtt.Client, msg mqtt.Message) {
doorStatesLock.Lock()
doorStates[event.DoorId] = msgPayload
doorStatesLock.Unlock()

event.EventType = "DoorState"
event.Value = msgPayload
eventGroup.Send(event)
Expand Down

0 comments on commit 39ef251

Please sign in to comment.