Integration of Medisana BS440 Connected scale

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
kman
Posts: 165
Joined: Wednesday 30 September 2015 19:33
Target OS: Linux
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by kman » Friday 21 April 2017 10:54

@Keptenkurk:
I have resolved the wireshark/btsnoop_hci.log issue that I mentioned above - the issue was wireshark version (1.6.x) version that I was using - I changed this is to version 1.12.1 and I am able to see write_cmd, write_req messages. But, please do let me know if you have used any other tools (other than BLE scanner app that you mention on your blog). Thanks.

franzelare
Posts: 146
Joined: Thursday 19 February 2015 22:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by franzelare » Saturday 22 April 2017 8:52

@kman, forget all the unknown, see where it states that it is connected to the MAC of your device, from there is gets interesting
than you see just a few writes and the device will start dumping data...

i did the same for the medisana blood pressure tester
next plan is to try to do the same trick for the nest protect smoke sensor

kman
Posts: 165
Joined: Wednesday 30 September 2015 19:33
Target OS: Linux
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by kman » Sunday 23 April 2017 15:28

@franzelare - thanks for that - yes, I see that. So, in your domoticz if you go to "setup->more options -> data push -> http", are you able to see all the devices against your virtual sensors from the drop down of "device name" - so, when you fill them in, it comes up in that table in that screen? (it will be really fascinating if it does, with http_post possible, data would be accessible remotely across the web-world!)

