Recently I have been gaining weight and blaming it all on the COV-19 (jira issue).
So I thought I have to manage my food intake and count calories therefore I did what I do best, procrastinate and try to do other stuff while still thinking about the task at hand.
All of this + Amazon and my interest in IoT somehow convinced me to buy Etekcity Smart Nutrition Food Calorie Kitchen Digital Scale.
Having hard time waking next day after late night impulse buying, I tried the device, played a bit with the (meh) app and realized that this is just an overpriced kitchen scale with app function whose sole reason is data mining. After installing in VeSync app and skipping as much of the registration as possible and playing enough with it, I decided to try and somehow gain control of the device without having to use the (meh) app.
Before I go into technical details I would like to mention that I have never worked with BLE devices before. Being armed with 0 technical knowledge of Bluetooth Low energy I was (not) equipped with all the knowledge I need and (definitely not) ready to start hacking.
Having dabbled in some other IoT devices (ESP) my first instinct was to disassemble the device and try to find how this thing worked. I was hoping I could find the microcontroller name and model or some debug ports exposed and labeled but I was disappointed to see this.
PCB was labeled here and there but it was not too helpful as they were just "component ids" to pick and place. The communications device had some information for me.
The communications module is for Bluetooth 4 which is something that I can start investigating.
Next step was to try to somehow find how to communicate to this and maybe someone else has already done some hacking 💔 on this but I was not able to find information for this device 💔 . The one of the projects that was relatable to this was oliexdev/openScale
Open-source weight and body metrics tracker, with support for Bluetooth scales
Monitor and track your weight, BMI, body fat, body water, muscle and other body metrics in an open source app that:
- has an easy to use user interface with graphs,
- supports various Bluetooth scales,
- doesn't require you to create an account,
- can be configured to only show the metrics you care about, and
- respects your privacy and lets you decide what to do with your data.
Supported Bluetooth scales
openScale has built-in support for a number of Bluetooth (BLE or "smart") scales from many manufacturers, e.g. Beurer, Sanitas, Yunmai, Xiaomi, etc. (see model list below). Together with our users we constantly improve and extend the set…
But it was only targeted towards body weight scales 💔.
I was also able to find a github issue asking about this particular device and model and it was rejected for obvious reason 💔.
Hi it's great app. it works like a charm for almost all devices. Thanks for this great creation. recently i bought new weight measurement scale of ETEKCITY and it is not supported by this app.
here the debug log file attached with your debug app
More debug Log, openScale_2019-10-17_16-04_new.txt
Let me know if the above is sufficient or should I need to give more.
I love JS and Node.JS and I felt confident (for some weird reason) in worst case scenario I could use some linux tools with
child_process or even hack something in
C to communicate using BLE (via USB). It was already getting late and I was getting delirious :D .
Now I'm here and I want to be able to at least get the measurements read. I quickly googled up a module for node which was a good start.
A Node.js BLE (Bluetooth Low Energy) central module.
Want to implement a peripheral? Checkout bleno
Note: macOS / Mac OS X, Linux, FreeBSD and Windows are currently the only supported OSes. Other platforms may be developed later on.
- install Xcode
- Kernel version 3.6 or above
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
node is on your path, if it's not, some options:
sudo ln -s /usr/bin/nodejs /usr/bin/node
- install Node.js using the NodeSource package
Fedora / Other-RPM based
sudo yum install bluez bluez-libs bluez-libs-devel
Make sure you have GNU Make:
sudo pkg install gmake
Disable automatic loading of the default Bluetooth stack by putting no-ubt.conf into
/usr/local/etc/devd/no-ubt.conf and restarting devd (
sudo service devd restart).
ng_ubt kernel module if already loaded:
sudo kldunload ng_ubt
And starting hacking away and logging output. With some luck and more luck I was able to guess the correct service, characteristic and ended up with some notes where I could start looking at the protocol.
And around 4 am in the morning finished writing the README and finally tired enough to just go to bed and rest.
ETEKCITY Smart Nutrition Scale
This is a potential project that tries to reverse engineer the BLE protocol that ETEKCITY Smart Nutrition Scale (ESN00) uses.
This section describes the protocol (what was researched so far)
Device address is random so the way to find it is based on the advertisement name (tested) or manufacturer data (not tested)
Device reports weight and status on service
1801 and characteristic
All packets have this structure
Data packet depends on the packet type values:
||1 byte||Error mode is triggered or reset||
||1 byte||Tare is updated (set) or reset||
||1 byte||Item is|
I would like to write (at least half-) decent library to listen and possibly control the big display with nutritional information from outside the app. For now I need an Android device to sniff the packets and analyze the result.
I actually do not know which device to choose so maybe one late night I will pick a random cheap Android phone and invest more in my procrastination or maybe someone will tell me in comments which one to go for ¯\_(ツ)_/¯ .
The end goal would (probably) be to have it integrate with homebridge or home-assistant and have it comfortably enable the nutritional value display based on voice commands.