fix(pkg/config): select temperature and humidity sensors by name, uuid or wire-id
This commit is contained in:
@ -27,8 +27,13 @@ var readTemperatureCmd = &cobra.Command{
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// fetch all temperature sensors
|
||||
temperatureSensors := cnf.GetTemperatureSensors(config.ENABLED)
|
||||
// fetch all temperature sensors or sensors by args
|
||||
temperatureSensors := make([]sensor.TemperatureSensor, 0)
|
||||
if len(args) == 0 {
|
||||
temperatureSensors = cnf.GetTemperatureSensors(config.ENABLED)
|
||||
} else {
|
||||
temperatureSensors = cnf.GetTemperatureSensorsByName(args)
|
||||
}
|
||||
|
||||
// read temperature from sensors
|
||||
temperatures, err := sensor.ReadTemperatures(temperatureSensors)
|
||||
|
Reference in New Issue
Block a user