Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #2

Closed
bonnybabukachappilly opened this issue Jul 11, 2022 · 88 comments
Closed

Documentation #2

bonnybabukachappilly opened this issue Jul 11, 2022 · 88 comments
Labels
documentation Improvements or additions to documentation

Comments

@bonnybabukachappilly
Copy link

Can you tell me how you find which UUIDs for different functions and bytes code to write for a particular action?

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

Hi @bonnybabukachappilly ,

so the relevant UUIDs can be found here

omblepy/omblepy.py

Lines 24 to 32 in 63fd491

deviceCommandChannel_UUID = "db5b55e0-aee7-11e1-965e-0002a5d5c51b"
deviceDataRxChannelUUIDs = [
"49123040-aee8-11e1-a74d-0002a5d5c51b",
"4d0bf320-aee8-11e1-a0d9-0002a5d5c51b",
"5128ce60-aee8-11e1-b84b-0002a5d5c51b",
"560f1420-aee8-11e1-8184-0002a5d5c51b"
]
deviceDataRxChannelIntHandles = [0x360, 0x370, 0x380, 0x390]
deviceUnlock_UUID = "b305b680-aee7-11e1-a730-0002a5d5c51b"



which UUIDs for different functions

As an overview for which UUID is used on what:

  • deviceUnlock_UUID, used first to unlock the device with a pairing code
  • deviceCommandChannel_UUID, basically the TX channel, commands are sent here, which cause the device to reply on the Rx Channels
  • deviceDataRxChannelUUIDs, depending on how big the data block is, that was requested, one or more RX channels will recieve data. The data of the up to four channels needs to be combined and processed to get the resulting package



bytes code to write for a particular action

So far I know of the following byte sequences for the CommandChannel:

  • 0x0800000000100018 = makes eeprom accessible for reads and writes, returns a non standard package containing device info like the mac address
  • 0x080f000000000007 = stops the communication and turns the device off after disconnecting and a short delay
  • 0x080f0f0f0f000008 = stops the communication and indicates an error has occured
  • 0x10 01c0 (2bytes address) (1byte size to write) (up to 8byte data) 0x00 (1byte xor crc) = write data to eeprom
  • 0x08 0100 (2bytes address) (1byte size to read) 0x00 (1byte xor crc) = read data from eeprom

Generally all packets on the RX and TX channels, are always formatted like so:

  • (1byte length of packet) (nbytes command specific) 0x00 (1byte xor crc)
    The unlocking command is the only one that is different, but that is also not sent on the RX and TX channel.



The things you need to do to get the data are:

  1. Unlock the device by writing to "deviceUnlock_UUID" and checking the response on the same UUID. What bytes you need to write here depends if the device was already paired once or not (see writeNewPairingKey() or unlockWithPairingKey())
  2. Subscribe for notifications on the 4 RX characteristics UUIDs
  3. Send the "start transmission" command on the deviceCommandChannel_UUID (
    async def startTransmission(self):
    ) and wait for a response to arrive at the rx channels
  4. Depending on a device, the address where the data for each user is stored at is different. Use readContinuousEepromData() to request the readout of large chunks data, which itself splits the reading in blocks to comply with size limitation of the RX, channels. To read such a block you need to write the sequence dataWriteCommand in _writeBlockEeprom() to the deviceCommandChannel_UUID characteristic
  5. After writing the characteristic you will get callbacks for the data blocks on each of the four rx channels. You need to combine the data of these channels.



The thing you probably need to change to add support for you device is to just add a file in the device specific config folder and find out from which address the data is read on your device. But it would be helpfull to know which device you are trying to add support for.

Best,
Benjamin

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

Ok I have just seen that you are using omron 7361t

The reason that this one is not supported yet is, that is has a different byte order in the records itself (hence the different import of bytearrayBitsToIntLittleEndian). If you can give me some time I can hopefully work it out. If you want to do some testing in the meantime you should be able to use:

import sys
import datetime
sys.path.append('..')
from utility import bytearrayBitsToIntLittleEndian