¬¬¬
I just got my Medisana Weighing Scale delivered - so, thought of trying all the suggestions made here:
ble_address: D5:E8:XX:XX:XX:XX
device_name: 0203B 363F412DE8D5
1. with the latest (git hub master) after receiving all the processindication messages, I get this python error, and I don't see any data on my domoticz. What am I missing?
Traceback (most recent call last):
File "BS440.py", line 172, in <module>
device.disconnect()
File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/device.py", line 17, in wrapper
return func(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/device.py", line 52, in disconnect
self._backend.disconnect(self)
File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/gatttool.py", line 52, in wrapper
raise NotConnectedError()
pygatt.exceptions.NotConnectedError
BS440_master.log
BS440_master.log
(13.51 KiB) Downloaded 31 times
Under the plugins directory, I have removed the "_" from the three files BS440domoticz.ini, BS440domoticz.py, BS440domoticz.png. And in BS440domoticz.ini, I have not made any chages, so it contains as below. So, what am I missing? Why am I not seeing any data in Domoticz?
# BSdomoticz440.ini
# Initialization file for plugin BS440domoticz.py
# Change to your preference
# Store this file in the working folder of BS440domoticz.py
#
# The persons section lists all the scale users
# The list maybe extended to 8 persons
# Domoticz index is only used if domoticz IP is set
[Person1]
username: John

[Person2]
username: Jill

# DomoticzIP: IP adres of Domoticz server
# Assumes unauthenticated access when on local LAN
# set in Domoticz|setup|Settings|System|Local Networks
# hardware_name is optional (default: Medisana)
domoticz_url: 127.0.0.1:8080
#hardware_name:
2. So, went back to version 1.0 of BS440 on git-hub. Here it doesn't even get as far as processindication - it fails at the time of connection.

Is this a problem with 1.0 version of BS440.py due to my medisana scale's device name having a space "0203B 363F412DE8D5" ? (as latest version of BS440.py seems to connect fine, and even process-indication messages are received -except for the data to be seen on domoticz)
python BS440.py
Traceback (most recent call last):
File "BS440.py", line 106, in <module>
device = connect_device(ble_address)
File "BS440.py", line 55, in connect_device
device = adapter.connect(address, 5, 'random')
File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/gatttool.py", line 376, in connect
cmd = 'connect {0} {1}'.format(self._address, address_type.name)
AttributeError: 'str' object has no attribute 'name'
BS440-1.0.log
BS440-1.0.log
(614 Bytes) Downloaded 28 times

kman
Posts: 165
Joined: Wednesday 30 September 2015 19:33
Target OS: Linux
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by kman » Sunday 23 April 2017 15:48

@franzelare: Just noticed Keptenkurk's response(Apr 6) to my earlier message, it might be that the domoticz plugin is broken on the latest version - may be that explains why I don't see data on domoticz after process indication messages; if you don't mind please could you attach your working "BS440" version here? Many thanks.
Keptenkurk wrote: ....
....
But the Domoticz plugin hasn't been tested yet (at least by me) after converting Trixwood's work to the plugin style. So might stil be broken. Really didn't find the chance to give it a go yet but certainly will.
/paul
[/quote]

kman
Posts: 165
Joined: Wednesday 30 September 2015 19:33
Target OS: Linux
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by kman » Sunday 23 April 2017 19:09

@trixwood
As I said in my previous post, on the latest vesion after processindication messages, I was not seeing any data in domoticz as the process halted after the execution of 'device.disconnect'. Just to progress on getting the data onto domoticz, for now, I have commented out the below line from BS440.py (will need to check this later)
device.disconnect()
Now, atleast it gets to the domoticzplugin code, but the plugin is definitely broken as I encounter quite a few bugs (don't think it has been tested).

Fix #1 : to add 'Domoticz' section in the .ini
[Domoticz] ---------------------------> this is missing in BS440domoticz.ini file
domoticz_url: 192.168.1.4:8080
hardware_name: Medisana
Fix#2: BS440domoticz.py - line 184.
change
if config.has_section(personsection):
to
if pluginconfig.has_section(personsection):
Now, I am stuck here, any help is most appreciated.
Traceback (most recent call last):
File "BS440.py", line 192, in <module>
plugin.execute(config, persondata, weightdatasorted, bodydatasorted)
File "plugins/BS440domoticz.py", line 200, in execute
hardwareid = self.exists_hardware(hardwarename)
File "plugins/BS440domoticz.py", line 41, in exists_hardware
response = self.open_url(url_hardware % (domoticzurl))
NameError: global name 'url_hardware' is not defined

Itschi
Posts: 12
Joined: Saturday 16 May 2015 14:58
Target OS: Windows
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by Itschi » Wednesday 17 May 2017 21:13

Did you resolve the problem? I get the same exception "pygatt.exceptions.NotConnectedError" after reading the scale data.

franzelare
Posts: 146
Joined: Thursday 19 February 2015 22:48
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by franzelare » Sunday 13 May 2018 22:19

anyone worked on posting the data to fitbit through the API?

BenSunnyField
Posts: 2
Joined: Sunday 15 July 2018 13:25
Target OS: Linux
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by BenSunnyField » Sunday 15 July 2018 13:29

@Franzelare I see you got the Medisana BU530 working, would you like to share that code?
It is exactly what I want to do so your code would be very welcome.

User avatar
dre68
Posts: 20
Joined: Friday 30 January 2015 21:18
Target OS: Raspberry Pi
Domoticz version: latest
Location: Noordwijk, Netherlands
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by dre68 » Monday 30 July 2018 22:18

I am trying to get the medisana solution of ketpenkurk runnning, but I run into the following error when starting BS440.sevice:

Jul 30 21:56:58 DomoticzPi3 python[18565]: File "BS440.py", line 2, in <module>
Jul 30 21:56:58 DomoticzPi3 python[18565]: import pygatt.backends
Jul 30 21:56:58 DomoticzPi3 python[18565]: ImportError: No module named pygatt.backends

Anyone knows how to fix this?

BenSunnyField
Posts: 2
Joined: Sunday 15 July 2018 13:25
Target OS: Linux
Domoticz version:
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by BenSunnyField » Saturday 04 August 2018 22:01

Try installing PyGatt
https://github.com/peplin/pygatt

User avatar
dre68
Posts: 20
Joined: Friday 30 January 2015 21:18
Target OS: Raspberry Pi
Domoticz version: latest
Location: Noordwijk, Netherlands
Contact:

Re: Integration of Medisana BS440 Connected scale

Post by dre68 » Tuesday 07 August 2018 20:53

PyGatt was installed, did a reinstall according to your link but to no avail
Still error:

-- Logs begin at Thu 2016-11-03 18:16:42 CET. --
Aug 07 20:46:48 DomoticzPi3 systemd[1]: bs440.service: Unit entered failed state .
Aug 07 20:46:48 DomoticzPi3 systemd[1]: bs440.service: Failed with result 'exit- code'.
Aug 07 20:48:56 DomoticzPi3 systemd[1]: Started Run BS440 bluetooth scale monito r.
Aug 07 20:48:56 DomoticzPi3 python[771]: Traceback (most recent call last):
Aug 07 20:48:56 DomoticzPi3 python[771]: File "BS440.py", line 2, in <module>
Aug 07 20:48:56 DomoticzPi3 python[771]: import pygatt.backends
Aug 07 20:48:56 DomoticzPi3 python[771]: ImportError: No module named pygatt.bac kends
Aug 07 20:48:56 DomoticzPi3 systemd[1]: bs440.service: Main process exited, code =exited, status=1/FAILURE
Aug 07 20:48:56 DomoticzPi3 systemd[1]: bs440.service: Unit entered failed state .
Aug 07 20:48:56 DomoticzPi3 systemd[1]: bs440.service: Failed with result 'exit- code'.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests