From 0d0076ba6ee54fd1d68a67453c549f27fc9e5a2d Mon Sep 17 00:00:00 2001 From: Ernst79 Date: Fri, 12 May 2023 07:58:52 +0100 Subject: [PATCH] fix: add trigger based device to device type --- src/bthome_ble/parser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bthome_ble/parser.py b/src/bthome_ble/parser.py index 9b56845..685bc53 100644 --- a/src/bthome_ble/parser.py +++ b/src/bthome_ble/parser.py @@ -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 @@ -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}")