def recordSize():
    return 0x10
def startAddress():
    return 0x98
def user1Entries():
    return 100
def user2Entries():
    return 100

def recordToDict(recordBytes):
    recordDict = dict()
    print(f"{recordBytes}")
    #Well that's the reason I have no added support yet
    return recordDict 

as the device specific config file.
It which will crash the code in a later stage of the programm, but should print the raw bytes of the records before that.

Maybe you could give me one or two records bytesArrays to test on.

@bonnybabukachappilly
Copy link
Author

Let me try, I will get back to you.

@bonnybabukachappilly
Copy link
Author

'The reason that this one is not supported yet is, that is has a different byte order in the records itself'

what records

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

'The reason that this one is not supported yet is, that is has a different byte order in the records itself'

So each measurement you take is stored in the eeprom with the time of recording, the sys pressure, the dia pressure, and the heart rate and some other stuff.
Omron calls each such stored measurement a "record", so I have copied their nomenclature here.
Presumabelly to save eeprom space and cut down the transmission time, Omron has decided to compress the records were they can. For my device this results in:
Capture
And that are the values you see hardcoded in

recordDict["dia"] = bytearrayBitsToIntBigEndian(recordBytes, 0, 7)
recordDict["sys"] = bytearrayBitsToIntBigEndian(recordBytes, 8, 15) + 25
year = bytearrayBitsToIntBigEndian(recordBytes, 16, 23) + 2000
recordDict["bpm"] = bytearrayBitsToIntBigEndian(recordBytes, 24, 31)
recordDict["mov"] = bytearrayBitsToIntBigEndian(recordBytes, 32, 32)
recordDict["ihb"] = bytearrayBitsToIntBigEndian(recordBytes, 33, 33)
month = bytearrayBitsToIntBigEndian(recordBytes, 34, 37)
day = bytearrayBitsToIntBigEndian(recordBytes, 38, 42)
hour = bytearrayBitsToIntBigEndian(recordBytes, 43, 47)
minute = bytearrayBitsToIntBigEndian(recordBytes, 52, 57)
second = bytearrayBitsToIntBigEndian(recordBytes, 58, 63)

And in the code of UBMP this corresponds to:
https://codeberg.org/LazyT/ubpm/src/commit/815a74dce1c41b16594e9e2d6208f96f3f2999a2/sources/plugins/vendor/omron/hem-7361t/DialogImport.cpp#L442-L448

And to complicate things further your device seems to use a different endianess.

@bonnybabukachappilly
Copy link
Author

Can you share Omron's document if any?

@bonnybabukachappilly
Copy link
Author

when switching to programming mode, and paring I am getting a response of b'\x82\x0f' + b'\x00'*18
instead of b'\x82' + b'\x00'*16

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

when switching to programming mode, and paring I am getting a response of b'\x82\x0f' + b'\x00'*18 instead of b'\x82' + b'\x00'*16

Oh, so maybe the number of zeros can vary then.
Please try the new version and see if it works now.

@LazyT
Copy link

LazyT commented Jul 11, 2022

0x820F happens for me, if the device isn't paired in OS.

@bonnybabukachappilly
Copy link
Author

When connecting to the device after paring, windows will give a prompt to pair.
if paired or not will get 'Same transmission failed 5 times, abort'
when trying 'again bleak.exc.BleakError: Could not get GATT services: Unreachable'
so I need to remove the device from windows, and the same when repeating

@bonnybabukachappilly
Copy link
Author

if i give
await bleClient.write_gatt_char(self.deviceUnlock_UUID, b'\x01' + b'\x00'*16, response=True) insted of
await bleClient.write_gatt_char(self.deviceUnlock_UUID, b'\x02' + b'\x00'*16, response=True)

I get a 0x8104

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

When connecting to the device after paring, windows will give a prompt to pair. if paired or not will get 'Same transmission failed 5 times, abort'

Does the initial pairing with -p work for you? Does the programm print something like "Paired device successfully with new key..."?

