It works by placing a small steel ball inside the plastic bottle. The sensor is able to determine distance based on magnetism. I don't know if it is an internal pressure switch or what. But you start by placing the ball on top of the sensor to zero out. This has to be done for each size ball that is used.
I can handle to coding but I need guidance on a source for the sensor.
It will use an internal permanent magnet and a hall-sensor in the tip to measure the
degree to which the field-lines bunch up due to the ball. Because it uses static magnetic
field it works through non-ferrous metals (more precisely non-ferro-magnetic materials).
The balls supplied will be magneticaly soft iron I believe, since steel tends to acquire
and hold magnetism which is going to skew readings. Good luck finding such balls...