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

Bolt cloud error with node.js #10

Open
rishabhAjay opened this issue Mar 25, 2021 · 5 comments
Open

Bolt cloud error with node.js #10

rishabhAjay opened this issue Mar 25, 2021 · 5 comments

Comments

@rishabhAjay
Copy link

This is the error I get when I try to write the code on node.js. What may be the reason?

I have the correct device ID and API key in place of the x's.

nodeCode
node

@0x67
Copy link

0x67 commented May 21, 2021

Did you manage to find a way to fix this?
I also have the same error.

@rishabhAjay
Copy link
Author

rishabhAjay commented May 23, 2021

Did you manage to find a way to fix this?
I also have the same error.

No I couldn't find a way of getting it to work. I used Axios instead to fetch the Bolt Cloud API.
Something like this:

var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://cloud.boltiot.com/remote/'+ process.env.DEVICE_API + '/isOnline?&deviceName=' + process.env.DEVICE_ID,
  headers: { }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

If you want to read more, here is the source: axios API Bolt

@0x67
Copy link

0x67 commented May 23, 2021

My previous workaround was using the python version of bolt-iot + socketio to transfer data in real-time, but it was a hassle configuring the serial (for both sending data & making the device actually do something), plus I reach the API limit easily while testing it so I switch to Johnny-Five instead.

Here's my sample code, just in case anyone else come here with the same problem.
carbon

I think it's a very hacky implementation (the socket-io part), but it works for my case, so if you know the better implementation let me know.

@rishabhAjay
Copy link
Author

My previous workaround was using the python version of bolt-iot + socketio to transfer data in real-time, but it was a hassle configuring the serial (for both sending data & making the device actually do something), plus I reach the API limit easily while testing it so I switch to Johnny-Five instead.

Here's my sample code, just in case anyone else come here with the same problem.
carbon

I think it's a very hacky implementation (the socket-io part), but it works for my case, so if you know the better implementation let me know.

Thanks! Will try Johnny-Five npm package.

@0x67
Copy link

0x67 commented Jun 8, 2021

Thanks! Will try Johnny-Five npm package.

Glad to be a help!

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