arhea / tplink-hs100

đŸ”Œ A home hub for the TPLink HS 100 Smart Plugs. Discovers plugs on the same network as the hub and allows them to be turned on and off.
9 stars 6 forks source link

Often crashes, json cut off #1

Open andrewmacheret opened 7 years ago

andrewmacheret commented 7 years ago

Docker image crashes often when calling http://localhost:3000/plugs with the following output:

{"emeter":{"err_code":-2001,"err_msg":"Module not support"},"schedule":{"err_code":-2001,"err_msg":"Module not support"},"system":{"get_sysinfo":{"sw_ver":"1.4.3 Build 170504 Rel.144921","hw_ver":"1.0","model":"LB100(US)","description":"Smart Wi-Fi LED Bulb with Dimmable Light","alias":"<ALIAS>","mic_type":"IOT.SMARTBULB","dev_state":"normal","mic_mac":"<MIC_MAC>","deviceId":"<DEVICE_ID>","oemId":"<OEM_ID>","hwId":"<HW_ID>","is_factory":false,"disco_ver":"1.0","ctrl_protocols":{"name":"Linkie","version":"1.0"},"light_state":{"on_off":0,"dft_on_state":{"mode":"normal","hue":0,"saturation":0,"color_temp":2700,"brightness":100}},"is_dimmable":1,"is_color":0,"is_variable_color_temp":0,"preferred_state":[{"index":0,"hue":0,"saturation":0,"color_temp":2700,"brightness":100},{"index":1,"hue":0,"saturation":0,"color_temp":2700,"brightness":75},{"index":2,"hue":0,"saturation":0,"color_temp":2700,"brightness":25},{"index":3

SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at Socket.socket.on (/usr/src/app/node_modules/hs100-api/lib/plug.js:44:21)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)

npm ERR! Linux 4.9.28+
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! tplink-hs100@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tplink-hs100@1.0.0 start script 'node index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the tplink-hs100 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs tplink-hs100
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls tplink-hs100
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log
andrewmacheret commented 7 years ago

Looks like there's a new version of hs100-api 0.4.0, but when I switch to that version in package.json, I run into a new issue: https://github.com/plasticrake/hs100-api/issues/8