when trying 'again bleak.exc.BleakError: Could not get GATT services: Unreachable' so I need to remove the device from windows, and the same when repeating

I also have this issue, sometimes removing the device from the windows bluetooth settings seems to be neccesary

@bonnybabukachappilly
Copy link
Author

I can't say paring work, there is 0x01 and 0x02 available with program mode, if 0x02 get a response of 0x820F and for 0x01 0x8104

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

if i give await bleClient.write_gatt_char(self.deviceUnlock_UUID, b'\x01' + b'\x00'*16, response=True) insted of await bleClient.write_gatt_char(self.deviceUnlock_UUID, b'\x02' + b'\x00'*16, response=True)

I get a 0x8104

I think when you write to the unlock UUID the first byte indicates what to do. At least for my device it works like this:

  • 0x02 goes to programming mode, the you can write the new key starting with 0x00
  • 0x01 means that you want to unlock the device with the following code

If some bit in the second byte of the response is set, it seems to indicate some error.
What kind of error you get in the response when you send something to the unluckUUID
also seems to depend on previous commands / errors, so make sure to powercycle your device in between tests.

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

Also @LazyT has the same device and the initial pairing also didn't work.
If it doesn't work after power cycling maybe you could capture the bt communication with the omron app for the initial pairing and a subsequent data readout after power cycling the device.
Android is capable of logging all bluetooth transmission if you enable bluetooth hci snoop log in the developer settings.

@LazyT
Copy link

LazyT commented Jul 11, 2022

Tested with internal (intel) and external (csr) bluetooth adapter with original mac: doesn't work
Tested with the same external bluetooth adapter and cloned android mac: works
On android every device works.

That was the reason, why ubpm only works with the faked mac...

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

On android every device works.
That was the reason, why ubpm only works with the faked mac...

Does that mean you have tested with a Android Phone, that has bluetooth mac address that is different from the one that was originally paired with the omron device?

In starting from Wednesday this week I should have access to a hem-7361t / m500 and can do some testing regarding the pairing process.

@LazyT
Copy link

LazyT commented Jul 11, 2022

Yes, paired on tablet and works on handy too.

Tried also with cloned mac last byte +1: doesn't work on pc.

So it's not vendor specific blacklist or something like this.

@userx14
Copy link
Owner

userx14 commented Jul 11, 2022

Ok, I have finished the record decoding function for hem-7361t.
Capture

Regarding the pairing, I still find it strange that sending 0x01 (16* 0x00) works for you for unlocking the device, even with the correct mac address.
When I do the same on my device I get 0x8101 (15* 0x00) indicating an error. It only works with the correct unlock code, so there seems to be some hardware level difference between the devices.

@bonnybabukachappilly
Copy link
Author

@userx14 Tried to run your code but not pairing. Return code is '820f'

@userx14
Copy link
Owner

userx14 commented Jul 12, 2022

Yes, paired on tablet and works on handy too.
...doesn't work on pc.

I think @LazyT is right, and it seems to be OS dependent.

I have connected a factory new HEM-7361T to an android device with the following steps:
Paired it with the OS Bluetooth dialog, and used nRF-Connect to send the commands. 0x02, then 0x00(16* unlock key) and it responded with the expected codes.
If I remove the pairing, and retry the same steps again it responds to the key write request (0x02) with 0x820f.

I always expected that there is a normal bluetooth connection mode, like there is with the hem-7322t, where you short press the blutooth button, and it goes into a mode where the little square directely appears and not the P. But the 7361 does not seem to have that. Instead I have to go into the P mode again, but it works the same from thereon. Send 0x01(16*bytes unlock key) and it changes to the square mode and accepts the commands and I'm able to access the eeprom (manually by with nRF Connect).

I'm currently investigating why it is not working on windows. My programm does not seem to create a pair dialog with this devcies, even if I insert .pair(). Therefore I always get 0x820f, because the device is at this point in time not correctely paired. When I pair the device with the os first, there seems to be a different issue, where the tool does not have access to the gatt services anymore.

