Error: Invalid Number
Hey, great app (InfluxDB Logger)... I'm loving it and getting into it, but i am getting an occasional error that i thought you might be able to help me with... below is the output from the ST IDE
5:21:16 PM: error postToInfluxDB(): Something went wrong! Response from InfluxDB: Headers: [content-length:347, x-influxdb-error:unable to parse '_stHub,locationId="xxxxxxxxxxxxxxxxx",locationName="Home",hubId="xxxxxxxxxxxx",hubName="Home\ Hub",hubIP="192.168.1.xx" status="ACTIVE",batteryInUse=0i,uptime=nulli,zigbeePowerLevel=-6i,zwavePowerLevel="full",firmwareVersion="000.019.00019"': invalid number, request-id:xxxxxxxxxxxxxxxxxxx, http/1.1 400 bad request:null, x-request-id:2f1fe878-ec2e-11e7-8045-000000000000, x-influxdb-build:OSS, content-type:application/json, date:Fri, 29 Dec 2017 00:21:16 GMT, x-influxdb-version:1.4.2], Body: {"error":"unable to parse '_stHub,locationId=\"xxxxxxxxxx\",locationName=\"Home\",hubId=\"xxxxxxxxxxxxx\",hubName=\"Home\\ Hub\",hubIP=\"192.168.1.xx\" status=\"ACTIVE\",batteryInUse=0i,uptime=nulli,zigbeePowerLevel=-6i,zwavePowerLevel=\"full\",firmwareVersion=\"000.019.00019\"': invalid number"}
I'm seeing the same issue and decided to do some digging... Looks like getDataValue("uptime") returns null instead of an actual uptime value: uptime=nulli. Influx is expecting an integer there.
The workaround is to disable hub property logging in the SmartApp config which will have no impact to your database since the hub data isn't being successfully written to the DB anyway.
Fixing the issue requires either:
- Removing the uptime check from the code
- Checking uptime another way - per the following article, may need to figure out boot time instead and then calculate uptime using that? https://community.smartthings.com/t/hub-firmware-beta-19-16/104659/16
Submitted a fix here: https://github.com/codersaur/SmartThings/pull/33