Integration of Medisana BS440 Connected scale
Moderator: leecollings
- Keptenkurk
- Posts: 103
- Joined: Wednesday 21 August 2013 17:24
- Target OS: -
- Domoticz version:
- Location: Waalre, The Netherlands
- Contact:
Integration of Medisana BS440 Connected scale
Finally, 2 years after buying my Medisana BS440 Connect scale (see post) i managed to get it connected to Domoticz.
Connection uses a dedicated Pi2 near the scale which is equiped with Bluetooth and Wireless adapters (or a Pi3 could be used).
A Python program polls activity at the scale and upon reception of data e-mails last 3 weighings and updates the appropriate Domoticz virtual BWR102 scale.
<shameles promotion>
Code can be found at Github and a description at my blog.
</shameles promotion>
Have fun!
Connection uses a dedicated Pi2 near the scale which is equiped with Bluetooth and Wireless adapters (or a Pi3 could be used).
A Python program polls activity at the scale and upon reception of data e-mails last 3 weighings and updates the appropriate Domoticz virtual BWR102 scale.
<shameles promotion>
Code can be found at Github and a description at my blog.
</shameles promotion>
Have fun!
-
- Posts: 5
- Joined: Monday 04 April 2016 15:16
- Target OS: -
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
Really,
Very nice.!
Very nice.!
-
- Posts: 5
- Joined: Friday 21 August 2015 21:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
Hello I have a BS444 and want to connect it.
Does this code already found his way in an official release?
Does this code already found his way in an official release?
- Keptenkurk
- Posts: 103
- Joined: Wednesday 21 August 2013 17:24
- Target OS: -
- Domoticz version:
- Location: Waalre, The Netherlands
- Contact:
Re: Integration of Medisana BS440 Connected scale
@scarabe
No. It's not widely used anyway. And i remember a post of Gizmocuz questioning the use of a body scale in a home automation system.
On the other hand: The BS444 appears to be using the same protocol so the published code can be used for the BS444 too. But only as a separate add-on.
/paul
No. It's not widely used anyway. And i remember a post of Gizmocuz questioning the use of a body scale in a home automation system.
On the other hand: The BS444 appears to be using the same protocol so the published code can be used for the BS444 too. But only as a separate add-on.
/paul
-
- Posts: 5
- Joined: Friday 21 August 2015 21:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
I try to follow your instruction but i'm failing to install Gatttool:
If I enter
wget https://www.kernel.org/pub/linux/blueto ... 5.4.tar.xz tar xvf bluez-5.4.tar.xz
I get wget: symbol lookup error: /lib/arm-linux-gnueabihf/libc.so.6: undefined symbol: error_one_per_line, version GLIBC_2.4
If I enter
wget https://www.kernel.org/pub/linux/blueto ... 5.4.tar.xz tar xvf bluez-5.4.tar.xz
I get wget: symbol lookup error: /lib/arm-linux-gnueabihf/libc.so.6: undefined symbol: error_one_per_line, version GLIBC_2.4
-
- Posts: 5
- Joined: Friday 21 August 2015 21:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
now it downloaded and it's unpacked
but if I enter
./configure --disable-systemd
.....
-->checking whether the C compiler works... no
in the log file I get
gcc: Internal error: Segmentation fault (program cc1)
looks like gcc does not work well what do I need to do?
but if I enter
./configure --disable-systemd
.....
-->checking whether the C compiler works... no
in the log file I get
gcc: Internal error: Segmentation fault (program cc1)
looks like gcc does not work well what do I need to do?
- Keptenkurk
- Posts: 103
- Joined: Wednesday 21 August 2013 17:24
- Target OS: -
- Domoticz version:
- Location: Waalre, The Netherlands
- Contact:
Re: Integration of Medisana BS440 Connected scale
I'm no expert but from this info you might try to do a:
apt-get install build-essential
Maybe Bluez is available as a pre compiled package.
These were the exact steps i did on y install:
I recall that i did a ctrl-c after the make because there was no output to the console for quite a few minutes. Just had to be more patient (check to see that the compiler is still busy in a seconde ssh window with the "top" command).
BTW my system is a separate Raspberry with RASPBIAN JESSIE LITE 2016-02-09, not the Domoticz image.
/paul
apt-get install build-essential
Maybe Bluez is available as a pre compiled package.
These were the exact steps i did on y install:
Code: Select all
sudo apt-get install libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libical-dev libreadline-dev libudev-dev libusb-dev make
mkdir -p work/bluepy
cd work/bluepy
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.37.tar.xz
tar xvf bluez-5.37.tar.xz
cd bluez-5.37
./configure --disable-systemd
make
...30 min...
sudo make install
BTW my system is a separate Raspberry with RASPBIAN JESSIE LITE 2016-02-09, not the Domoticz image.
/paul
-
- Posts: 5
- Joined: Friday 21 August 2015 21:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
Hello,
I managed to install bluez by doing reinstalling a domoticz pi:
and then as u said run:
# wget https://www.kernel.org/pub/linux/blueto ... 5.4.tar.xz
# tar xvf bluez-5.4.tar.xz
# apt-get install libusb-dev libdbus-1-dev libglib2.0-dev automake libudev-dev libical-dev libreadline-dev
# cd bluez-5.4
# ./configure --disable-systemd
# make
# make install
# cp attrib/gatttool /usr/local/bin/
it run all complete without any errors
but now at the end I'm not able to run
btmgmt
nor
btmgmt le on
It always responds btmgmt command not found
I'm epecting btmgmt to be in the bluez folder below tools and I found there the btmgmt.c file but no application.
I also found:
https://urbanjack.wordpress.com/2014/06 ... e-ibeacon/
and run this commands --enable-tools to reconfigure bluez with
But still no progress
Any iddea?
I managed to install bluez by doing reinstalling a domoticz pi:
and then as u said run:
# wget https://www.kernel.org/pub/linux/blueto ... 5.4.tar.xz
# tar xvf bluez-5.4.tar.xz
# apt-get install libusb-dev libdbus-1-dev libglib2.0-dev automake libudev-dev libical-dev libreadline-dev
# cd bluez-5.4
# ./configure --disable-systemd
# make
# make install
# cp attrib/gatttool /usr/local/bin/
it run all complete without any errors
but now at the end I'm not able to run
btmgmt
nor
btmgmt le on
It always responds btmgmt command not found
I'm epecting btmgmt to be in the bluez folder below tools and I found there the btmgmt.c file but no application.
I also found:
https://urbanjack.wordpress.com/2014/06 ... e-ibeacon/
and run this commands --enable-tools to reconfigure bluez with
But still no progress
Any iddea?
- Keptenkurk
- Posts: 103
- Joined: Wednesday 21 August 2013 17:24
- Target OS: -
- Domoticz version:
- Location: Waalre, The Netherlands
- Contact:
Re: Integration of Medisana BS440 Connected scale
I googled this and it appears that btmgmt is not installed per default (here)
It looks like that
./configure --disable-systemd
should be
./configure --disable-systemd --enable-tools
and copy the btmgmt to /usr/local/bin when done
it's been a while but recall having done something like this
/paul
It looks like that
./configure --disable-systemd
should be
./configure --disable-systemd --enable-tools
and copy the btmgmt to /usr/local/bin when done
it's been a while but recall having done something like this

