fix(cmd/daemon): default settings
This commit is contained in:
parent
397f870435
commit
d703d33e08
@ -43,5 +43,5 @@ func InitCmd(cmd *cobra.Command, cnfFile string) {
|
|||||||
cmd.AddCommand(daemonCmd)
|
cmd.AddCommand(daemonCmd)
|
||||||
daemonCmd.Flags().BoolVar(&compression, "compression", true, "Compress measured values")
|
daemonCmd.Flags().BoolVar(&compression, "compression", true, "Compress measured values")
|
||||||
daemonCmd.Flags().StringVar(&cleanCacheInterval, "clean-cache-interval", "5m", "Minute intervall to clean cache and write measured values into logfile")
|
daemonCmd.Flags().StringVar(&cleanCacheInterval, "clean-cache-interval", "5m", "Minute intervall to clean cache and write measured values into logfile")
|
||||||
daemonCmd.Flags().Float64Var(&round, "round", 0.25, "Round values. The value 0 deactivates the function")
|
daemonCmd.Flags().Float64Var(&round, "round", 0.5, "Round values. The value 0 deactivates the function")
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
|
|||||||
// Info
|
// Info
|
||||||
logger.Info("Use clean-cache-interval: %v", cleanCacheInterval.String())
|
logger.Info("Use clean-cache-interval: %v", cleanCacheInterval.String())
|
||||||
logger.Info("Use compression: %v", compression)
|
logger.Info("Use compression: %v", compression)
|
||||||
|
logger.Info("Round: %v", round)
|
||||||
|
|
||||||
ticker := time.Tick(cleanCacheInterval)
|
ticker := time.Tick(cleanCacheInterval)
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"math"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ func (s *BME280) Read() ([]types.MeasuredValue, error) {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pressureValueRound := math.Round(float64(pressureValue)/10*0.25) * 10 / 0.25
|
// pressureValueRound := math.Round(float64(pressureValue)/10*0.25) * 10 / 0.25
|
||||||
|
|
||||||
_, humidityValue, err := sensor.ReadHumidityRH(bsbmp.ACCURACY_STANDARD)
|
_, humidityValue, err := sensor.ReadHumidityRH(bsbmp.ACCURACY_STANDARD)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -73,7 +72,7 @@ func (s *BME280) Read() ([]types.MeasuredValue, error) {
|
|||||||
},
|
},
|
||||||
&types.Pressure{
|
&types.Pressure{
|
||||||
PressureID: uuid.NewV4().String(),
|
PressureID: uuid.NewV4().String(),
|
||||||
PressureValue: pressureValueRound,
|
PressureValue: float64(pressureValue),
|
||||||
PressureFromDate: time.Now(),
|
PressureFromDate: time.Now(),
|
||||||
PressureTillDate: time.Now(),
|
PressureTillDate: time.Now(),
|
||||||
SensorID: s.SensorID,
|
SensorID: s.SensorID,
|
||||||
|
Loading…
Reference in New Issue
Block a user