feat: implementation of dht11 sensor
This commit is contained in:
@ -11,7 +11,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var follow, push bool
|
||||
var logs bool
|
||||
|
||||
var readTemperatureCmd = &cobra.Command{
|
||||
Use: "read",
|
||||
@ -39,10 +39,18 @@ var readTemperatureCmd = &cobra.Command{
|
||||
|
||||
// print temperatures on stdout
|
||||
cli.PrintTemperatures(temperatures, fc, os.Stdout)
|
||||
|
||||
if logs {
|
||||
err = fc.FileLogger.LogTemperatures(temperatures)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
temperatureCmd.AddCommand(readTemperatureCmd)
|
||||
readTemperatureCmd.Flags().BoolVarP(&follow, "follow", "f", false, "Follow output")
|
||||
// readTemperatureCmd.Flags().BoolVarP(&follow, "follow", "f", false, "Follow output")
|
||||
readTemperatureCmd.Flags().BoolVarP(&logs, "logs", "l", true, "Log temperature")
|
||||
}
|
||||
|
Reference in New Issue
Block a user