rednblkx / HAP-ESPHome

Apple HomeKit for ESPHome
101 stars 11 forks source link

Build fail if lock component is not present #15

Closed marcelo-lara closed 3 months ago

marcelo-lara commented 3 months ago

Context/Goal I need to control two binary lamps with HomeKit without HomeAssistant.

Issue On a generic ESP32, the test https://github.com/rednblkx/HAP-ESPHome/blob/main/homekey-test-esp32.yaml builds fine;

Then, I add a light and remove the lock component and build fails here:

Compiling .pioenvs/isa-light/src/esphome/components/homekit/lock.cpp.o
src/esphome/components/homekit/lock.cpp:7:5: error: 'readerData_t' does not name a type
    7 |     readerData_t LockEntity::readerData;
      |     ^~~~~~~~~~~~
src/esphome/components/homekit/lock.cpp:8:5: error: 'nvs_handle' does not name a type
    8 |     nvs_handle LockEntity::savedHKdata;
      |     ^~~~~~~~~~
src/esphome/components/homekit/lock.cpp:9:5: error: 'pn532' does not name a type
    9 |     pn532::PN532* LockEntity::nfc_ctx;
      |     ^~~~~

here's my complete yaml file

esphome:
    name: hap-light

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "hap-light fallback"
    password: !secret wifi_password

light:
  - platform: binary
    id: party_light
    name: "Party"
    output: relay_1
  - platform: binary
    id: black_light
    name: "BlackLight"
    icon: "mdi:light-flood-down"
    output: relay_2

output:
  - id: relay_1
    platform: gpio
    inverted: true
    pin: GPIO13
  - id: relay_2
    platform: gpio
    inverted: true
    pin: GPIO12

external_components:
  source: github://rednblkx/HAP-ESPHome@main

spi:
  clk_pin: 18
  miso_pin: 19
  mosi_pin: 23

pn532_spi:
  id: nfc_spi_module
  cs_pin: 5
  update_interval: 100ms

esp32:
  board: esp32dev
  flash_size: 4MB
  framework:
    type: esp-idf
    version: 5.2.1
    platform_version: 6.7.0
    sdkconfig_options:
      CONFIG_COMPILER_OPTIMIZATION_SIZE: y
      CONFIG_LWIP_MAX_SOCKETS: "16"
      CONFIG_MBEDTLS_HKDF_C: y

homekit_base:
  setup_code: '159-35-728'

homekit:
  light:
    - id: party_light
    - id: black_light

logger:
  level: DEBUG
marcelo-lara commented 3 months ago

BTW: I'm a C developer... I would try to build this thing to submit a PR maybe, if you want ;)

marcelo-lara commented 3 months ago

??

marcelo-lara commented 3 months ago

GitHub bot virus?? wow..

rednblkx commented 3 months ago

Really hoped they would not come back, had another one on my other repo couple days ago.

Anyway, regarding your issue, think I might’ve missed some macros, I’ll be having a look later on. Also, appreciate your offer to help, a PR would be most welcome.

rednblkx commented 3 months ago

This should do it, let me know if anything else

marcelo-lara commented 3 months ago

This should do it, let me know if anything else

will look into it later... Thanks!!

marcelo-lara commented 3 months ago

Awesome! The next beer is on me ;) thanks!