custom-components / ble_monitor

BLE monitor for passive BLE sensors
https://community.home-assistant.io/t/passive-ble-monitor-integration/
MIT License
1.89k stars 243 forks source link

VegTrug Grow Care Garden (GCLS002) support #43

Closed ACrazyConcept closed 4 years ago

ACrazyConcept commented 4 years ago

I was able to get the VegTrug Grow Care Garden sensor (GCLS002) data.

It sends the same data as HHCCJCY01 but just use b'\x20\xBC\x03' instead of b'\x20\x98\x00'.

Magalex2x14 commented 4 years ago

Thank you, @ACrazyConcept . In the next couple of days I will add this to the code.

Magalex2x14 commented 4 years ago

@ACrazyConcept Do I understand correctly that this sensor is part of the Xiaomi ecosystem? I did not find any references on the manufacturer’s website, but I see the corresponding logo on the photos from sellers.

Magalex2x14 commented 4 years ago

(just missclick)

I ask just out of curiosity. I’ll add support anyway. Have you tried it with Mijia BT-gateway?

ACrazyConcept commented 4 years ago

(just missclick)

I ask just out of curiosity. I’ll add support anyway. Have you tried it with Mijia BT-gateway?

No I don't have a Mijia gateway. And I don't know if it is actually part of Xiaomi. I have only seen it branded as VegTrug. But it works in both the old Flower Care iOS app and the new VegTrug Grow Care app (the old Mi Flora sensors also work in the new app). It is a bit confusing to be honest. And it seems like it is not in stock at all on Amazon right now.

FCC link: https://fccid.io/2AQPCGCLS002

Magalex2x14 commented 4 years ago

Understood, thanks. Today I’ll do a release a bit later (I’ll skip the beta test step, because the changes are minor and not dangerous).

Magalex2x14 commented 4 years ago

0.5.7 released Feel free to reopen issue, if any problems arise.

ACrazyConcept commented 4 years ago

Just trying it now. Not getting the vegtrugs. Also noticed something. Don't you need an elif statement here as well? https://github.com/custom-components/sensor.mitemp_bt/blob/b6afc5fbda172fd696454943d4d239803c64ace6/custom_components/mitemp_bt/sensor.py#L423 Or am I missing something.

Magalex2x14 commented 4 years ago

HaHa! Good catch ) Please, change this line in your sensor.py to

if stype[mac] == "HHCCJCY01" or stype[mac] == "GCLS002":
Magalex2x14 commented 4 years ago

The fixed version will be released soon.

Magalex2x14 commented 4 years ago

@ACrazyConcept tell me, did you try to change the line as I indicated above? Is it works?

I decided not to make a separate release for this fix, since there will soon be an encrypted message support release and it will be 0.6.0, the fix will be included there.

ACrazyConcept commented 4 years ago

It works with that change. Thank you!

ACrazyConcept commented 3 years ago

I got some of the Flower Care Max which are really rebranded VegTrug Grow Care Garden. The model is now called HHCCJCY09. E.g. https://www.aliexpress.com/item/1005002828467111.html?spm=a2g0o.productlist.0.0.474316c5rOYjZ4&algo_pvid=0b13a98f-7e5b-4ae5-b3d7-14395c6c0185&algo_exp_id=0b13a98f-7e5b-4ae5-b3d7-14395c6c0185-2

They still come up with the name Grow care garden in lescan though and recognised as GCLS002 in ble_monitor. So I don't know how they could be distinguished from the GCLS002. I think the hardware is exactly the same. The firmware however is 3.6.6 whereas the firmware in the GCLS002 are stil at 3.6.3.

  report_unknown: Xiaomi

