laberning / openrowingmonitor

A free and open source performance monitor for rowing machines
https://laberning.github.io/openrowingmonitor
GNU General Public License v3.0
98 stars 19 forks source link

MyHomeKit BT connection #39

Closed zonradkuse closed 2 years ago

zonradkuse commented 2 years ago

Hi there!

I am currently playing around with openrowingmonitor and wanted to try out the BT connection using MyHomeKit. Unfortunately, I can't connect and I am not familiar with BLE and the FTMS protocols.

I am using a fresh install of openrowingmonitor as of today on a raspberry pi 3. The bluetooth device is discoverable as OpenRowingMonitor by my Pixel 5 in MyHomeKit.

I've got the following log from btmon:

> HCI Event: LE Meta Event (0x3e) plen 19                                                                                                                                                                                #1 [hci0] 42.692667
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 64
        Role: Slave (0x01)
        Peer address type: Random (0x01)
        Peer address: 5F:8D:75:73:D2:71 (Resolvable)
        Connection interval: 45.00 msec (0x0024)
        Connection latency: 0 (0x0000)
        Supervision timeout: 5000 msec (0x01f4)
        Master clock accuracy: 0x05
@ MGMT Event: Device Connected (0x000b) plen 13                                                                                                                                                                    {0x0002} [hci0] 42.692789
        LE Address: 5F:8D:75:73:D2:71 (Resolvable)
        Flags: 0x00000000
        Data length: 0
@ MGMT Event: Device Connected (0x000b) plen 13                                                                                                                                                                    {0x0001} [hci0] 42.692789
        LE Address: 5F:8D:75:73:D2:71 (Resolvable)
        Flags: 0x00000000
        Data length: 0
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                                                                                                                                                         #2 [hci0] 42.693118
        Handle: 64
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                #3 [hci0] 42.694093
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
< HCI Command: Read RSSI (0x05|0x0005) plen 2                                                                                                                                                                            #4 [hci0] 42.696030
        Handle: 64
> HCI Event: Command Complete (0x0e) plen 7                                                                                                                                                                              #5 [hci0] 42.700881
      Read RSSI (0x05|0x0005) ncmd 1
        Status: Success (0x00)
        Handle: 64
        RSSI: -37 dBm (0xdb)
