devbis / ble2mqtt

Bluetooth to MQTT bridge, add your bluetooth-capable (including controllable) devices to your smart home
MIT License
125 stars 26 forks source link

Support: Help understanding frequency of updates #45

Closed rayzorben closed 1 year ago

rayzorben commented 1 year ago

Trying this out for the first time, and I had a few questions.

  1. The primary one being how frequently does ble2mqtt check for the presence of the device and its RSSI? I know you can set the threshold of when a device is considered away. However it seems like it is only checking about once per minute.

The next issue pertains to that - as you can see it checked for the Govee from 19:55-19:58 before finally checking at 19:59 for the OnePlus. And there are multiple times that it doesn't check for the OnePlus. This phone is actually paired to bluetoothctl

  1. Can I increase the frequency of these checks?
  2. Can I rename the device in mqtt so that it is not 0xac5f.. I know you can set a friendly name for home assistant, but would like to see in MQTT
2022-12-11 19:55:21 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 19, 55, 18, 3735))
2022-12-11 19:56:22 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
2022-12-11 19:57:23 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
2022-12-11 19:58:24 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
2022-12-11 19:59:11 INFO: [Generic_OnePlus_8T_rays_phone] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 19, 59, 8, 912660))
2022-12-11 19:59:25 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
2022-12-11 20:00:12 INFO: [Generic_OnePlus_8T_rays_phone] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 20, 0, 1, 891776))
2022-12-11 20:00:26 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
2022-12-11 20:00:40 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=False, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
2022-12-11 20:01:13 INFO: [Generic_OnePlus_8T_rays_phone] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 20, 0, 47, 455634))
2022-12-11 20:01:42 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=False, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
2022-12-11 20:02:14 INFO: [Generic_OnePlus_8T_rays_phone] send state=SensorState(presence=True, last_check=datetime.datetime(2022, 12, 11, 20, 1, 54, 670655))
2022-12-11 20:02:43 INFO: [Generic_Govee_H5051_F895_govee] send state=SensorState(presence=False, last_check=datetime.datetime(2022, 12, 11, 19, 55, 40, 3525))
devbis commented 1 year ago
  1. If the device state didn't change, it sends the current value every minute. To avoid spamming MQTT and to keep the smart home notified, e.g. after rebooting. If the device is not present, the first presence packet will force ble2mqtt to send info to MQTT. If the device is present, the threshold defines how many seconds it should wait since the last ble advertising packet to mark the device as not present.

  2. Checks are done every second, but using the rules above.

  3. Renaming topics is not supported, 'case mqtt is more a transport layer than a tool for visualization.