Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
read tempreture from bluetooth device with web bluetooth

I am facing some problems with web Bluetooth API. the problem is that I have a temperature and humidity recorder Bluetooth device, which recorded temperature and humidity data through the sensor. I want to fetch that data in my web app by using web Bluetooth in javascript. so how can I perform this task?

I have tried web Bluetooth but I only get device name and battery level but I am not able to fetch temperature & humidity data.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

If the Bluetooth device uses the GATT Environmental Sensing service (GATT Assigned Number 0x181A), you should be able to read and get notified of the Temperature (0x2A6E) and Humidity (0x2A6F) GATT characteristics.

Here's some code that should* work.

const serviceUuid = 0x181A;

// Requesting Bluetooth Device assuming it advertises
// the GATT Environmental Sensing Service...
const device = await navigator.bluetooth.requestDevice({
    filters: [{services: [serviceUuid]}]});

// Connecting to GATT Server...
const server = await device.gatt.connect();

// Getting Environmental Sensing Service...
const service = await server.getPrimaryService(serviceUuid);

// Getting Humidity Characteristic...
const characteristic = await service.getCharacteristic(0x2A6F);

// Reading Humidity...
const value = await characteristic.readValue();
console.log(value);

The sample at https://googlechrome.github.io/samples/web-bluetooth/notifications.html?characteristic=humidity&service=environmental_sensing may also help you get started.

about 4 years ago · Juan Pablo Isaza Report

0

You need to know what Bluetooth GATT service provides the temperature and humidity data. Applications like "nRF Connect" and the about://bluetooth-internals page built into your browser can help you explore the services provided by the device.

Web Bluetooth requires you to pass the UUIDs of the services you want to access to the navigator.bluetooth.requestDevice() function and so you need to figure out which GATT services you want to access before they will be visible on the BluetoothRemoteGATTServer object provided by the API.

If you post the manufacturer and model information for the device as part of the question someone may be able to direct you to documentation from the manufacturer for the GATT services the device provides or someone who has already reverse engineered how to access the data you are looking for.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!