From 18360bd35cb5ec6d7086c1460de484ed9a9c6e31 Mon Sep 17 00:00:00 2001 From: guillempages Date: Sun, 10 May 2020 15:53:32 +0200 Subject: [PATCH] Add battery status to bluetooth_le tracker (#12507) * Add battery status to bluetooth_le tracker Added a parameter to enable the Bluetooth LE device tracker to check the battery status of tracked devices. * Improve documentation after PR changes --- source/_integrations/bluetooth_le_tracker.markdown | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/_integrations/bluetooth_le_tracker.markdown b/source/_integrations/bluetooth_le_tracker.markdown index e1f73a2ed9e..76d03ce18b3 100644 --- a/source/_integrations/bluetooth_le_tracker.markdown +++ b/source/_integrations/bluetooth_le_tracker.markdown @@ -37,6 +37,11 @@ track_new_devices: required: false default: false type: boolean +track_battery: + description: Whether the integration should try to read the battery status for tracked devices. + required: false + default: false + type: boolean interval_seconds: description: Seconds between each scan for new devices. required: false @@ -47,6 +52,8 @@ interval_seconds: As some BT LE devices change their MAC address regularly, a new device is only discovered when it has been seen 5 times. Some BTLE devices (e.g., fitness trackers) are only visible to the devices that they are paired with. In this case, the BTLE tracker won't see this device. +Enabling the battery tracking might slightly decrease the duration of the battery, but since this is only done at most once a day, this shouldn't be noticeable. Not all devices offer battery status information; if the information is not available, the integration will only try once at startup. + ## Rootless Setup Normally accessing the Bluetooth stack is reserved for root, but running programs that are networked as root is a bad security wise. To allow non-root access to the Bluetooth stack we can give Python 3 and hcitool the missing capabilities to access the Bluetooth stack. Quite like setting the setuid bit (see [Stack Exchange](https://unix.stackexchange.com/questions/96106/bluetooth-le-scan-as-non-root) for more information).