codersaur / SmartThings

Samsung SmartThings SmartApps and Device Handlers
Apache License 2.0
300 stars 541 forks source link

invalid field format #46

Closed 7c closed 5 years ago

7c commented 5 years ago

given this ngrep towards influxdb 1.6.1

T 93.17.19.201:41240 -> 209.126.18.9:8086 [AP]
  POST /write?db=smartthings HTTP/1.1..Accept: */*..User-Agent: Linux UPnP/1.0 SmartThings..Authorization: Bas
  ic c2xluZ3M6NjcxxxxxxxTcz..Content-Type: application/x-www-form-urlencoded..HOST: 209.126.18.9:8086..Con
  tent-Length: 241....temperature,deviceId=2f6712bd-5b1a-48e4-a9db-329af912120f,deviceName=wc\ kap..,groupId=n
  ull,groupName=Home,hubId=68ac12fa-f184-4d5a-b269-2e87328c293a,hubName=K..y,locationId=cfa4c8f6-63b7-4bd0-b05
  a-bcccf6ea398f,locationName=k..y,unit=C value=25
##
T 209.126.18.9:8086 -> 93.17.19.201:41240 [AP]
  HTTP/1.1 400 Bad Request..Content-Type: application/json..Request-Id: 1f3332c6-32b5-11e9-a2cc-000000000000..
  X-Influxdb-Build: OSS..X-Influxdb-Error: unable to parse 'temperature,deviceId=2f6712bd-5b1a-48e4-a9db-329af
  912120f,deviceName=wc\ kap..,groupId=null,groupName=Home,hubId=68ac12fa-f184-4d5a-b269-2e87328c293a,hubName=
  K..y,locationId=cfa4c8f6-63b7-4bd0-b05a-bcccf6ea398f,locationName=k..y,unit=C value': invalid field format..
  X-Influxdb-Version: 1.6.1..X-Request-Id: 1f3332c6-32b5-11e9-a2cc-000000000000..Date: Sun, 17 Feb 2019 13:08:
  30 GMT..Content-Length: 295....{"error":"unable to parse 'temperature,deviceId=2f6712bd-5b1a-48e4-a9db-329af
  912120f,deviceName=wc\\ kap..,groupId=null,groupName=Home,hubId=68ac12fa-f184-4d5a-b269-2e87328c293a,hubName
  =K..y,locationId=cfa4c8f6-63b7-4bd0-b05a-bcccf6ea398f,locationName=k..y,unit=C value': invalid field format"
  }.

i have tried to debug this issue several hours, all these 'null' will simply be logged as 'null' which is ok. I see the POST contains value=25 and it looks valid format based on

# Line Protocol 
weather,location=us-midwest temperature=82 1465839830100400200
  |    -------------------- --------------  |
  |             |             |             |
  |             |             |             |
+-----------+--------+-+---------+-+---------+
|measurement|,tag_set| |field_set| |timestamp|
+-----------+--------+-+---------+-+---------+

is there something i am doing wrong? I am using unicode char (ö) as "Location" might this be an issue?

7c commented 5 years ago

Ok seems it was the Unicode chars which caused the issue. I have renamed all the devices not to use any unicode char, this solved the problem.