Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected token in JSON #44

Open
Ansula1267 opened this issue Jul 28, 2023 · 3 comments
Open

unexpected token in JSON #44

Ansula1267 opened this issue Jul 28, 2023 · 3 comments

Comments

@Ansula1267
Copy link

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 [email protected]: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client
npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: this package is deprecated please use https://github.com/xmppjs/xmpp.js
npm WARN deprecated [email protected]: this package is deprecated please use https://github.com/xmppjs/xmpp.js
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: 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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants