Ported location recorder

This commit is contained in:
2024-09-18 16:41:26 +02:00
parent 197b9a3d63
commit d8d6c8bb35
4 changed files with 249 additions and 17 deletions

View File

@@ -18,6 +18,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/t-liu93/home-automation-backend/components/homeassistant"
"github.com/t-liu93/home-automation-backend/components/locationRecorder"
"github.com/t-liu93/home-automation-backend/components/pooRecorder"
"github.com/t-liu93/home-automation-backend/util/notion"
)
@@ -45,6 +46,8 @@ func initUtil() {
func initComponent() {
// init pooRecorder
pooRecorder.Init(&scheduler)
// init location recorder
locationRecorder.Init()
}
func serve(cmd *cobra.Command, args []string) {
@@ -100,6 +103,8 @@ func serve(cmd *cobra.Command, args []string) {
router.HandleFunc("/homeassistant/publish", homeassistant.HandleHaMessage).Methods("POST")
router.HandleFunc("/location/record", locationRecorder.HandleRecordLocation).Methods("POST")
srv := &http.Server{
Addr: ":" + port,
Handler: router,