feat(pkg/sensor): new support for sensor bme280

This commit is contained in:
2019-06-30 14:34:13 +02:00
parent 96eb1f4036
commit 289aaf2093
20 changed files with 309 additions and 87 deletions

View File

@ -8,6 +8,8 @@ import (
"github.com/go-flucky/flucky/pkg/cli"
"github.com/go-flucky/flucky/pkg/config"
"github.com/go-flucky/flucky/pkg/logfile"
"github.com/go-flucky/flucky/pkg/rgbled"
"github.com/go-flucky/flucky/pkg/types/typeswitch"
"github.com/spf13/cobra"
)
@ -25,11 +27,22 @@ var listTemperatureCmd = &cobra.Command{
logfile := logfile.New(cnf.Device.Logfile)
rgbLEDs := cnf.GetRGBLEDs(config.ENABLED)
if err := rgbled.Logfile(rgbLEDs); err != nil {
log.Fatalln(err)
}
measuredValues, err := logfile.Read()
if err != nil {
log.Fatalln(err)
}
if err := rgbled.Off(rgbLEDs); err != nil {
log.Fatalln(err)
}
measuredValues = typeswitch.TemperatureValues(measuredValues)
cli.PrintMeasuredValues(measuredValues, cnf, os.Stdout)
},