Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion smartapps/influxdb-logger/influxdb-logger.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ def handleEvent(evt) {

}

String getLength(String message) {
assert message instanceof String
return message.getBytes("UTF-8").size().toString()
}



/*****************************************************************************************************************
* Main Commands:
Expand Down Expand Up @@ -596,7 +602,10 @@ def logSystemProperties() {
* Uses hubAction instead of httpPost() in case InfluxDB server is on the same LAN as the Smartthings Hub.
**/
def postToInfluxDB(data) {
logger("postToInfluxDB(): Posting data to InfluxDB: Host: ${state.databaseHost}, Port: ${state.databasePort}, Database: ${state.databaseName}, Data: [${data}]","debug")
def length = getLength(data)
state.headers.put("Content-Length", length)

logger("postToInfluxDB(): Posting data to InfluxDB: Host: ${state.databaseHost}, Port: ${state.databasePort}, Database: ${state.databaseName}, Data: [${data}], Size: ${length}","debug")

try {
def hubAction = new physicalgraph.device.HubAction(
Expand Down