@userx14
Copy link
Owner

userx14 commented Jul 13, 2022

It has something to do the encryption or the pairing procedure for ble devices. Encrypted services seem to be not supported at all by bleak, therefore it is most likeley unusable for this device. The response will therefore be always zero bytes when reading a characteristic and writes will not work at all.

Since the device works with various Android phones and nRF-Connect I also tested with nRF-Connect and their nRF52840 chip using their Windows Desktop Application. There the device also returns 0x820f after connection. But when pairing the device without bonding the device suddenly works and I get the expected responses. So connecting then pairing is needed, which encrypts the btle connection and exchanges keys.

After some experimenting I was able to reproduce the connection steps with bluetoothctl on linux by manually typing the commands and it works too. So here it my log of what I typed in the shell. Not every command might be neccesary, e.g. I suspect that the btmgmt commands are optional, but please try what is required on your devices to get it to work and report your findings.

@LazyT would it be possible to "port" these commands to UBPM, since it uses the bluez stack directely?

I'm currently looking for alternative python libraries which support encrypted bluetooth le services to get this code working with the hem-7362t, but that could mean that the support for windows 10 will no longer be present.

#Test system
#Debian 11 - Kernel 5.10.0-15-amd64
#bluez version: 5.55-3.1
#bluez-firmware version: 1.2-4
#chipset: marvell 88W8897

#mac of omron 28:FF:B2:EE:EE:EE

#remove any previous bonds/pairings to device from the bluetooth settings
sudo su -
btmgmt connectable on
btmgmt bondable on
btmgmt io-cap 3
bluetoothctl --agent NoInputNoOutput
#start the device in p mode
scan on
#wait 2 seconds until you see at least one message from the device
scan off
connect 28:FF:B2:EE:EE:EE
pair 28:FF:B2:EE:EE:EE
menu gat
select-attribute b305b680-aee7-11e1-a730-0002a5d5c51b
notify on
write 0x02
write 0x001234123412341234123412341234123412341234

@bonnybabukachappilly
Copy link
Author

Which python library, I have tried Pyatt and it's good. But I am not getting exceptions and no response. while I get it on bleak. Hope it will work for you. Please keep updated.

@LazyT
Copy link

LazyT commented Jul 13, 2022

would it be possible to "port" these commands to UBPM, since it uses the bluez stack directely?

For over a year I made a bluetooth test tool and all the code was already there, with pairing.

I don't know why it wasn't working, but it works now. I don't understand it.

Didn't test reading records yet, but I guess this will work too.

Holy shit, lol...

@userx14
Copy link
Owner

userx14 commented Jul 13, 2022

would it be possible to "port" these commands to UBPM, since it uses the bluez stack directely?

For over a year I made a bluetooth test tool and all the code was already there, with pairing.

I don't know why it wasn't working, but it works now. I don't understand it.

Didn't test reading records yet, but I guess this will work too.

Holy shit, lol...

I would guess that they changed something with later bluez versions, btle encryption support seems to be a recent development.
Or maybe you executed some of the btmgmt commands and they changed some state of the bt adapter?


Which python library, I have tried Pyatt and it's good.

I have looked into pygatt, but unfortunatelly it seems to be a wrapper around gatttool which is deprecated. Also gatttool when used manually did not work for me when testing.

For python it seems to work with python-bluezero with some trickery for pairing.
https://github.com/ukBaz/python-bluezero
I will push an update to the python script soon, but that means "bye bye windows support" at least for pairing with the device,
unless someone finds a bluetooth librarary for BTLE which support pairing with security 1 type 2.

@userx14
Copy link
Owner

userx14 commented Jul 16, 2022

Hi,
please check out the latest branch which makes it possible to pair and read data from the hem7361t.

https://github.com/userx14/omblepy/tree/bluezeroVersion