2021-07-26 15:51:53 INFO (MainThread) [custom_components.ble_monitor] Attention! Option report_unknown is enabled for Xiaomi sensors, be ready for a huge output...
2021-07-26 15:52:09 INFO (Thread-3) [custom_components.ble_monitor.ble_parser.xiaomi] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 184, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100101, UNKNOWN dataobject in payload! Adv: 131695fe7120bc03b83e596d8d7cc40d0b100101
2021-07-26 15:53:32 INFO (Thread-3) [custom_components.ble_monitor.ble_parser.xiaomi] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 189, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100101, UNKNOWN dataobject in payload! Adv: 131695fe7120bc03bd3e596d8d7cc40d0b100101
2021-07-26 15:53:55 INFO (Thread-3) [custom_components.ble_monitor.ble_parser.xiaomi] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 9, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100101, UNKNOWN dataobject in payload! Adv: 131695fe7120bc0309eb5b6d8d7cc40d0b100101
2021-07-26 15:54:49 INFO (Thread-3) [custom_components.ble_monitor.ble_parser.xiaomi] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 194, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100101, UNKNOWN dataobject in payload! Adv: 131695fe7120bc03c23e596d8d7cc40d0b100101
2021-07-26 15:56:29 INFO (Thread-3) [custom_components.ble_monitor.ble_parser.xiaomi] MiVer: 2, DevID: 0x3bc : GCLS002, FnCnt: 199, Request timing, Not bound, Old version certification, Capability: 0xd, No encryption, Object data: 0b100101, UNKNOWN dataobject in payload! Adv: 131695fe7120bc03c73e596d8d7cc40d0b100101
$ sudo hcitool lescan
C4:7C:8D:6D:59:3E Grow care garden
C4:7C:8D:6D:5B:EB Grow care garden
$ sudo btmon
> HCI Event: LE Meta Event (0x3e) plen 40                 #855 [hci0] 35.327182
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:59:3E (OUI C4-7C-8D)
        Data length: 28
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (partial): 1 entry
          Xiaomi Inc. (0xfe95)
        Service Data (UUID 0xfe95): 7120bc03cd3e596d8d7cc40d0410023c01
        RSSI: -82 dBm (0xae)

> HCI Event: LE Meta Event (0x3e) plen 39                 #860 [hci0] 35.493310
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:5B:EB (OUI C4-7C-8D)
        Data length: 27
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (partial): 1 entry
          Xiaomi Inc. (0xfe95)
        Service Data (UUID 0xfe95): 7120bc0309eb5b6d8d7cc40d0b100101
        RSSI: -87 dBm (0xa9)

> HCI Event: LE Meta Event (0x3e) plen 30                 #861 [hci0] 35.505964
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:59:3E (OUI C4-7C-8D)
        Data length: 18
        Name (complete): Grow care garden
        RSSI: -89 dBm (0xa7)

> HCI Event: LE Meta Event (0x3e) plen 30                 #862 [hci0] 35.585295
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:5B:EB (OUI C4-7C-8D)
        Data length: 18
        Name (complete): Grow care garden
        RSSI: -88 dBm (0xa8)

> HCI Event: LE Meta Event (0x3e) plen 40                 #910 [hci0] 37.987792
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:59:3E (OUI C4-7C-8D)
        Data length: 28
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (partial): 1 entry
          Xiaomi Inc. (0xfe95)
        Service Data (UUID 0xfe95): 7120bc03cd3e596d8d7cc40d0410023c01
        RSSI: -88 dBm (0xa8)

> HCI Event: LE Meta Event (0x3e) plen 30                 #913 [hci0] 38.169700
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:59:3E (OUI C4-7C-8D)
        Data length: 18
        Name (complete): Grow care garden
        RSSI: -88 dBm (0xa8)

> HCI Event: LE Meta Event (0x3e) plen 39                 #923 [hci0] 38.552109
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:5B:EB (OUI C4-7C-8D)
        Data length: 27
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (partial): 1 entry
          Xiaomi Inc. (0xfe95)
        Service Data (UUID 0xfe95): 7120bc0309eb5b6d8d7cc40d0b100101
        RSSI: -89 dBm (0xa7)

> HCI Event: LE Meta Event (0x3e) plen 30                 #933 [hci0] 38.864364
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:5B:EB (OUI C4-7C-8D)
        Data length: 18
        Name (complete): Grow care garden
        RSSI: -88 dBm (0xa8)

> HCI Event: LE Meta Event (0x3e) plen 40                 #978 [hci0] 41.139049
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:59:3E (OUI C4-7C-8D)
        Data length: 28
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (partial): 1 entry
          Xiaomi Inc. (0xfe95)
        Service Data (UUID 0xfe95): 7120bc03cd3e596d8d7cc40d0410023c01
        RSSI: -88 dBm (0xa8)

> HCI Event: LE Meta Event (0x3e) plen 30                 #979 [hci0] 41.141382
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:59:3E (OUI C4-7C-8D)
        Data length: 18
        Name (complete): Grow care garden
        RSSI: -89 dBm (0xa7)

> HCI Event: LE Meta Event (0x3e) plen 39                 #980 [hci0] 41.253429
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:5B:EB (OUI C4-7C-8D)
        Data length: 27
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        16-bit Service UUIDs (partial): 1 entry
          Xiaomi Inc. (0xfe95)
        Service Data (UUID 0xfe95): 7120bc0309eb5b6d8d7cc40d0b100101
        RSSI: -87 dBm (0xa9)

