diff --git a/cmd/temperature/read.go b/cmd/temperature/read.go index 6f16560..c22eb4b 100644 --- a/cmd/temperature/read.go +++ b/cmd/temperature/read.go @@ -5,6 +5,8 @@ import ( "log" "os" + "github.com/go-flucky/flucky/pkg/rgbled" + "github.com/go-flucky/flucky/pkg/cli" "github.com/go-flucky/flucky/pkg/config" "github.com/go-flucky/flucky/pkg/logfile" @@ -27,6 +29,9 @@ var readTemperatureCmd = &cobra.Command{ log.Fatalln(err) } + rgbLEDs := cnf.GetRGBLEDs(config.ENABLED) + rgbled.Run(rgbLEDs) + // fetch all temperature sensors or sensors by args temperatureSensors := make([]sensor.TemperatureSensor, 0) if len(args) == 0 { @@ -37,11 +42,13 @@ var readTemperatureCmd = &cobra.Command{ measurementUnit, err := sensor.SelectTemperatureMeasurementUnit(temperatureUnit) if err != nil { + rgbled.Error(rgbLEDs) log.Fatalf("Can not parse temperature unit: %v", temperatureUnit) } temperatures, err := sensor.ReadTemperatures(temperatureSensors, measurementUnit, round) if err != nil { + rgbled.Error(rgbLEDs) log.Fatalln(err) } @@ -52,9 +59,12 @@ var readTemperatureCmd = &cobra.Command{ temperatureLogfile := logfile.New(cnf.Device.TemperatureLogfile) err := logfile.AppendTemperatures(temperatureLogfile, compression, temperatures) if err != nil { + rgbled.Error(rgbLEDs) log.Fatalln(err) } } + + rgbled.Off(rgbLEDs) }, }