Skip to content

Simple bluetooth connector for Mi Band 4 (Node.js)

Notifications You must be signed in to change notification settings

VladKolerts/miband4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miband4

Simple bluetooth connector for Mi Band 4 (Node.js)

Setup

npm i miband4

Example

Sending notifications

const MiBand4 = require('./index');
const {NOTIFICATION_TYPES} = MiBand4.constants();
const mac = 'E3:4D:12:48:5C:FD'; // set your miband4 address

async function send(message) {
  const mi = new MiBand4();
  await mi.connect(mac);

  const revision = await mi.getRevision();
  const hrdw_revision = await mi.getHRDWRevision();
  const serial = await mi.getSerial();
  const current_time = await mi.getTime();
  const battery = await mi.getBattery();

  console.log({
  	revision,
  	hrdw_revision,
  	serial,
  	current_time,
  	battery,
  })

  await mi.sendNotification(message, NOTIFICATION_TYPES.msg);

  await mi.disconnect();
}

send('Привет world');

Notification types

Type Description
msg Text with message icon
sms Text with sms icon
missed Text with missed call icon
call Call notification with text

About

Simple bluetooth connector for Mi Band 4 (Node.js)

Resources

Stars

Watchers

Forks

Packages

No packages published