Skip to content

Commit edc682b

Browse files
authoredJan 16, 2024
Apple devices only unlocked fix (#221)
1 parent 116f78b commit edc682b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

‎TheengsGateway/ble_gateway.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,7 @@ def check_tracker_timeout(self) -> None:
345345
):
346346
# If the timestamp is later than current time minus tracker_timeout
347347
# Publish offline message
348-
message = json.dumps(
349-
{"id": address, "state": "offline", "unlocked": False}
350-
)
348+
message = json.dumps({"id": address, "state": "offline"})
351349
self.publish(
352350
message,
353351
self.configuration["publish_topic"]

‎TheengsGateway/discovery.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ def publish_device_info(self, pub_device) -> None: # noqa: ANN001
164164
device["pl_off"] = "False"
165165
device["name"] = pub_device["model_id"] + "-" + k
166166
device["uniq_id"] = pub_device_uuid + "-" + k
167-
if self.configuration["hass_discovery"]:
167+
if k == "unlocked":
168+
device[
169+
"val_tpl"
170+
] = "{% if value_json.get('unlocked') is true -%}True{%- else -%}False{%- endif %}" # noqa: E501
171+
elif self.configuration["hass_discovery"]:
168172
device["val_tpl"] = "{{ value_json." + k + " | is_defined }}"
169173
else:
170174
device["val_tpl"] = "{{ value_json." + k + " }}"

0 commit comments

Comments
 (0)
Please sign in to comment.