/paul
-
- Posts: 5
- Joined: Friday 21 August 2015 21:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
Hello,
I managed to install it.
The problem is that the version bluez-5.4.tar.xz does not install the btmgmt like it should, using the version bluez-5.41.tar.xz made the difference.
No I can run sudo btmgmt le on, as well as gattool.
But I have still an issue:
Then I run sudo python BS440.py &
I get BS440.log
Sun, 11 Sep 2016 19:48:17 DEBUG start gatttool_cmd=gatttool -i hci0 -I
Sun, 11 Sep 2016 19:48:18 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:48:18 INFO run Running...
Sun, 11 Sep 2016 19:48:28 INFO scan Found 0 BLE devices
Sun, 11 Sep 2016 19:48:28 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:48:28 ERROR scan Unexpected error when scanning
Sun, 11 Sep 2016 19:48:51 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:48:51 ERROR scan Unexpected error when scanning
Sun, 11 Sep 2016 19:48:52 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:49:02 INFO scan Discovered D6:DC:42:2A:B9:A8 (013197A8B92A42DCD6)
Sun, 11 Sep 2016 19:49:02 INFO scan Found 1 BLE devices
Sun, 11 Sep 2016 19:49:03 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:49:03 ERROR scan Unexpected error when scanning
sudo gatttool -i hci0 -b D6:DC:42:2A:B9:A8 -I
connect
Error: connect error: Transport endpoint is not connected (107)
Any iddeaa what is going wrong?
I managed to install it.
The problem is that the version bluez-5.4.tar.xz does not install the btmgmt like it should, using the version bluez-5.41.tar.xz made the difference.
No I can run sudo btmgmt le on, as well as gattool.
But I have still an issue:
Then I run sudo python BS440.py &
I get BS440.log
Sun, 11 Sep 2016 19:48:17 DEBUG start gatttool_cmd=gatttool -i hci0 -I
Sun, 11 Sep 2016 19:48:18 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:48:18 INFO run Running...
Sun, 11 Sep 2016 19:48:28 INFO scan Found 0 BLE devices
Sun, 11 Sep 2016 19:48:28 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:48:28 ERROR scan Unexpected error when scanning
Sun, 11 Sep 2016 19:48:51 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:48:51 ERROR scan Unexpected error when scanning
Sun, 11 Sep 2016 19:48:52 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:49:02 INFO scan Discovered D6:DC:42:2A:B9:A8 (013197A8B92A42DCD6)
Sun, 11 Sep 2016 19:49:02 INFO scan Found 1 BLE devices
Sun, 11 Sep 2016 19:49:03 INFO scan Starting BLE scan
Sun, 11 Sep 2016 19:49:03 ERROR scan Unexpected error when scanning
sudo gatttool -i hci0 -b D6:DC:42:2A:B9:A8 -I
connect
Error: connect error: Transport endpoint is not connected (107)
Any iddeaa what is going wrong?
- Keptenkurk
- Posts: 103
- Joined: Wednesday 21 August 2013 17:24
- Target OS: -
- Domoticz version:
- Location: Waalre, The Netherlands
- Contact:
Re: Integration of Medisana BS440 Connected scale
Hi Scarabee,
Good to see you didn't give up!
Trying to see what's going on using gatttool on the commandline is a good way of debugging as you found out (in fact, pygatt runs gatttool to talk to BT devices). The problem with using gatttool when talking to the scale is that it's just switched on for a minute or so. So you really gotta be quick in typing the commands.
As to your question:
1. Try running gatttool with the "random" option like:
sudo gatttool -i hci0 -t random -b D6:DC:42:2A:B9:A8 -I
2. Also you can check if just switching on LE is enough. You might also need to switch BREDR off. The whole sequence becoming:
$ sudo hciconfig hci0 down
$ sudo ./btmgmt le on
$ sudo ./btmgmt bredr off
hci0 Set BR/EDR complete, settings: connectable bondable le
$ sudo hciconfig hci0 up
$ sudo hciconfig hci0 leadv
That's what i got from my notes (later it appeared that "btmgmt le on" was enough to get things running but things could be different in your setup).
Sorry that i wasn't able to document all the dark magic i googled over the 3 months before things started working here
Bluetooth appeared a whole lot more complex than i ever suspected...
/paul
Good to see you didn't give up!
Trying to see what's going on using gatttool on the commandline is a good way of debugging as you found out (in fact, pygatt runs gatttool to talk to BT devices). The problem with using gatttool when talking to the scale is that it's just switched on for a minute or so. So you really gotta be quick in typing the commands.
As to your question:
1. Try running gatttool with the "random" option like:
sudo gatttool -i hci0 -t random -b D6:DC:42:2A:B9:A8 -I
2. Also you can check if just switching on LE is enough. You might also need to switch BREDR off. The whole sequence becoming:
$ sudo hciconfig hci0 down
$ sudo ./btmgmt le on
$ sudo ./btmgmt bredr off
hci0 Set BR/EDR complete, settings: connectable bondable le
$ sudo hciconfig hci0 up
$ sudo hciconfig hci0 leadv
That's what i got from my notes (later it appeared that "btmgmt le on" was enough to get things running but things could be different in your setup).
Sorry that i wasn't able to document all the dark magic i googled over the 3 months before things started working here

