feat(cmd/rgb-led): add subcommands to operate with rgb-leds

This commit is contained in:
2019-06-16 13:00:50 +02:00
parent c81cd2d21c
commit 49d66cfcbb
27 changed files with 713 additions and 40 deletions

View File

@ -68,6 +68,21 @@ func PrintHumidities(humidities []*types.Humidity, cnf *config.Configuration, w
tw.Flush()
}
func PrintRGBLEDs(cnf *config.Configuration, w io.Writer) {
// declare tabwriter
tw := tabwriter.NewWriter(w, 0, 0, 3, ' ', 0)
// headline
fmt.Fprintln(tw, "name\tlocation\tblue\tgreen\tred\tenabled")
for _, rgbled := range cnf.RGBLEDs {
fmt.Fprintf(tw, "%v\t%v\t%v\t%v\t%v\t%v\n", rgbled.RGBLEDName, rgbled.RGBLEDLocation, *rgbled.RGBLEDColorToGPIO[types.RGBLEDBlue], *rgbled.RGBLEDColorToGPIO[types.RGBLEDGreen], *rgbled.RGBLEDColorToGPIO[types.RGBLEDRed], rgbled.RGBLEDEnabled)
}
tw.Flush()
}
// PrintSensors displays a list with all configured sensors
func PrintSensors(cnf *config.Configuration, w io.Writer) error {