Skip to content

Commit

Permalink
Apple devices only unlocked fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH committed Jan 15, 2024
1 parent 58e5543 commit 08a80b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions TheengsGateway/ble_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,7 @@ def check_tracker_timeout(self) -> None:
):
# If the timestamp is later than current time minus tracker_timeout
# Publish offline message
message = json.dumps(
{"id": address, "state": "offline", "unlocked": False}
)
message = json.dumps({"id": address, "state": "offline"})
self.publish(
message,
self.configuration["publish_topic"]
Expand Down
4 changes: 3 additions & 1 deletion TheengsGateway/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ def publish_device_info(self, pub_device) -> None: # noqa: ANN001
device["pl_off"] = "False"
device["name"] = pub_device["model_id"] + "-" + k
device["uniq_id"] = pub_device_uuid + "-" + k
if self.configuration["hass_discovery"]:
if k == "unlocked":
device["val_tpl"] = "{% if value_json.get('unlocked') is true -%}True{%- else -%}False{%- endif %}" # noqa: E501
elif self.configuration["hass_discovery"]:
device["val_tpl"] = "{{ value_json." + k + " | is_defined }}"
else:
device["val_tpl"] = "{{ value_json." + k + " }}"
Expand Down

0 comments on commit 08a80b5

Please sign in to comment.