/paul
- remb0
- Posts: 499
- Joined: Thursday 11 July 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Integration of Medisana BS440 Connected scale
maybe a update / change for your blog?
Keptenkurk wrote:I googled this and it appears that btmgmt is not installed per default (here)
It looks like that
./configure --disable-systemd
should be
./configure --disable-systemd --enable-tools
and copy the btmgmt to /usr/local/bin when done
it's been a while but recall having done something like this![]()
/paul
- remb0
- Posts: 499
- Joined: Thursday 11 July 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Integration of Medisana BS440 Connected scale
Keptenkurk thanks for your work and help!
I have some questions and feedback (maybe also for other users)
scale shows bluetooth connected icon, log is showing:
but the weight isn't updated for device "weegschaal remco"
- I'm not using google authentication.
But in BS440.py it always is included by: from BS440google import *
when not using it it gave errors so I excluded: #from BS440google import *
If there is already running a python instance kill and start over.
I'm using a form authenthication when using a domain externally, and internal adresses don't need a username/password.but the scripts are user basic auth.
what to enter in the ini file?
as url I entered: 192.168.0.8:8080
so included portnumber. (maybe something as comment or wiki)
when getting a error, it would be very handy to log every parameters.
so users can debug what setting is wrong.
IN BS440domoticz.py
unit Hardwareid and unit are hardcoded. can this be placed in the ini?
logrotation ( the log is growing very fast when enabling the python without cronjob)
I have some questions and feedback (maybe also for other users)
scale shows bluetooth connected icon, log is showing:
Code: Select all
Tue, 20 Sep 2016 19:15:13 INFO <module> Done receiving data from scale
Tue, 20 Sep 2016 19:15:13 INFO UpdateDomoticz Updating Domoticz for user Remco at index 1106 with weight 72.7
Tue, 20 Sep 2016 19:15:13 INFO UpdateDomoticz Domoticz succesfully updated
Tue, 20 Sep 2016 19:15:13 INFO scan Starting BLE scan
- I'm not using google authentication.
But in BS440.py it always is included by: from BS440google import *
when not using it it gave errors so I excluded: #from BS440google import *
If there is already running a python instance kill and start over.
I'm using a form authenthication when using a domain externally, and internal adresses don't need a username/password.but the scripts are user basic auth.
what to enter in the ini file?
as url I entered: 192.168.0.8:8080
so included portnumber. (maybe something as comment or wiki)
when getting a error, it would be very handy to log every parameters.
so users can debug what setting is wrong.
IN BS440domoticz.py
unit Hardwareid and unit are hardcoded. can this be placed in the ini?
logrotation ( the log is growing very fast when enabling the python without cronjob)
Re: Integration of Medisana BS440 Connected scale
I made it that it adds the sensors automatically to domoticz. No setup...
So if you installed all the bluetooth stuff and you got it working
Setting it up with Domoticz is just like a summer breeze
, uncomment Domoticz and fill in the url in the ini, and run it...
all automatically... plus I expanded the sensors to include all...
https://github.com/keptenkurk/BS440
So if you installed all the bluetooth stuff and you got it working


