Page 1 of 1

Error: JSON Protocol: Parse Error

Posted: Saturday 08 September 2018 19:08
by heggink
Developing a python plugin for the nuki locks, I get this error on receiving a JSON message.

Code: Select all

2018-09-08 17:51:42.221  (aap) Name: '192.168.1.113:39704', Transport: 'TCP/IP', Protocol: 'JSON', Address: '192.168.1.113', Port: '39704', Baud: 0, Bytes: 0, Connected: True, Last Seen: 2018-09-08 17:51:42
2018-09-08 17:51:43.767  (aap) Pushing 'ReadEvent' on to queue
2018-09-08 17:51:43.775  (aap) Processing 'ReadEvent' message
2018-09-08 17:51:43.775  (aap) Received 241 bytes of data
2018-09-08 17:51:43.775  (aap)     50 4f 53 54 20 2f 20 48 54 54 50 2f 31 2e 30 0d 0a 55 73 65     POST./.HTTP/1.0..Use
2018-09-08 17:51:43.775  (aap)     72 2d 41 67 65 6e 74 3a 20 4e 75 6b 69 42 72 69 64 67 65 5f     r-Agent:.NukiBridge_
2018-09-08 17:51:43.775  (aap)     30 35 36 46 36 31 31 31 0d 0a 48 6f 73 74 3a 20 31 39 32 2e     056F6111..Host:.192.
2018-09-08 17:51:43.775  (aap)     31 36 38 2e 31 2e 31 31 32 0d 0a 43 6f 6e 6e 65 63 74 69 6f     168.1.112..Connectio
2018-09-08 17:51:43.775  (aap)     6e 3a 20 43 6c 6f 73 65 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79     n:.Close..Content-Ty
2018-09-08 17:51:43.775  (aap)     70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e     pe:.application/json
2018-09-08 17:51:43.775  (aap)     3b 63 68 61 72 73 65 74 3d 75 74 66 2d 38 0d 0a 43 6f 6e 74     ;charset=utf-8..Cont
2018-09-08 17:51:43.775  (aap)     65 6e 74 2d 4c 65 6e 67 74 68 3a 20 38 33 0d 0a 0d 0a 7b 22     ent-Length:.83....{"
2018-09-08 17:51:43.776  (aap)     6e 75 6b 69 49 64 22 3a 20 38 39 39 37 30 38 35 37 2c 20 22     nukiId":.89970857,."
2018-09-08 17:51:43.776  (aap)     73 74 61 74 65 22 3a 20 33 2c 20 22 73 74 61 74 65 4e 61 6d     state":.3,."stateNam
2018-09-08 17:51:43.776  (aap)     65 22 3a 20 22 75 6e 6c 6f 63 6b 65 64 22 2c 20 22 62 61 74     e":."unlocked",."bat
2018-09-08 17:51:43.776  (aap)     74 65 72 79 43 72 69 74 69 63 61 6c 22 3a 20 66 61 6c 73 65     teryCritical":.false
2018-09-08 17:51:43.776  (aap)     7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..     }
2018-09-08 17:51:43.776  Error: JSON Protocol: Parse Error on 'POST / HTTP/1.0
User-Agent: NukiBridge_056F6111
Host: 192.168.1.112
Connection: Close
Content-Type: application/json;charset=utf-8
Content-Length: 83

{"nukiId": 89970857, "state": 3, "stateName": "unlocked", "batteryCritical": false}'
plugin opens as follows:

Code: Select all

self.httpServerConn = Domoticz.Connection(Name="Server Connection", Transport="TCP/IP", Protocol="JSON", Port=Parameters["Port"])
self.httpServerConn.Listen()
sent @dnpwwro an pm but maybe someone else already ran into this before?
Ta,
H

Re: Error: JSON Protocol: Parse Error

Posted: Sunday 09 September 2018 2:49
by Dnpwwo
Protocol should be HTTP not JSON, the 'Data' entry in the returned dictionary will have the JSON in it.