From c7616edfec3064f482589e482a7b39543acd8472 Mon Sep 17 00:00:00 2001 From: t0urista Date: Wed, 30 Oct 2024 08:52:44 +0100 Subject: [PATCH] Update __init__.py --- esphome/components/bthome/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/bthome/__init__.py b/esphome/components/bthome/__init__.py index 6c465dc506..9482162ded 100644 --- a/esphome/components/bthome/__init__.py +++ b/esphome/components/bthome/__init__.py @@ -32,4 +32,5 @@ async def to_code(config): await esp32_ble_tracker.register_ble_device(var, config) cg.add(var.set_address(config[CONF_MAC_ADDRESS].as_hex)) - cg.add(var.set_encryption_key(config[CONF_ENCRYPTION_KEY])) + if CONF_ENCRYPTION_KEY in config: + cg.add(var.set_encryption_key(config[CONF_ENCRYPTION_KEY]))