Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
schulzad committed Oct 26, 2017
1 parent 5614e06 commit e25fecb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions smartapps/influxdb-logger/influxdb-logger.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def handleModeEvent(evt) {
/**
* handleEvent(evt)
*
* parseEvent() then post to InfluxDB.
* parseEvent then post to InfluxDB.
**/
def handleEvent(evt) {
logger("handleEvent(): $evt.displayName($evt.name:$evt.unit) $evt.value","info")
Expand All @@ -288,7 +288,6 @@ def parseEvent(evt) {
// Format: <measurement>[,<tag_name>=<tag_value>] field=<field_value>
// If value is an integer, it must have a trailing "i"
// If value is a string, it must be enclosed in double quotes.
logger("handleEvent(): $evt.displayName($evt.name:$evt.unit) $evt.value","info")
def measurement = evt.name
// tags:
def deviceId = escapeStringForInfluxDB(evt.deviceId)
Expand Down Expand Up @@ -481,7 +480,7 @@ def parseEvent(evt) {
}
// Catch any other event with a string value that hasn't been handled:
else if (evt.value ==~ /.*[^0-9\.,-].*/) { // match if any characters are not digits, period, comma, or hyphen.
logger("handleEvent(): Found a string value that's not explicitly handled: Device Name: ${deviceName}, Event Name: ${evt.name}, Value:${evt.value}","warn")
logger("parseEvent(): Found a string value that's not explicitly handled: Device Name: ${deviceName}, Event Name: ${evt.name}, Value:${evt.value}","warn")
value = '"' + value + '"'
data += ",unit=${unit} value=${value}"
}
Expand Down Expand Up @@ -799,4 +798,4 @@ private getGroupName(id) {
else if (id == 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') {return 'Lounge'}
else if (id == 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') {return 'Office'}
else {return 'Unknown'}
}
}

0 comments on commit e25fecb

Please sign in to comment.