When testing with the device I discovered it has some quirks in the protocol which differ from the hem7322t:

  • only attached data sizes in multiples of (0x10) are supported for Eeprom read commands.
  • when reading memory addresses of user records which are not used / written to yet, instead of returning all 0xff the device replies with a short message without data attached to the end. I have modified the function to emulate the behavior of the hem7322 which sends all 0xff in this case.
  • overwriting only the first 0x08 bytes of the currently unread records does not seem to work, probably because of the 0x10 multiple limitations in the attached data size for Eeprom read/writes. The fix would be to use two of the tx channels which the device does possess. Because of this the "-n"-mode which only reads new records is unable to reset the "unread records counter". Turns out if you write to the correct address only attaching 0x08 bytes is neccesary and it works 😏
  • when issuing a read spanning eeprom addresses which are not written yet the whole read comes back as invalid (only 8bytes header + crc / no attached data)

Additional observations:

  • after the records of device have been read out once, it must be unpaired in the bluetooth settings of the os, otherwise the next pairing and connection will fail. Maybe pairing an already paired device does not work?
  • bluezero or more likeley bluez in its later versions do not seem to work with the hem7322t, because some bluetooth attributes are not not available. This is the original bug I encountered with all more recent distributions than ubuntu 18.04.

@bonnybabukachappilly
Copy link
Author

I tried the new code. When I try that I am getting
dbus.exceptions.DBusException: org.bluez.Error.AuthenticationFailed: Authentication Failed

@userx14
Copy link
Owner

userx14 commented Jul 19, 2022

I tried the new code. When I try that I am getting dbus.exceptions.DBusException: org.bluez.Error.AuthenticationFailed: Authentication Failed

With which linux distro are you running your tests?
I am testing with this Debian-11.4 KDE live iso:
https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-11.4.0-amd64-kde.iso

sudo apt update
sudo apt install python3-pip
pip3 install terminaltables bluezero
git clone https://github.com/userx14/omblepy/
cd omblepy
git checkout bluezeroVersion
python3.9 ./omblepy.py -p -d hem-7361t-d

Testing on Ubuntu 22.04 did not work at all and gave the org.bluez.Error.AuthenticationFailed error.

Ubuntu 20.04 worked but with the following limitations:

  • when using only one bluetooth stick the bluetooth settings menu must be opened and the pairing dialog has to be confirmed
  • when using two bluetooth sticks, bluetoothctl is opened in a second terminal window to confirm the pairing request by typing yes, since the gnome bluetooth os settings do not show the pairing dialog for the second bluetooth adapter. If I do not confirm the pairing request I also get org.bluez.Error.AuthenticationFailed.

Best,
Benjamin

@userx14
Copy link
Owner

userx14 commented Jul 19, 2022

I think the the authentification bug is now also fixed in the windows = crossplatform = bleak version.
It was a combination of pairing and reading a characteristic instead of using callbacks and assuming that delay would work there.
Pairing is expected to work, but the readout for hem-7361 will not work yet, because the difference for empty readouts (8byte empty response instead if 0xff).

@userx14
Copy link
Owner

userx14 commented Jul 2, 2023

oh what that means connect bt stick to android phone?

i have this stick and the other one that i bought , only one working its this one, i able to succesfully paring on windows and linux with this bt stick, one of my three omron devices.

No, just use the bluetooth built into your phone. I was hoping the hardware in the phone supports the newer bluetooth standard, just to test if it makes a difference for the devices that do not workin with your stick.

@Toei79
Copy link

Toei79 commented Jul 3, 2023

oh what that means connect bt stick to android phone?
i have this stick and the other one that i bought , only one working its this one, i able to succesfully paring on windows and linux with this bt stick, one of my three omron devices.

No, just use the bluetooth built into your phone. I was hoping the hardware in the phone supports the newer bluetooth standard, just to test if it makes a difference for the devices that do not workin with your stick.

i dont get it , i mean, phone connects successfully with omron device with all three

or its connect phone with bluetooh usb device?

@userx14
Copy link
Owner

userx14 commented Jul 3, 2023

