robertklep / bosch-xmpp

Protocol implementation for Bosch XMPP protocols
MIT License
47 stars 8 forks source link

unexpected token in JSON #44

Open Ansula1267 opened 12 months ago

Ansula1267 commented 12 months ago

When trying to get information from a CT200 thermostat using bosch-xmpp easycontrol get /

I get the following error:

SyntaxError: Unexpected token  in JSON at position 0 at JSON.parse () at /usr/lib/node_modules/bosch-xmpp/lib/base-client.js:224:30 at tryCatcher (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/bosch-xmpp/node_modules/bluebird/js/release/async.js:15:14)

During installation of bosch-xmpp I got several warnings regarding deprecated packages npm i -g bosch-xmpp npm WARN deprecated node-xmpp-client@3.2.0: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated node-xmpp-core@5.0.9: this package is deprecated please use https://github.com/xmppjs/xmpp.js npm WARN deprecated node-xmpp-tls-connect@1.0.1: this package is deprecated please use https://github.com/xmppjs/xmpp.js npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. /usr/bin/bosch-xmpp -> /usr/lib/node_modules/bosch-xmpp/bin/bosch-xmpp

Can the errors be the result of these deprecated packages? If so, how to make sure the correct versions are used? (I have seen the links in the warnings, but I don't know how use/install these.)

I am running a raspberry3 with Linux 11 bullseye, with node -v v14.21.3 npm -v 6.14.18

robertklep commented 12 months ago

JSON parse errors are caused by using an incorrect password. If you're sure you're using the correct one, sometimes it helps "downgrading" to a more simple password (only letters and numbers) of limited length (8 to 10 characters).

Ansula1267 commented 12 months ago

Thanks for your quick reply! I changed the password to an 8-character string (lowercase, uppercase and digits) but got the same error message. I assume that the cli parameters --serial and --access-key are for the thermostat device (supplied by the manufacturer) and --password is for the Bosch login (set/changed by me).

robertklep commented 12 months ago

That's correct. The serial number and access key are used to connect to the XMPP server, and the password is used to encrypt/decrypt the data going to/coming from your thermostat.

You can run the CLI tool with debug logging enabled, perhaps that provides a clue why it's not working for you:

$ env DEBUG=* bosch-xmpp easycontrol get /

If you don't want to share the log on a public medium like Github, feel free to e-mail it to me (robert AT klep DOT name).