Over bluetooth, these commands should be sent as binary
Over USB and Wifi, these commands should be sent as Hex strings
Also see the older Decent Scale API Docs. The Half Decent Scale is compatible with that command set, but adds a substantial number of new commands
A python library is also available
Javascript apps and weighing library (supporting Bluetooth, USB and Wifi!)
New 'heartbeat' feature solves connectivity issues with Android 9 and older.
Commands that HDS can receive(v2.5.8)
03 0F TARE (with checksum)
(please read the note above regarding the heartbeat feature)
03 0A 00 Turn off oled
03 0A 01 Turn on oled
(please read the note above regarding the heartbeat feature)
03 0A 02 Power off
03 0A 03 00 Exit power mode, normal oled brightness
03 0A 03 01 Enter power mode, lowest oled brightness
03 0B 00 Timer stop
03 0B 02 Timer reset
03 0B 03 Timer start
03 1A 00 Manual Calibration
03 1A 01 Smart Calibration
03 1B WiFi OTA
03 1D 00 Set sample to 1
03 1D 01 Set sample to 2
03 1D 02 Set sample to 4
03 1E 00 00 Hide Menu
03 1E 00 01 Show Menu
03 1E 01 00 Hide About info
03 1E 01 01 Show About info
03 1E 02 00 Hide debug info
03 1E 02 01 Show debug info
03 1F Reset
03 20 00 Disable Weight via USB
03 20 01 Enable Weight via USB
03 22 Send Battery voltage data once
data = modelByte;
data = 0xCE; // Type byte for weight stable
data = weightByte1;
data = weightByte2;
data = 0x00;
data = 0x00;
data = calculateXOR(data, 6); // Last byte is XOR validation
data = modelByte;
data = 0xAA; // Type byte for weight stable
data = buttonNumber;//1 for O button, 2 for ▢ button
data = buttonShortPress;//1 for short press, 2 for long press
// Fill the rest with dummy data or real data as needed
data = 0x00;
data = 0x00;
data = calculateXOR(data, 6); // Last byte is XOR validation
data = modelByte;
data = 0x2A;
data = buttonNumber;
data = buttonShortPress;
data = 0x00;
data = 0x00;
data = calculateXOR(data, 6); // Last byte is XOR validation
data = modelByte;
data = 0x22;
data = voltageByte1;
data = voltageByte2;
data = 0x00;
data = 0x00;
data = calculateXOR(data, 6); // Last byte is XOR validation
You can connect a USBC cable and used a program such as Serial with settings of 115200,8,N,1 to watch the scale in operation. This makes debugging extremely easy.
#programmer #api #bluetooth #wifi #usb