From 3d98f85a095dcf887a3a4ef1891b141d33cde362 Mon Sep 17 00:00:00 2001 From: Florian Hess Date: Thu, 31 Oct 2024 17:42:49 +0100 Subject: [PATCH] Include Libraries via CodeGenerator --- .github/example-project-dev.yaml | 6 ------ .github/example-project-main.yaml | 6 ------ README.md | 7 ------- components/nuki_lock/lock.py | 10 ++++++++++ 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/example-project-dev.yaml b/.github/example-project-dev.yaml index b48c71f..c4f9887 100644 --- a/.github/example-project-dev.yaml +++ b/.github/example-project-dev.yaml @@ -2,12 +2,6 @@ esphome: name: test-nuki - libraries: - - Preferences - - https://github.com/h2zero/NimBLE-Arduino#1.4.0 - - Crc16 - - https://github.com/I-Connect/NukiBleEsp32 - esp32: framework: type: arduino diff --git a/.github/example-project-main.yaml b/.github/example-project-main.yaml index afe1856..c4f9887 100644 --- a/.github/example-project-main.yaml +++ b/.github/example-project-main.yaml @@ -2,12 +2,6 @@ esphome: name: test-nuki - libraries: - - Preferences - - https://github.com/h2zero/NimBLE-Arduino#1.4.0 - - Crc16 - - https://github.com/I-Connect/NukiBleEsp32#93e7da927171c8973b7ef857c7fa644c174ed47d - esp32: framework: type: arduino diff --git a/README.md b/README.md index 80e2fb6..430423a 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,6 @@ The lock entity is updated whenever the look changes state (via Nuki App, HA, or Add the following to the ESPHome yaml file: ```yaml -esphome: - libraries: - - Preferences - - https://github.com/h2zero/NimBLE-Arduino#1.4.0 - - Crc16 - - https://github.com/uriyacovy/NukiBleEsp32 - external_components: - source: github://uriyacovy/ESPHome_nuki_lock diff --git a/components/nuki_lock/lock.py b/components/nuki_lock/lock.py index 7f75580..dc2b48f 100644 --- a/components/nuki_lock/lock.py +++ b/components/nuki_lock/lock.py @@ -456,6 +456,16 @@ async def to_code(config): trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var) await automation.build_automation(trigger, [], conf) + # Libraries + cg.add_library("Preferences", None) + cg.add_library("h2zero/NimBLE-Arduino", "1.4.0") + cg.add_library("Crc16", None) + cg.add_library( + None, + None, + "https://github.com/I-Connect/NukiBleEsp32#93e7da927171c8973b7ef857c7fa644c174ed47d", + ) + # Actions NukiLockUnpairAction = nuki_lock_ns.class_(