custom-components / ble_monitor

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

[New Sensor]: Linptech Pressure Sensor linp.senpres.ps1bb #1367

Open yangqian opened 3 weeks ago

yangqian commented 3 weeks ago

Sensor Description

Linptech Pressure Sensor

Additional information

BLE KEY: 9b4441bc2505db3c3484bae6b7631b34 MODEL: linp.senpres.ps1bb

Links: https://home.miot-spec.com/spec/linp.senpres.ps1bb

https://www.aliexpress.com/item/1005006174475704.html

BLE advertisements

MAC: A4:C1:38:0F:D6:9B, ADV: 0e1695fe10594c3f1c9bd60f38c1a4
 MAC: A4:C1:38:0F:D6:9B, ADV: 161695fe48594c3f1dc3f1031c213a340400007e37ccbb
 MAC: A4:C1:38:0F:D6:9B, ADV: 161695fe48594c3f1f2473e91da249ac04000061003083
 MAC: A4:C1:38:0F:D6:9B, ADV: 161695fe48594c3f21f4957fb405c9cf040000d8252537
 MAC: A4:C1:38:0F:D6:9B, ADV: 191695fe58594c3f1e9bd60f38c1a46928e35104000036f77f5c
 MAC: A4:C1:38:0F:D6:9B, ADV: 191695fe58594c3f209bd60f38c1a469308be20400000d1fb1bf
yangqian commented 3 weeks ago

Will get more data, the last two lines seems to give battery, others seems empty. "0x34c015e" "0x34c015f" 0x5f is 95.

yangqian commented 3 weeks ago

Despite it advertise as a BLE device, I did not get any useful packet as quite a long time. Maybe it is BLE Mesh or requires active connection?

Ernst79 commented 3 weeks ago

No, there is data in there

0e1695fe10594c3f1c9bd60f38c1a4= no data 161695fe48594c3f1dc3f1031c213a340400007e37ccbb gives us a packet of type 483F (Pressure Present Time Set) with value 30 (seconds) 161695fe48594c3f21f4957fb405c9cf040000d8252537 gives us a packet of type 483D ( Pressure Present Duration) with value 7800 (seconds) 191695fe58594c3f1e9bd60f38c1a46928e35104000036f77f5c gives us battery 94% 191695fe58594c3f209bd60f38c1a469308be20400000d1fb1bf gives us battery 95%

I have to check if I can find the script that tells me exactly what 483F en 483D is, but it should be one of the sensors that is in the miot specs

Ernst79 commented 3 weeks ago

Found the script

prop.2.1061 (Pressure Present Duration) uint32 = eid 18493 (0x483d)
prop.2.1060 (Pressure Present State) bool = eid 18492 (0x483c)
prop.2.1062 (Pressure Not Present Duration) uint32 = eid 18494 (0x483e)
prop.2.1064 (Pressure Not Present Time Set) uint32 = eid 18496 (0x4840)
prop.2.1063 (Pressure Present Time Set) uint32 = eid 18495 (0x483f)
evnt.2.1028 (Device Be Reset) = eid 18972 (0x4a1c)
prop.3.1003 (Battery Level) uint8 = eid 19459 (0x4c03)
yangqian commented 3 weeks ago

Thanks. I was not able to decrypt the middle three lines, I used the cipher.decrypt_and_verify(cipherpayload, token) mentioned in the script https://home-is-where-you-hang-your-hack.github.io/ble_monitor/MiBeacon_protocol was only able to decrypt the last two lines.

Ernst79 commented 3 weeks ago

Yes, probably because the data types are not yet in BLE monitor for 483d, 483c etc. will add these, but I also will need to add some new sensors for this, as I don't think we have a Pressure Not Present Duration sensor :-) etc

Ernst79 commented 3 weeks ago

Will add support in #1368

Ernst79 commented 3 weeks ago

You can try 12.12.0-beta for a first test

yangqian commented 2 weeks ago

Thanks for the prompt patch. The beta looks good.

Though I am not sure if the following sensors are useful to home assistant. They seems to be used to trigger automation in mijia but Home assistant do not quite need them. (I can disable them at home assistant any way). prop.2.1061 (Pressure Present Duration) uint32 = eid 18493 (0x483d) increases one in a while prop.2.1062 (Pressure Not Present Duration) uint32 = eid 18494 (0x483e) increases one in a while prop.2.1064 (Pressure Not Present Time Set) uint32 = eid 18496 (0x4840) is always 30 prop.2.1063 (Pressure Present Time Set) uint32 = eid 18495 (0x483f) is always 30

evnt.2.1028 (Device Be Reset) = eid 18972 (0x4a1c) never triggered. This is not trigger by pressing the button (for pairing purposes).

Ernst79 commented 2 weeks ago

I can let them be disabled by default. the user can than decide for him/herself to enable these sensors.