The idea was to use the Android Os Pairing dialog on a second phone which does not have the omron app installed and was not the last phone paired to the device. This would create a simmilar scenario to a pc trying to pair, just that most phones have hardware supporting more recent bluetooth versions.
If pairing with the phone works it is most likeley just the bluetooth version of your usb adapter causing the probem. If it does not work, onron likeley accesses some bluetooth attributes before pairing, but this is kind of unlikely.

Anyway I think the most likeley cause is just the too low bluetooth version of your usb adapter. So if you can test on windows device with a chipset / usb dongle with more recent bluetooth version, just try if it works 😃 .

@Toei79
Copy link

Toei79 commented Jul 3, 2023

The idea was to use the Android Os Pairing dialog on a second phone which does not have the omron app installed and was not the last phone paired to the device. This would create a simmilar scenario to a pc trying to pair, just that most phones have hardware supporting more recent bluetooth versions. If pairing with the phone works it is most likeley just the bluetooth version of your usb adapter causing the probem. If it does not work, onron likeley accesses some bluetooth attributes before pairing, but this is kind of unlikely.

Anyway I think the most likeley cause is just the too low bluetooth version of your usb adapter. So if you can test on windows device with a chipset / usb dongle with more recent bluetooth version, just try if it works 😃 .

i tried with a tablet that never connected

gfgfdgsdfgdfgdf

and both devices connected

on tablet

but on omron devices keep blinking P

@userx14
Copy link
Owner

userx14 commented Jul 4, 2023

both devices connected

Ok, so I would say it is most likely that the reason the pairing fails on windows is your usb dobgle's missing support for newer bluetooth features (4.2).

but on omron devices keep blinking P

The continued blinking of the P on the screen is normal, one needs to write a pairing key to some bluetooth characteristics for it to stop, which is what omblepy would do after the pairing succeeded.

@Toei79
Copy link

Toei79 commented Jul 4, 2023

both devices connected

Ok, so I would say it is most likely that the reason the pairing fails on windows is your usb dobgle's missing support for newer bluetooth features (4.2).

but on omron devices keep blinking P

The continued blinking of the P on the screen is normal, one needs to write a pairing key to some bluetooth characteristics for it to stop, which is what omblepy would do after the pairing succeeded.

ok what usb dongle you recommend? latest its one 5.0 or 5.1? that one works

@userx14
Copy link
Owner

userx14 commented Jul 4, 2023

Dongles with 5.0 or 5.1 should both work.
Preferrably one which does work out of the box on windows without installing special drivers.

@Toei79
Copy link

Toei79 commented Jul 4, 2023

i guess i try get one on ebay , but i only see 5.0 so far.

@Toei79
Copy link

Toei79 commented Jul 4, 2023

i get one from amazon 5.3 , it comes thursday , i update after i try

@Toei79
Copy link

Toei79 commented Jul 4, 2023

im trying use tablet , but idk how do it

i install it pydroid 3 , termius , i get omblepy file on the tablet but idk how run it.

@userx14
Copy link
Owner

userx14 commented Jul 4, 2023

im trying use tablet , but idk how do it

i install it pydroid 3 , termius , i get omblepy file on the tablet but idk how run it.

It is really complicated getting the bluetooth library I used to work on Android. It would involve building an app with python4android and Kivy. Better safe your time and wait for the usb dongle.

@Toei79
Copy link

Toei79 commented Jul 4, 2023

im trying use tablet , but idk how do it
i install it pydroid 3 , termius , i get omblepy file on the tablet but idk how run it.

It is really complicated getting the bluetooth library I used to work on Android. It would involve building an app with python4android and Kivy. Better safe your time and wait for the usb dongle.

i have high hopes on it hahah

i get i tried like a hour, asked here to that , i let it, thanks man, i wait until dongle comes.

@Toei79
Copy link

Toei79 commented Jul 4, 2023

if i do this working, all json files can be on same folder or i need different omblepy folders for each device?

it can run on crontab or it needs do paring process every time, whatever its fine i mean one time in month or something.

