fix(pkg/cli): GetSensorIDsByMeasuredValues
This commit is contained in:
@ -82,8 +82,8 @@ func (c *Configuration) AddSensor(sensor *types.Sensor) error {
|
||||
}
|
||||
|
||||
// check if sensor has a valid device id
|
||||
if sensor.ID != c.Device.ID {
|
||||
sensor.ID = c.Device.ID
|
||||
if sensor.DeviceID != c.Device.ID {
|
||||
sensor.DeviceID = c.Device.ID
|
||||
}
|
||||
|
||||
// overwrite creation date
|
||||
@ -362,6 +362,17 @@ func (c *Configuration) GetRGBLEDsByName(names []string) []rgbled.RGBLED {
|
||||
return c.convertRGBLEDs(rgbLEDs)
|
||||
}
|
||||
|
||||
// GetSensorByID returns a sensor matched by his id. If no sensor has this id,
|
||||
// the function returns nil
|
||||
func (c *Configuration) GetSensorByID(id string) *types.Sensor {
|
||||
for _, sensor := range c.Sensors {
|
||||
if sensor.ID == id {
|
||||
return sensor
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSensors returns a list of humidity sensors
|
||||
func (c *Configuration) GetSensors(option Option) []sensor.Sensor {
|
||||
cachedSensors := make([]*types.Sensor, 0)
|
||||
|
Reference in New Issue
Block a user