@ -99,24 +99,6 @@ func (self *SingleValueExtractorJsonpathHandler) ExtractionHelper(subTopics []st
|
||||
return "", fmt.Errorf("not enough subtopics")
|
||||
}
|
||||
res = subTopics[i]
|
||||
case "L:":
|
||||
// L: extract from topic and later match against devices table in database
|
||||
i, e := strconv.Atoi(selector[2:])
|
||||
if e != nil {
|
||||
return "", fmt.Errorf("Atoi failed with %s", e)
|
||||
}
|
||||
if i >= len(subTopics) {
|
||||
return "", fmt.Errorf("not enough subtopics")
|
||||
}
|
||||
ext := subTopics[i]
|
||||
lookup, err1b := self.dbh.GetDeviceByLabel(ext)
|
||||
if err1b != nil {
|
||||
log.Printf("ext lookup %s failed: %v", ext, err1b)
|
||||
res = ext
|
||||
} else {
|
||||
log.Printf("ext: %s", lookup)
|
||||
res = ext
|
||||
}
|
||||
case "C:":
|
||||
// use constant value
|
||||
res = selector[2:]
|
||||
|
Reference in New Issue
Block a user