> HCI Event: LE Meta Event (0x3e) plen 30                 #981 [hci0] 41.255327
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Scan response - SCAN_RSP (0x04)
        Address type: Public (0x00)
        Address: C4:7C:8D:6D:5B:EB (OUI C4-7C-8D)
        Data length: 18
        Name (complete): Grow care garden
        RSSI: -90 dBm (0xa6)
$ sudo hcidump --raw
> 04 3E 1E 02 01 04 00 3E 59 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A9

> 04 3E 28 02 01 00 00 3E 59 6D 8D 7C C4 1C 02 01 06 03 02 95
  FE 14 16 95 FE 71 20 BC 03 CD 3E 59 6D 8D 7C C4 0D 04 10 02
  3C 01 AA

> 04 3E 1E 02 01 04 00 3E 59 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A9

> 04 3E 27 02 01 00 00 EB 5B 6D 8D 7C C4 1B 02 01 06 03 02 95
  FE 13 16 95 FE 71 20 BC 03 09 EB 5B 6D 8D 7C C4 0D 0B 10 01
  01 A9

> 04 3E 1E 02 01 04 00 EB 5B 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A8

> 04 3E 28 02 01 00 00 3E 59 6D 8D 7C C4 1C 02 01 06 03 02 95
  FE 14 16 95 FE 71 20 BC 03 CD 3E 59 6D 8D 7C C4 0D 04 10 02
  3C 01 AE

> 04 3E 27 02 01 00 00 EB 5B 6D 8D 7C C4 1B 02 01 06 03 02 95
  FE 13 16 95 FE 71 20 BC 03 09 EB 5B 6D 8D 7C C4 0D 0B 10 01
  01 A9

> 04 3E 1E 02 01 04 00 3E 59 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A7

> 04 3E 1E 02 01 04 00 EB 5B 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A8

> 04 3E 28 02 01 00 00 3E 59 6D 8D 7C C4 1C 02 01 06 03 02 95
  FE 14 16 95 FE 71 20 BC 03 CD 3E 59 6D 8D 7C C4 0D 04 10 02
  3C 01 A8

> 04 3E 1E 02 01 04 00 3E 59 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A8

> 04 3E 27 02 01 00 00 EB 5B 6D 8D 7C C4 1B 02 01 06 03 02 95
  FE 13 16 95 FE 71 20 BC 03 09 EB 5B 6D 8D 7C C4 0D 0B 10 01
  01 A7

> 04 3E 1E 02 01 04 00 EB 5B 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A8

> 04 3E 28 02 01 00 00 3E 59 6D 8D 7C C4 1C 02 01 06 03 02 95
  FE 14 16 95 FE 71 20 BC 03 CD 3E 59 6D 8D 7C C4 0D 04 10 02
  3C 01 A8

> 04 3E 1E 02 01 04 00 3E 59 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A7

> 04 3E 27 02 01 00 00 EB 5B 6D 8D 7C C4 1B 02 01 06 03 02 95
  FE 13 16 95 FE 71 20 BC 03 09 EB 5B 6D 8D 7C C4 0D 0B 10 01
  01 A9

> 04 3E 1E 02 01 04 00 EB 5B 6D 8D 7C C4 12 11 09 47 72 6F 77
  20 63 61 72 65 20 67 61 72 64 65 6E A6
Ernst79 commented 3 years ago

I ran one of the usefull advertisements 043E28020100003E596D8D7CC41C020106030295FE141695FE7120BC03CD3E596D8D7CC40D0410023C01A8 through the xiaomi parser and the result is {'rssi': -88, 'mac': 'C47C8D6D593E', 'type': 'GCLS002', 'packet': 205, 'firmware': 'Xiaomi (MiBeacon V2)', 'data': True, 'temperature': 31.6}. So I guess the sensor is working fine, but you would prefer to see the new name HHCCJCY09.

I'm afraid there is no way to distinguish between the two, normally the device type is identified by two bytes, in this case bc03, it appears that they use the same for both GCLS002 and HHCCJCY09. Changing the name will most likely cause braking changes for GCLS002 users, as HA stores the name in the registry for the device and thing go wrong if I change it (users will have to delete their device and add it again. So, I prefer not to change the name. I will however update the docs.

ACrazyConcept commented 3 years ago

Yeah probably best to not change anything for now then. Just thought I would have it checked. Thanks :)

ML19821 commented 6 months ago

I bought the "Max" from techpunt. (https://www.techpunt.nl/en/xiaomi-hhcc-mi-flower-care-plant-sensor-max.html)

It has the firmware 3.6.6, shown in the Flower Care App.

It is detected by HomeAssistant as a GCLS002 sensor, but the values are updated only 1-2 times a week. It seems that the values are only updated when I use the app