fix: sync and fetch temperatures

changes:
- add sync command to synchronize device sensor information with remote
  servers
- fix fetch functions to get temperatures
This commit is contained in:
2018-11-29 16:06:39 +01:00
parent 99ff511117
commit f8e829d3d2
13 changed files with 291 additions and 122 deletions

View File

@ -1,26 +0,0 @@
package remote
import (
"log"
"git.cryptic.systems/fh-trier/go-flucky/pkg/httpcall"
"github.com/spf13/cobra"
)
var force bool
var registerRemoteCmd = &cobra.Command{
Use: "register",
Short: "register on remote servers",
Run: func(cmd *cobra.Command, args []string) {
if err := httpcall.RegisterDevice(configDir, force); err != nil {
log.Fatal(err)
}
},
}
func init() {
remoteCmd.AddCommand(registerRemoteCmd)
registerRemoteCmd.Flags().BoolVarP(&force, "force", "f", false, "Force register on a remote server")
}

26
cmd/remote/sync.go Normal file
View File

@ -0,0 +1,26 @@
package remote
import (
"log"
"git.cryptic.systems/fh-trier/go-flucky/pkg/httpcall"
"github.com/spf13/cobra"
)
var force bool
var syncRemoteCmd = &cobra.Command{
Use: "sync",
Short: "Synchronise Device Values with Remote Servers",
Run: func(cmd *cobra.Command, args []string) {
if err := httpcall.SyncDevice(configDir, force); err != nil {
log.Fatal(err)
}
},
}
func init() {
remoteCmd.AddCommand(syncRemoteCmd)
syncRemoteCmd.Flags().BoolVarP(&force, "force", "f", false, "Include disabled remote links")
}