all automatically... plus I expanded the sensors to include all...
https://github.com/keptenkurk/BS440
-
- Posts: 4
- Joined: Thursday 29 December 2016 22:47
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
Hi guys,
I have been using this weight scale integration for some time now running on a pi. Currently I'm trying to move over to my Synology NAS. However the BlueZ tools made available by JumboTroll does not include the gatttool and btmgmt binaries which results in a python error. Is there anyway around this or are these tools required for functioning?
/Domdomgo
I have been using this weight scale integration for some time now running on a pi. Currently I'm trying to move over to my Synology NAS. However the BlueZ tools made available by JumboTroll does not include the gatttool and btmgmt binaries which results in a python error. Is there anyway around this or are these tools required for functioning?
/Domdomgo
Re: Integration of Medisana BS440 Connected scale
required.
pygatt just calls it (on linux, on windows or osx its call its replacements)
maybe you could compile it?
pygatt just calls it (on linux, on windows or osx its call its replacements)
maybe you could compile it?
Re: Integration of Medisana BS440 Connected scale
you can compile the tools itself as separate.
at least, thats what I figured out, when it was not working for me:
https://urbanjack.wordpress.com/2014/06 ... e-ibeacon/
at least, thats what I figured out, when it was not working for me:
https://urbanjack.wordpress.com/2014/06 ... e-ibeacon/
- remb0
- Posts: 499
- Joined: Thursday 11 July 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Integration of Medisana BS440 Connected scale
is this not something that can be added to the new domoticz python framework, so 1 script can be used from al users whitout advached scripting skills? the new python framework in domoticz gives the option to create 1 script and add the scale into domoticz hardware.
who want and can try this? If I could I have done it!
who want and can try this? If I could I have done it!
Re: Integration of Medisana BS440 Connected scale
You still need gatttool, whetever you use this script or migrate it to the new plugin system... the python library is based on it... and why migrate to a new plugin system, if it already working perfectly if you have gatttool that is, thus only moving the problem, plus creating extra work. Besides, it auto creates the hardware and the virtual devices already.
But you're welcome to rewrite it, and on a more general note, has the new plug in system has a ble scanner and interperter? that would be nice... there are a lot of ble devices out there! BLe plugin...
But you're welcome to rewrite it, and on a more general note, has the new plug in system has a ble scanner and interperter? that would be nice... there are a lot of ble devices out there! BLe plugin...

-
- Posts: 4
- Joined: Thursday 29 December 2016 22:47
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Integration of Medisana BS440 Connected scale
Guys,
Jumbotroll has been kind enough to compile a new bluez version which includes the gatttool and btmgmt tools. So I'm going to test it out and see if it works like it did on my Pi.
/Domdomgo
Jumbotroll has been kind enough to compile a new bluez version which includes the gatttool and btmgmt tools. So I'm going to test it out and see if it works like it did on my Pi.
/Domdomgo
Who is online
Users browsing this forum: No registered users and 1 guest