@userx14
Copy link
Owner

userx14 commented Jul 5, 2023

if i do this working, all json files can be on same folder or i need different omblepy folders for each device?

it can run on crontab or it needs do paring process every time, whatever its fine i mean one time in month or something.

Currently it reads the records from the device and does these things:

  • creates a backup of the old csv files
  • appends user1 and user2.csv while keeping the old data and removing duplicates
  • overwrite the file ubpm.json with the currently read records (data from previous read is lost every time)

The json file is intended to be directely imported into ubpm after each run and is not for permanent storage as it gets overwritten with every data readout.

To be honest, I have not really thought about the use with multiple devices, it depends if you want to keep the results of the devices seperate or merge them into one file. The choise probably depends on if the devices are used by the same person or not.
Is your plan to merge the data or keep it seperate?

Depending on what you want to do here, you could modify the saveUBPMJson function to save to a different folder depending on the deviceName:
https://github.com/userx14/omblepy/blob/3b49c009f0579487660e534aba98d4602b291d60/omblepy.py#L383C2-L383C2

@Toei79
Copy link

Toei79 commented Jul 5, 2023

i guess need use separate my step dad check continuosly and use this can be a good upgrade. i will check that

@Toei79
Copy link

Toei79 commented Jul 6, 2023

i get a dongle 5.3

image

running 7530t i get this error, using 71xx one works connect with -p but get error with data. this one its the one with ekg.

checking other one.

the other its working i get data fine

question ,

python3 ./omblepy.py -p -d HEM-7155t

this need be used every time for connect

then after

python3 ./omblepy.py -d HEM-7155t
to get the data?

idk too much running just this way works fine. and both press the P On device

@Toei79
Copy link

Toei79 commented Jul 7, 2023

with debug
py ./omblepy.py -p -d HEM-7530t --loggerDebug

image

image

@userx14
Copy link
Owner

userx14 commented Jul 7, 2023

Nice, looks like the pairing is working now.

this need be used every time for connect
then after
python3 ./omblepy.py -d HEM-7155t
to get the data?

The -p option writes an unlock key into to omron device. If you only use omblepy you in theory only have to do this one single time.
But as soon as you execute the pairing procedure with the omron app on Android / IOS it will get overwritten and you need to run it once again.

The error you see when trying to read out data is a programming made by me. I will try to fix it later this day.

@userx14
Copy link
Owner

userx14 commented Jul 7, 2023

I hope it is fixed now, please try out the most recent version of:
https://github.com/userx14/omblepy/tree/hem-7530t-testing

@Toei79
Copy link

Toei79 commented Jul 7, 2023

it connects but when its for data get some error and big big list when use --loggerdebug

image

image
image
image
image
image
image

@userx14
Copy link
Owner

userx14 commented Jul 8, 2023

it connects but when its for data get some error and big big list when use --loggerdebug

Thanks for the screenshots, that looks very promising.
The error just occurs because I did't not know how to parse the records yet. Therefore the csv writer will break because it gets no valid records to write.

Here are the raw bytes of the records:

5864115f0420103f00800001df20
5965165c13101b6400800002ab54
5765165a13101c84008000038d72
575e164413171ed00080000454ab
586d164a13281dca0080000533cc
5a62164c133712c4008000063bc4
4b51166493b1190352800007b04f
596e1658190919e9008000081ee1
5b63164e19691147008000097a85

encoded data offsets:
##sys+25 ?
  ##dia ?
    ##year+2000
      ##day, hour?
                    ####seq offset

Since I now have the raw data of the measurements would it possible for you to tell me the data the omron displays for these nine measurments (year, month, sys pressure, dia pressure, ...) to find out which byte stores what data?

I suspect I already see the year at the third byte, so if this is right the years for the first record should be 2017 and 2022 for the other eight ones.

@Toei79
Copy link

Toei79 commented Jul 8, 2023

i dont use this one too much , i checked on omron app and i get this

july 11/22 124/91 ekg normal bpm 76
june 08/22 135/89 ekg unclassified bpm 85

