Error: JSON Protocol: Parse Error

Python and python framework
Post Reply
User avatar
heggink
Posts: 598
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V4.9999
Location: NL
Contact:

Error: JSON Protocol: Parse Error

Post by heggink » Saturday 08 September 2018 19:08

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
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

User avatar
Dnpwwo
Posts: 758
Joined: Sunday 23 March 2014 10:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Error: JSON Protocol: Parse Error

Post by Dnpwwo » Sunday 09 September 2018 2:49

Protocol should be HTTP not JSON, the 'Data' entry in the returned dictionary will have the JSON in it.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests