Closed Ernst79 closed 1 year ago
https://github.com/Bluetooth-Devices/govee-ble/pull/34
Need to compare with this but mobile so can't dig right now
I think we need to remove 5071 from that block as it's actually being parsed right above it
Yes, I think we can remove the H5071 from the 2nd block, but I think we can move the H5051 to the first block as well, as the H5051 is in little endian as well. The only difference between the first and 2nd block is little vs big endian. The HCI dump above is from a H5051, and it uses little endian (1st block). So, there is no device that used big endian (2nd block).
So, I think we should delete the 2nd block and change the first block to
if msg_length == 9 and (
mgr_id == 0xEC88
or "H5051" in local_name # just to be sure
or "H5052" in local_name
or "H5071" in local_name
):
if "H5051" in local_name:
self.set_device_type("H5051")
elif "H5052" in local_name:
self.set_device_type("H5052")
elif "H5071" in local_name:
self.set_device_type("H5071")
else:
self.set_device_type("H5051") # I think if it hasn't a name, like in my HCI dump, it is a H5051
(temp, humi, batt) = PACKED_hHB_LITTLE.unpack(data[1:6])
self.update_predefined_sensor(
SensorLibrary.TEMPERATURE__CELSIUS, temp / 100
)
self.update_predefined_sensor(
SensorLibrary.HUMIDITY__PERCENTAGE, humi / 100
)
self.update_predefined_sensor(SensorLibrary.BATTERY__PERCENTAGE, batt)
return
Sounds good. Mind doing a PR?
Yes, sure, doing a final check in BLE monitor first.
I'll make a BLE monitor release first, and see if it all works out. If no-one complains, I'll create the PR.
I also have info about the H5198, another 4-probe meat sensor. If the user is confirming it works, I will add that one in the same PR. Wil probably do that at the end of the week, such that we know it works OK in BLE monitor.
Thanks @Ernst79
Describe the bug Shouldn't this be in little endian?
https://github.com/Bluetooth-Devices/govee-ble/blob/432223ada34def7bb58a1601afdfd6954cc3a152/src/govee_ble/parser.py#L190
Additional context HCI dump from https://github.com/custom-components/ble_monitor/issues/467
Will use this code (no local name)
In little endian, this makes sense.
BA 0A
--> 2746 / 100 = 27.46 degF5 0F
--> 4085 / 100 = 40.85 %64
--> 100%However,
PACKED_hHB.unpack(data[1:6])
is using big endianPACKED_hHB = struct.Struct(">hHB")