[NEEDS UPDATING] InfluxDB Logger

Mine has been running on AWS for a year perfectly. I’ll have to go back and figure out what all the steps were but I think someone created a post about it somewhere in this thread.

I would appreciate it. I read somewhere that there were issues using AWS, so I decided to go away from that… And when I tried, I just couldn’t get the ST hub to write data to it… but it would be soooo much better for me to host in the cloud.

I look forward to hearing back form you on this, thank you so much!!

Hey there, any updates on this? I recently set up a “droplet” on Digital Ocean… basically an AWS competitor. I still can’t get my local config to upload. I even took down the firewall on the Droplet’s side for testing and no go… so it has something to do with my local config. Any help would be appreciated!

Hi,

I have Grafana and Influxdb working in a docker container on my Synology NAS. I have many Xiaomi devices among which several body sensors. I have made a graphic of 2 body sensors which show the detection of movement with different values between 0 and 1. Does anybody have a clue what makes these values vary. Is that the distance to the body sensor for example?

@zcapr17
There is a bug in influxdb logger.
The last data is being send even if device is in “offline” state. This is due to soft polling simply sending last data even though device is out of battery.

Could you provide a fix for that?

@ady624 how do you read smartthings device offline status in webcore/groovy? I know you must be doing that as there is “status” field in webcore. Thanks in advance.

I’ve been using influxDB Logger for the past two years to log power / energy from power meters in SmartThings. In the last 24 hours these have stopped working with log errors reporting:

postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:150, x-influxdb-error:partial write: field type conflict: input field "value" on measurement "power" is type float, already exists as type string dropped=1, request-id:****, http/1.1 400 bad request:null, x-request-id:****, x-influxdb-build:OSS, content-type:application/json, date:Wed, 04 Dec 2019 02:55:31 GMT, x-influxdb-version:1.7.9], Body: {"error":"partial write: field type conflict: input field \"value\" on measurement \"power\" is type float, already exists as type string dropped=1"}

I cannot figure out what has changed? Has anyone experienced this?

I’ve gotten that error when I changed the data I was sending, in my case from an integer to a float. Influxdb wants any new data to be of the same type as what already exists in the DB. It looks like the logger was sending the value as a string but now it’s sending it as a float. For sure the DB has string data in there so you’ll either have to change it, wipe it out, or change the feed to match the string format.

I have no idea how it changed unless you’re sending something new or the logger changed or influxdb is handing it different.

1 Like

I’m pretty late to the game here with InfluxDB - but have been with ST since the first hub (just recently moved 117 devices to a new V3 hub…). I was using the Google Spreadsheets plug in prior to dump in metrics from devices and then scrape those every minute into an RRDtool for graphing data. But wow… this - LOL - made my day!!


My first pass was to get my temperatures usable again and loving the Discrete visualization! Ready to overlay some of my motion, lights, switches, energy monitors, and thermostats into this same kind of view. Just - yeah - super excited about all of this. And - it’s all locally published on my network so the constant polling to Google is a thing of the past. So in summary - thank you!!

_DS

@zcapr17 any chance to fix it ?

I’ve been using this for a few months now and am really happy with the results. I did discover it wasn’t reporting energy consumption from my Washer and Dryer and patched the code myself to make that work. I have a Samsung Washing Machine WF45R6300AV and Dryer DVE45R6300V.

Patch is available here if anyone needs it.

The following attributes are sent to Influx

  • powerConsumption
  • machineState
  • dryerMode
  • washerMode
  • dryerJobState
  • washerJobState
  • dryerDryLevel
  • washerWaterTemperature
1 Like

