From bed6f65de9876d02b0b8650ed992bfdc4c3af518 Mon Sep 17 00:00:00 2001 From: Adam Vest Date: Tue, 5 Aug 2025 00:14:38 -0400 Subject: [PATCH 1/2] Prepend system hostname to discovery_device_name Signed-off-by: Adam Vest --- TheengsGateway/__init__.py | 3 +++ TheengsGateway/config.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/TheengsGateway/__init__.py b/TheengsGateway/__init__.py index 9d806653..929e4464 100644 --- a/TheengsGateway/__init__.py +++ b/TheengsGateway/__init__.py @@ -58,6 +58,9 @@ def main() -> None: if not configuration["host"]: sys.exit("MQTT host is not specified") + if not configuration["discovery_device_name"]: + configuration["discovery_device_name"] = socket.gethostname() + "-TheengsGateway" + # Make sure discovery_filter is a list, and convert to list # if it is actually a string (Docker and HA Add-in) if isinstance(configuration["discovery_filter"], str): diff --git a/TheengsGateway/config.py b/TheengsGateway/config.py index b8fc97c0..dd6f5bd8 100644 --- a/TheengsGateway/config.py +++ b/TheengsGateway/config.py @@ -32,7 +32,7 @@ "discovery": 1, "general_presence": 0, "discovery_topic": "homeassistant", - "discovery_device_name": "TheengsGateway", + "discovery_device_name": "", "discovery_filter": [ "IBEACON", ], From 4d02b73639b59ddeec93a3c91fc2c14f799bc345 Mon Sep 17 00:00:00 2001 From: Adam Vest Date: Tue, 5 Aug 2025 00:24:15 -0400 Subject: [PATCH 2/2] Import socket! Signed-off-by: Adam Vest --- TheengsGateway/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/TheengsGateway/__init__.py b/TheengsGateway/__init__.py index 929e4464..6b09be68 100644 --- a/TheengsGateway/__init__.py +++ b/TheengsGateway/__init__.py @@ -20,6 +20,7 @@ import sys import uuid +import socket from pathlib import Path from .ble_gateway import run