> ACL Data RX: Handle 64 flags 0x02 dlen 11                                                                                                                                                                              #6 [hci0] 42.876264
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0xffff
        Attribute type: Unknown (0x2b3a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                               #7 [hci0] 42.877203
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x0001
        Error: Attribute Not Found (0x0a)
> HCI Event: LE Meta Event (0x3e) plen 12                                                                                                                                                                                #8 [hci0] 42.920779
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 64
        Features: 0x1f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
= bluetoothd: src/device.c:load_gatt_db() No cache for 5F:8D:75:73:D2:71                                                                                                                                                           42.921577
> ACL Data RX: Handle 64 flags 0x02 dlen 11                                                                                                                                                                              #9 [hci0] 43.100642
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 64 flags 0x00 dlen 24                                                                                                                                                                             #10 [hci0] 43.101690
      ATT: Read By Group Type Response (0x11) len 19
        Attribute data length: 6
        Attribute group list: 3 entries
        Handle range: 0x0001-0x0005
        UUID: Generic Access Profile (0x1800)
        Handle range: 0x0006-0x0009
        UUID: Generic Attribute Profile (0x1801)
        Handle range: 0x000a-0x0014
        UUID: Fitness Machine (0x1826)
> ACL Data RX: Handle 64 flags 0x02 dlen 11                                                                                                                                                                             #11 [hci0] 43.190682
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0015-0xffff
        Attribute group type: Primary Service (0x2800)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #12 [hci0] 43.191009
        Num handles: 1
        Handle: 64
        Count: 2
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #13 [hci0] 43.191088
      ATT: Read By Type Response (0x09) len 4
        Attribute data length: 3
        Attribute data list: 1 entry
        Handle: 0x000f
        Value: 01
< ACL Data TX: Handle 64 flags 0x00 dlen 7                                                                                                                                                                              #14 [hci0] 43.191114
      ATT: Exchange MTU Request (0x02) len 2
        Client RX MTU: 517
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #15 [hci0] 43.191716
      ATT: Error Response (0x01) len 4
        Read By Group Type Request (0x10)
        Handle: 0x0015
        Error: Attribute Not Found (0x0a)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #16 [hci0] 43.236641
        Num handles: 1
        Handle: 64
        Count: 2
< ACL Data TX: Handle 64 flags 0x00 dlen 24                                                                                                                                                                             #17 [hci0] 43.236720
      ATT: Read By Group Type Response (0x11) len 19
        Attribute data length: 6
        Attribute group list: 3 entries
        Handle range: 0x0001-0x0005
        UUID: Generic Access Profile (0x1800)
        Handle range: 0x0006-0x000f
        UUID: Generic Attribute Profile (0x1801)
        Handle range: 0x0010-0x0012
        UUID: Device Information (0x180a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #18 [hci0] 43.236752
      ATT: Error Response (0x01) len 4
        Read By Group Type Request (0x10)
        Handle: 0x0015
        Error: Attribute Not Found (0x0a)
> ACL Data RX: Handle 64 flags 0x02 dlen 7                                                                                                                                                                              #19 [hci0] 43.280624
      ATT: Exchange MTU Response (0x03) len 2
        Server RX MTU: 517
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #20 [hci0] 43.281299
        Num handles: 1
        Handle: 64
        Count: 2
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #21 [hci0] 43.281363
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0xffff
        Attribute type: Unknown (0x2b3a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #22 [hci0] 43.281475
      ATT: Error Response (0x01) len 4
        Exchange MTU Response (0x03)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #23 [hci0] 43.371084
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                                                                                                              #24 [hci0] 43.415635
      ATT: Read By Type Response (0x09) len 4
        Attribute data length: 3
        Attribute data list: 1 entry
        Handle: 0x0005
        Value: 01
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #25 [hci0] 43.415994
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #26 [hci0] 43.416538
      ATT: Error Response (0x01) len 4
        Read By Type Response (0x09)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #27 [hci0] 43.461082
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 18                                                                                                                                                                             #28 [hci0] 43.505818
      ATT: Read By Group Type Response (0x11) len 13
        Attribute data length: 6
        Attribute group list: 2 entries
        Handle range: 0x0001-0x0009
        UUID: Generic Attribute Profile (0x1801)
        Handle range: 0x0014-0xffff
        UUID: Generic Access Profile (0x1800)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #29 [hci0] 43.506667
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0006-0xffff
        Attribute type: Unknown (0x2b3a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #30 [hci0] 43.506960
      ATT: Error Response (0x01) len 4
        Read By Group Type Response (0x11)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #31 [hci0] 43.551099
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                                                                                                              #32 [hci0] 43.595721
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x0006
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #33 [hci0] 43.596524
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Secondary Service (0x2801)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #34 [hci0] 43.596990
      ATT: Error Response (0x01) len 4
        Error Response (0x01)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #35 [hci0] 43.641102
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                                                                                                              #36 [hci0] 43.685646
      ATT: Error Response (0x01) len 4
        Read By Group Type Request (0x10)
        Handle: 0x0001
        Error: Unsupported Group Type (0x10)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #37 [hci0] 43.686548
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0xffff
        Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #38 [hci0] 43.686777
      ATT: Error Response (0x01) len 4
        Error Response (0x01)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #39 [hci0] 43.731131
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                                                                                                              #40 [hci0] 43.775642
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x0001
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #41 [hci0] 43.776138
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0xffff
        Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #42 [hci0] 43.777909
      ATT: Error Response (0x01) len 4
        Error Response (0x01)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #43 [hci0] 43.821092
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 27                                                                                                                                                                             #44 [hci0] 43.865993
> ACL Data RX: Handle 64 flags 0x01 dlen 27                                                                                                                                                                             #45 [hci0] 43.866650
> ACL Data RX: Handle 64 flags 0x01 dlen 1                                                                                                                                                                              #46 [hci0] 43.867171
      ATT: Read By Type Response (0x09) len 50
        Attribute data length: 7
        Attribute data list: 7 entries
        Handle: 0x0002
        Value: 200300052a
        Handle: 0x0004
        Value: 0205003a2b
        Handle: 0x0006
        Value: 0a0700292b
        Handle: 0x0008
        Value: 0209002a2b
        Handle: 0x0015
        Value: 021600002a
        Handle: 0x0017
        Value: 021800012a
        Handle: 0x0019
        Value: 021a00a62a
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #47 [hci0] 43.867687
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x001a-0xffff
        Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #48 [hci0] 43.868156
      ATT: Error Response (0x01) len 4
        Read By Type Response (0x09)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #49 [hci0] 43.911090
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                                                                                                              #50 [hci0] 43.955643
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x001a
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #51 [hci0] 43.956443
      ATT: Find Information Request (0x04) len 4
        Handle range: 0x001b-0xffff
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #52 [hci0] 43.957078
      ATT: Error Response (0x01) len 4
        Error Response (0x01)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #53 [hci0] 44.001080
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                                                                                                              #54 [hci0] 44.045643
      ATT: Error Response (0x01) len 4
        Find Information Request (0x04)
        Handle: 0x001b
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #55 [hci0] 44.046935
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0xffff
        Attribute type: Database Hash (0x2b2a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #56 [hci0] 44.047128
      ATT: Error Response (0x01) len 4
        Error Response (0x01)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #57 [hci0] 44.091093
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 24                                                                                                                                                                             #58 [hci0] 44.135923
      ATT: Read By Type Response (0x09) len 19
        Attribute data length: 18
        Attribute data list: 1 entry
        Handle: 0x0009
        Value: 8991c462ebe9d90b9ea0da3e16d0f513
< ACL Data TX: Handle 64 flags 0x00 dlen 11                                                                                                                                                                             #59 [hci0] 44.136422
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x000a-0xffff
        Attribute type: Database Hash (0x2b2a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #60 [hci0] 44.137030
      ATT: Error Response (0x01) len 4
        Read By Type Response (0x09)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #61 [hci0] 44.181093
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 9                                                                                                                                                                              #62 [hci0] 44.225645
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x000a
        Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #63 [hci0] 44.226899
      ATT: Error Response (0x01) len 4
        Error Response (0x01)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
< ACL Data TX: Handle 64 flags 0x00 dlen 18                                                                                                                                                                             #64 [hci0] 44.233043
      LE L2CAP: LE Connection Request (0x14) ident 1 len 10
        PSM: 39 (0x0027)
        Source CID: 64
        MTU: 517
        MPS: 247
        Credits: 3
< ACL Data TX: Handle 64 flags 0x00 dlen 18                                                                                                                                                                             #65 [hci0] 44.233461
      LE L2CAP: LE Connection Request (0x14) ident 2 len 10
        PSM: 39 (0x0027)
        Source CID: 65
        MTU: 517
        MPS: 247
        Credits: 3
< ACL Data TX: Handle 64 flags 0x00 dlen 8                                                                                                                                                                              #66 [hci0] 44.233873
      ATT: Write Request (0x12) len 3
        Handle: 0x0007
          Data: 07
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #67 [hci0] 44.271129
        Num handles: 1
        Handle: 64
        Count: 2
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #68 [hci0] 44.272531
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 18                                                                                                                                                                             #69 [hci0] 44.315825
      LE L2CAP: LE Connection Response (0x15) ident 1 len 10
        Destination CID: 0
        MTU: 0
        MPS: 0
        Credits: 0
        Result: Connection refused - PSM not supported (0x0002)
> ACL Data RX: Handle 64 flags 0x02 dlen 18                                                                                                                                                                             #70 [hci0] 44.316532
      LE L2CAP: LE Connection Response (0x15) ident 2 len 10
        Destination CID: 0
        MTU: 0
        MPS: 0
        Credits: 0
        Result: Connection refused - PSM not supported (0x0002)
> ACL Data RX: Handle 64 flags 0x02 dlen 5                                                                                                                                                                              #71 [hci0] 44.317085
      ATT: Write Response (0x13) len 0
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #72 [hci0] 44.317742
      ATT: Error Response (0x01) len 4
        Write Response (0x13)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
< ACL Data TX: Handle 64 flags 0x00 dlen 7                                                                                                                                                                              #73 [hci0] 44.318447
      ATT: Read Request (0x0a) len 2
        Handle: 0x0016
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #74 [hci0] 44.361092
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 12                                                                                                                                                                             #75 [hci0] 44.405662
      ATT: Read Response (0x0b) len 7
        Value: 506978656c2035
< ACL Data TX: Handle 64 flags 0x00 dlen 7                                                                                                                                                                              #76 [hci0] 44.406278
      ATT: Read Request (0x0a) len 2
        Handle: 0x0018
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #77 [hci0] 44.406786
      ATT: Error Response (0x01) len 4
        Read Response (0x0b)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #78 [hci0] 44.451117
        Num handles: 1
        Handle: 64
        Count: 2
> ACL Data RX: Handle 64 flags 0x02 dlen 7                                                                                                                                                                              #79 [hci0] 44.495594
      ATT: Read Response (0x0b) len 2
        Value: 0000
< ACL Data TX: Handle 64 flags 0x00 dlen 9                                                                                                                                                                              #80 [hci0] 44.496861
      ATT: Error Response (0x01) len 4
        Read Response (0x0b)
        Handle: 0x0000
        Error: Request Not Supported (0x06)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                  #81 [hci0] 44.585576
        Num handles: 1
        Handle: 64
        Count: 2
> HCI Event: Disconnect Complete (0x05) plen 4                                                                                                                                                                          #82 [hci0] 48.365855
        Status: Success (0x00)
        Handle: 64
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                  {0x0002} [hci0] 48.365973
        LE Address: 5F:8D:75:73:D2:71 (Resolvable)
        Reason: Connection terminated by remote host (0x03)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                  {0x0001} [hci0] 48.365973
        LE Address: 5F:8D:75:73:D2:71 (Resolvable)
        Reason: Connection terminated by remote host (0x03)
< HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1                                                                                                                                                             #83 [hci0] 48.448272
        Advertising: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                                                                             #84 [hci0] 48.448816
      LE Set Advertise Enable (0x08|0x000a) ncmd 1
        Status: Success (0x00)

Do you have any idea why this is happening and what I could try to fix this?

Cheers! Johannes

laberning commented 2 years ago

Hi Johannes,

if you are using the profile "FTMS Rower" in Open Rowing Monitor, then this implements parts of the BLE GATT protocol for the Fitness Machine Service 1.0 for Rowers. You can download those specs from https://www.bluetooth.com.

I'm not sure what MyHomeKit expects or what your exact usage scenario is. But I would assume that you either have to implement a custom connector in MyHomeKit for FTMS or you would have to implement a custom Bluetooth profile in Open Rowing Monitor that is supported by home automation systems.

zonradkuse commented 2 years ago

I'm sorry for the typo. I meant MyHomeFit as it is mentioned in the README.md and OpenRowingMonitior is listed there as possible device to connect to.

Gordon-Shumway2 commented 2 years ago

Hi Johannes,

BLE connections from MyHomeFit to openrowingmonitor should now work - see https://github.com/laberning/openrowingmonitor/discussions/36

zonradkuse commented 2 years ago

lovely! thank you so much! I'll close this and report back if I encounter any issues :)

laberning commented 2 years ago

Hihi all good, I was thinking you were planning some kind of MyHomeKit Home Automation Integration with your rowing machine 😄

zonradkuse commented 2 years ago

That could be funny -- to keep some smart light bulb on you have to row constantly. I might give that a try when I find the time and let you know! :D

laberning commented 2 years ago

Yes you are right 😄 I just created an idea on the board here: #43 so we don't forget about it. Still can not think of a use-case where this is really useful, but it for sure would make a rower with Open Rowing Monitor unique...