Tuesday, 5 May 2020

Connect and read data from a Bluetooth device with NodeJs?

I have a small hygrometer/thermometer that is bluetooth and comes with a proprietary application that connects to it to read it's data. The device is meant to connect to your smartphone via the app. The device doesn’t show up for connection unless you’re in the application. For example it doesn’t show up on my Mac.The issue I am really wanting to solve is that obviously I need to be in range of the bluetooth to be able to connect and read data from the device. But I want to be able to monitor it when I am not home. What I was thinking about was keeping a laptop connected to this device, and then running a node server locally that sends the data readings every few minutes to a hosted database, where I then could build a small application that can consume the data sent to the database.In my limited research, I found this: https://www.npmjs.com/package/node-bluetooth Which looks like it would help me immensely. And also this post from Google: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-webI am a bit ignorant on how bluetooth works in terms of how something like your phone for example, actually connects to the BT device. Is it reading an address 'broadcasted' out from the BL device? Would I need a MAC address for the device or something along those lines? I guess I am struggling to understand how that even using the aforementioned library, I actually connect to the device. I think I would need some sort of address to even do that. Furthermore, is it possible this device doesn't allow connections from anywhere other than through it's proprietary application? Excuse my ignorance with this again, this is something I just started diving into this afternoon.It's maybe not so practical, but I want to see if I can do something like this using just Javascript.

Submitted May 06, 2020 at 12:06AM by skidmark_zuckerberg

No comments:

Post a Comment