Skip to content

Commit

Permalink
Merge pull request #68 from Bluetooth-Devices/sleep
Browse files Browse the repository at this point in the history
fix: add trigger based device to device type
  • Loading branch information
Ernst79 authored May 12, 2023
2 parents 4f40296 + 0d0076b commit 31e4b8c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/bthome_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def _parse_bthome_v2(
mac_readable = service_info.address
payload = data[1:]

# If True, the device is not updating regularly
# If True, the device is only updating when triggered
self.sleepy_device = bool(adv_info & (1 << 2)) # bit 2

# Check BTHome version
Expand Down Expand Up @@ -309,6 +309,10 @@ def _parse_bthome_v2(
if manufacturer:
self.set_device_manufacturer(manufacturer)

# Add the indication of a trigger based device to the device type
if self.sleepy_device:
device_type = f"{device_type} (trigger based device)"

# Get device information from local name and identifier
self.set_device_name(f"{name} {identifier}")
self.set_title(f"{name} {identifier}")
Expand Down

0 comments on commit 31e4b8c

Please sign in to comment.