Ported location recorder
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user