Hello guys,
can someone help me. I`m getting such errors in the Live logging console. And there is no data written to the InfluxDB.

6187ecb3-1367-4c4a-beae-5254707fcc00 12:48:50 PM: error postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:342, x-influxdb-error:unable to parse ‘power,deviceId=06c223fe-5633-458b-b8da-bca94e4ffb7e,deviceName=Електромер,groupId=51b24e81-0c70-458d-9df2-d229b1051bb2,groupName=Електромер,hubId=f4e82edf-6ece-483c-a4af-d861b6124731,hubName=SmartThings\ Hub,locationId=0726f3d8-a031-4241-8b39-9a64b8c31df6,locationName=Mansi’: missing fields, request-id:f1c5fb7e-1514-11eb-801b-000c29416d42, http/1.1 400 bad request:null, x-request-id:f1c5fb7e-1514-11eb-801b-000c29416d42, x-influxdb-build:OSS, content-type:application/json, date:Fri, 23 Oct 2020 09:48:46 GMT, x-influxdb-version:1.8.3], Body: {“error”:“unable to parse ‘power,deviceId=06c223fe-5633-458b-b8da-bca94e4ffb7e,deviceName=Електромер,groupId=51b24e81-0c70-458d-9df2-d229b1051bb2,groupName=Електромер,hubId=f4e82edf-6ece-483c-a4af-d861b6124731,hubName=SmartThings\ Hub,locationId=0726f3d8-a031-4241-8b39-9a64b8c31df6,locationName=Mansi’: missing fields”}

6187ecb3-1367-4c4a-beae-5254707fcc00 12:48:50 PM: error postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:351, x-influxdb-error:unable to parse ‘energy,deviceId=06c223fe-5633-458b-b8da-bca94e4ffb7e,deviceName=Електромер,groupId=51b24e81-0c70-458d-9df2-d229b1051bb2,groupName=Електромер,hubId=f4e82edf-6ece-483c-a4af-d861b6124731,hubName=SmartThings\ Hub,locationId=0726f3d8-a031-4241-8b39-9a64b8c31df6,locationName=Mansion,un’: missing tag value, request-id:f1acf45a-1514-11eb-801a-000c29416d42, http/1.1 400 bad request:null, x-request-id:f1acf45a-1514-11eb-801a-000c29416d42, x-influxdb-build:OSS, content-type:application/json, date:Fri, 23 Oct 2020 09:48:46 GMT, x-influxdb-version:1.8.3], Body: {“error”:“unable to parse ‘energy,deviceId=06c223fe-5633-458b-b8da-bca94e4ffb7e,deviceName=Електромер,groupId=51b24e81-0c70-458d-9df2-d229b1051bb2,groupName=Електромер,hubId=f4e82edf-6ece-483c-a4af-d861b6124731,hubName=SmartThings\ Hub,locationId=0726f3d8-a031-4241-8b39-9a64b8c31df6,locationName=Mansion,un’: missing tag value”}

6187ecb3-1367-4c4a-beae-5254707fcc00 12:48:50 PM: error postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:358, x-influxdb-error:unable to parse ‘_stHub,locationId=“0726f3d8-a031-4241-8b39-9a64b8c31df6”,locationName=“Mansion”,hubId=“f4e82edf-6ece-483c-a4af-d861b6124731”,hubName=“SmartThings\ Hub”,hubIP=“192.168.88.248” status=“ACTIVE”,batteryInUse=0i,uptime=nulli,zigbeePowerLevel=8i,zwavePowerLevel=“full”,firmwareVersion=“000.032.00012”’: invalid number, request-id:f194738c-1514-11eb-8019-000c29416d42, http/1.1 400 bad request:null, x-request-id:f194738c-1514-11eb-8019-000c29416d42, x-influxdb-build:OSS, content-type:application/json, date:Fri, 23 Oct 2020 09:48:46 GMT, x-influxdb-version:1.8.3], Body: {“error”:“unable to parse ‘_stHub,locationId=“0726f3d8-a031-4241-8b39-9a64b8c31df6”,locationName=“Mansion”,hubId=“f4e82edf-6ece-483c-a4af-d861b6124731”,hubName=“SmartThings\ Hub”,hubIP=“192.168.88.248” status=“ACTIVE”,batteryInUse=0i,uptime=nulli,zigbeePowerLevel=8i,zwavePowerLevel=“full”,firmwareVersion=“000.032.00012”’: invalid number”}

Hello guys,
I made deep investigation and it looks like the problem is that all my sensors are named on Cyrillic. Some idea how to fix that without renaming all sensors.

Has anyone gotten the logger to work with InfluxDB 2?

Hi,
I encountered a similar issue with some accented characters. I’ve pinpointed the problem in the content-length calculation when the request is sent from the Smartthings Hub.
It must calculate as if each characters is a byte, basically doing data length = data size. But for instance ‘é’ is 2 bytes.

So the only dirty trick I came with is to add some spaces after the ${value}, to force the content length to be increased… I wish I found a better solution :confused: :

else {
    	data += ",unit=${unit} value=${value}    "
        logger("value: $value data: $data","trace")
    }

Let me know if you find something better :slight_smile:

I was able to get this working with InfluxDB 2 by inserting the following code at line 181 of the smartapp. You will need to use an Authentication Token as the password without a user ID. I never could get it to work with a user ID and password although it may be possible.

    } else if (state.databasePass) {
        state.headers.put("Authorization", "Token " + state.databasePass)

You will also need to map the database and retention policy to a bucket. See the InfluxDB 2 documentation for how to do that.

2 Likes

Has anyone used this logger to send to Corlysis InfluxDB? It looks like there was some code in the logger around line 640 to be used for WAN connection that I unREM’d. I remarked out the local LAN section.
I’m not getting any data posted and I’m getting this error:
postToInfluxDB(): Something went wrong when posting: groovyx.net.http.ResponseParseException:
I"m pretty sure I’m getting to Corlysis because if I mismatch the httpS and the port I get an SSL mismatch error and that could only come from the server end I’m pretty sure.
Is there any way at all to see the exact string being sent to InfluxDB?
Has anyone figured out how to do this?

I am getting a lot of error messages in the log for every data which should be logged. Below is one example of what I am talking about:

11:46:59 AM: error groovy.lang.MissingPropertyException: No such property: data for class: script_app_88a447b5fbd0e4669e0e71b539d98b2d35f6b8d531e062c137d8e775bd436820 @line 273 (handleEvent)

33e20e77-7abb-4d52-9223-fabb97967b0e 11:46:59 AM: info handleEvent(): Lux - ude(illuminance:lux) 163

Anyone knows what the problem is here?

Hello Shawn,
Firstly, thank for share.
I’am trying to connect with my InfluxDB, but no luck.
Could you please, help to check if there is something wrong?

I am logging my temperatures (air and floor) and humidity in every room in my house. For some of the rooms, the humidity temperature is off by a factor of 10 even if the data is correct in ST.

  1. How can I fix this?
  2. Is there a way to filter out the spikes in the data?

image

It seems like a factor of 100, as humidity is %.

These are really Grafana questions, you better look at the Grafana documentation how to plot data with different queries.