custom-components / ble_monitor

BLE monitor for passive BLE sensors

Home Page:https://community.home-assistant.io/t/passive-ble-monitor-integration/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Precision of xiaomi temperature

MichalLytek opened this issue · comments

What happened?

Even tho the TelinkFlasher is able to collect the precise data from the sensor (2 digits precision):

image

HA only gets the single digit precision:

image

Entity precision in HA is set properly:

image

Sensor type

LYWSD03MMC

Relevant log output

No response

I think that this is a difference in how the information is obtained.

  • The TelinkFlasher is connecting to the device and "asking" for the temperature. In BLE terms, this is called reading the characteristics.
  • BLE monitor is passively listening to BLE broadcasts. This won't require to set up a connection, the sensor is just broadcasting every x minutes its current temperature.

The passive BLE advertisements are with one digit precision. It actually sends an integer (zero precision) and divides that by 10 making it 1 digit precision. So it is not possible to get 2 digit precision, unless you make a connection (which is out of the scope of BLE monitor.

def obj1004(xobj):
    """Temperature"""
    if len(xobj) == 2:
        (temp,) = T_STRUCT.unpack(xobj)
        return {"temperature": temp / 10}
    else:
        return {}

Thanks for the clarification.

I wanted to calibrate the readings from my sensors by manipulating the offset but 1 digit precision rounding is a bit limitating. It's ok for temperature tracking in HA although.

opera_prJEuB2i4Z