Hello all!
I am having an issue writing to a FLUX ble light bulb via my ionic app. The app scans, and connects just fine but cannot figure out how to write the value to the bulb to turn it on/off. I have snooped the ble packets with my device for their native app and discovered that payload value for turning the bulb off is “CC2433”. Will post my code below for my app for trying to write this value.
this.ble.write(“3C:A3:08:A8:1E:C3”, “ffe5”, “ffe9”, this.off() )
.then(result => {
console.log(‘Write successfuly’,result);
}).catch(error => {
alert(JSON.stringify(error));
});
off() {
let string = “CC2433”;
let array = new Uint8Array(string.length);
for (let i = 0, l = string.length; i <= l; i ++) {
array[i] = string.charCodeAt(i);
}
console.log(array.buffer);
return array.buffer;
}
I get no errors after attempting to write to the ble device, however nothing happens either. I have also used nRF Connect app to connect to the BLE device and send that value, and it works. I am sure I am doing something simple wrong. If anyone has any thoughts would greatly appreciate it, thank you!