april 29/22 Ekg possible Atrial Flibrillation 110 bpm
april 29/22 Ekg possible atrial flibillation 108 bpm
april 29/22 106/75
april 25/22 123/90
april 25/22 123/90 egk normal 76 bpm
april 25/22 134/88 ekg normal 78 bpm
april 24/22 119/87 ekg normal 68 bpm
april 24/22 126/87 ekg normal 91 bpm
april 24/22 126/89
april 24/22 ekg normal 92 bpm
april 24/22 ekg normal 91 bpm

@Toei79
Copy link

Toei79 commented Jul 8, 2023

question ubpm can read ekg? im guessing not its other app for it, i feel this just very new on pc. i mean nature reverser thing.

@userx14
Copy link
Owner

userx14 commented Jul 8, 2023

Hi, I think I got the blood pressure readings figured out.
If the mapping is correct this should be the values from the bluetooth transfer:

{'dia': 88, 'sys': 125, 'bpm': 95,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2017, 1,  1,  0,  0, 59)}
{'dia': 89, 'sys': 126, 'bpm': 92,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2022, 4, 24, 16, 45, 36)}
{'dia': 87, 'sys': 126, 'bpm': 90,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2022, 4, 24, 16, 50,  4)}
{'dia': 87, 'sys': 119, 'bpm': 68,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2022, 4, 24, 23, 59, 16)}
{'dia': 88, 'sys': 134, 'bpm': 74,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2022, 4, 25,  8, 55, 10)}
{'dia': 90, 'sys': 123, 'bpm': 76,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2022, 4, 25, 23, 11,  4)}
{'dia': 75, 'sys': 106, 'bpm': 100, 'mov': 1, 'ihb': 0, 'datetime': datetime.datetime(2022, 4, 29, 17, 36,  3)}
{'dia': 89, 'sys': 135, 'bpm': 88,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2022, 6,  8,  9, 39, 41)}
{'dia': 91, 'sys': 124, 'bpm': 78,  'mov': 0, 'ihb': 0, 'datetime': datetime.datetime(2022, 6, 11,  9,  5,  7)}

If these are correct, the version in the testing branch should now also read the blood pressure records.

ubpm can read ekg?

No, I don't think so. I'm unaware of any open source application that can read out that ekg curve.
Also I'm wondering how omron managed the ekg data transfer.
It kind of looks like they use a different method compared to the blood pressure readout, since in the demo video they show it transfering a live graph. This should not be possible with the way the blood pressure recordings are transfered, so they likely use different bluetooth attributes, etc. .
If you need this functionality, there is not realy a way around logging the bluetooth transmissions via btsnoop_hci.log on android and analyzing the results with wireshark.

What is the status of the other devices currently?

  • Does hem7151T works with the driver of the 7155T?
  • Does your HEM-7342T pair successfully now?

@Toei79
Copy link

Toei79 commented Jul 8, 2023

its fine understand.

yea those are successfully connected nice

im going to try this update and let you know

@Toei79
Copy link

Toei79 commented Jul 8, 2023

image
working!

@Toei79
Copy link

Toei79 commented Jul 10, 2023

i little lost what need replace to save multiple ones devices readings?

idk its useful i able to get other device BP786N i get really cheap by coincidence .

@userx14
Copy link
Owner

userx14 commented Jul 10, 2023

i little lost what need replace to save multiple ones devices readings?

I'm not sure if the code here works, since I currently have no device to test with. Please let me know if this is what you want. I think otherwise you can also do the thing you initially proposed and just create multiple folders with the respository and create the device separation that way.

idk its useful i able to get other device BP786N i get really cheap by coincidence.

BP786N / hem-7321 is very likely internally the same device as hem-7322, which is supported already.

@userx14
Copy link
Owner

userx14 commented Jul 25, 2023

I will close this issue now.
If you want additional info / support for the multi-device solution, we should discuss this in a new issue.

@userx14 userx14 closed this as completed Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants