ratgdo / esphome-ratgdo

ratgdo for ESPHome
GNU General Public License v2.0
308 stars 75 forks source link

Compilation fails with custom config that doesn't include dry-contact sensors #264

Open kpfleming opened 3 weeks ago

kpfleming commented 3 weeks ago

I use my own config (not the ones from this repo), and I don't have any dry-contact connections to my board, so none of those components are present in my configuration.

Since the dry-contact code was merged into the main branch, compilation fails with my configuration because the code assumes that gpio_binary_sensor.h will be available, but it is not unless at least one platform: gpio binary_sensor has been included in the YAML configuration.

ESPHome generally solves this problem by providing USE_<foo> defines, but there is no USE_GPIO_BINARY_SENSOR define at this time. I'll work with the ESPHome team to see if this can be added, and if so I'll submit a PR to this repository to make use of it.

As a workaround, this can be added to the YAML configuration:

  # Dummy sensor to fix compile issues
  - platform: gpio
    id: dummy
    pin: D3
    internal: true
zd3sf commented 2 weeks ago

That solved my problem. I also have a custom YAML with no dry contacts. adding this per suggestion worked:

binary sensor:
  - platform: gpio
    id: dummy
    pin: D3
    internal: true