sahilchaddha / homebridge-yeelight-platform

Homebridge plugin for Yeelight Lights supporting Scenes/Moods/Color Flow/Custom Presets/Music Flow/Night Mode
MIT License
58 stars 7 forks source link

Unexpected token error #6

Closed Hopflnger closed 5 years ago

Hopflnger commented 5 years ago

I encountered several syntax errors during color change in the home kit app with the yeelight color bulbs v1.

[2018-12-10 12:26:25] [Yeelight-Platform] Sending Command to LightBulb0x000000000335ef1f power off [2018-12-10 12:26:26] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 power off [2018-12-10 12:26:27] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 power on [2018-12-10 12:26:27] [Yeelight-Platform] Sending Command to LightBulb0x000000000335ef1f power on [2018-12-10 12:26:32] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 255 [2018-12-10 12:26:32] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 68 [2018-12-10 12:26:34] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 30 [2018-12-10 12:26:34] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 67 [2018-12-10 12:26:36] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 30 [2018-12-10 12:26:36] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 48 [2018-12-10 12:26:37] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 ct 366 [2018-12-10 12:26:37] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 251 [2018-12-10 12:26:37] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 5 [2018-12-10 12:26:41] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 brightness 44 [2018-12-10 12:26:41] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 power on [2018-12-10 12:26:42] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 brightness 99 [2018-12-10 12:26:42] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 power on [2018-12-10 12:26:42] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 brightness 100 [2018-12-10 12:26:42] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 power on [2018-12-10 12:26:49] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 210 [2018-12-10 12:26:49] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 20 [2018-12-10 12:26:49] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 201 [2018-12-10 12:26:49] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 23 [2018-12-10 12:26:50] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 161 [2018-12-10 12:26:50] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 32 [2018-12-10 12:26:50] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 87 [2018-12-10 12:26:50] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 100 [2018-12-10 12:26:51] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 49 [2018-12-10 12:26:51] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 71 [2018-12-10 12:26:51] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 349 [2018-12-10 12:26:51] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 51 [2018-12-10 12:26:52] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 303 [2018-12-10 12:26:52] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 54 [2018-12-10 12:26:53] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 hue 241 [2018-12-10 12:26:53] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 saturation 23 SyntaxError: Unexpected token { in JSON at position 65 at JSON.parse () at YeeDevice.didReceiveResponse (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:93:29) at Socket.socket.on (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:50:12) at Socket.emit (events.js:180:13) at addChunk (_stream_readable.js:274:12) at readableAddChunk (_stream_readable.js:261:11) at Socket.Readable.push (_stream_readable.js:218:10) at TCP.onread (net.js:581:20) <Buffer 7b 22 6d 65 74 68 6f 64 22 3a 22 70 72 6f 70 73 22 2c 22 70 61 72 61 6d 73 22 3a 7b 22 73 61 74 22 3a 35 34 2c 22 68 75 65 22 3a 33 30 33 2c 22 72 67 ... >

Hopflnger commented 5 years ago

[2018-12-10 12:52:53] [Yeelight-Platform] Sending Command to LightBulb0x000000000335ef1f power on SyntaxError: Unexpected token { in JSON at position 28 at JSON.parse () at YeeDevice.didReceiveResponse (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:93:29) at Socket.socket.on (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:50:12) at Socket.emit (events.js:180:13) at addChunk (_stream_readable.js:274:12) at readableAddChunk (_stream_readable.js:261:11) at Socket.Readable.push (_stream_readable.js:218:10) at TCP.onread (net.js:581:20) <Buffer 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f 6b 22 5d 7d 0d 0a 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f ... > SyntaxError: Unexpected token { in JSON at position 28 at JSON.parse () at YeeDevice.didReceiveResponse (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:93:29) at Socket.socket.on (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:50:12) at Socket.emit (events.js:180:13) at addChunk (_stream_readable.js:274:12) at readableAddChunk (_stream_readable.js:261:11) at Socket.Readable.push (_stream_readable.js:218:10) at TCP.onread (net.js:581:20) <Buffer 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f 6b 22 5d 7d 0d 0a 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f ... > [2018-12-10 12:52:54] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 brightness 86 [2018-12-10 12:52:54] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 power on [2018-12-10 12:52:54] [Yeelight-Platform] Sending Command to LightBulb0x000000000335ef1f brightness 86 [2018-12-10 12:52:54] [Yeelight-Platform] Sending Command to LightBulb0x000000000335ef1f power on SyntaxError: Unexpected token { in JSON at position 28 at JSON.parse () at YeeDevice.didReceiveResponse (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:93:29) at Socket.socket.on (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:50:12) at Socket.emit (events.js:180:13) at addChunk (_stream_readable.js:274:12) at readableAddChunk (_stream_readable.js:261:11) at Socket.Readable.push (_stream_readable.js:218:10) at TCP.onread (net.js:581:20) <Buffer 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f 6b 22 5d 7d 0d 0a 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f ... > SyntaxError: Unexpected token { in JSON at position 28 at JSON.parse () at YeeDevice.didReceiveResponse (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:93:29) at Socket.socket.on (/usr/local/lib/node_modules/homebridge-yeelight-platform/node_modules/yeelight-platform/src/device.js:50:12) at Socket.emit (events.js:180:13) at addChunk (_stream_readable.js:274:12) at readableAddChunk (_stream_readable.js:261:11) at Socket.Readable.push (_stream_readable.js:218:10) at TCP.onread (net.js:581:20) <Buffer 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f 6b 22 5d 7d 0d 0a 7b 22 69 64 22 3a 2d 31 2c 20 22 72 65 73 75 6c 74 22 3a 5b 22 6f ... > [2018-12-10 12:52:54] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 brightness 100 [2018-12-10 12:52:54] [Yeelight-Platform] Sending Command to LightBulb0x00000000036d4655 power on

sahilchaddha commented 5 years ago

Hey @Hopflnger, You can ignore these errors. These errors are intentionally thrown only for debug purposes. Sometimes the response from Lights are not in perfect JSON format. And the response is not used by the plugin itself. This should not affect any plugin's functionality.

Hopflnger commented 5 years ago

Thank you for the answer :)