esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
285 stars 34 forks source link

Package defaults: does not work with a non empty vars: section #5726

Closed ZetaPhoenix closed 3 weeks ago

ZetaPhoenix commented 3 weeks ago

The problem

I am attempting to use the defaults: section mentioned in the packages (see https://esphome.io/guides/configuration-types.html) but not override any of the defaults and I can no longer compile with the following error:

Component not found: defaults.

Which version of ESPHome has the issue?

2024.4.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

NA

What platform are you using?

ESP8266

Board

No response

Component causing the issue

defaults

Example YAML snippet

`roomblinds.yaml`

packages:
  servo-blind: !include devices/servoblinds.yaml

devices/servoblinds.yaml

defaults:
  servo_pin: D3

output:
  - platform: esp8266_pwm
    id: pwm_output
    pin: ${servo_pin}
    frequency: 50 Hz

servo:
  - id: blind_tilt_servo
    output: pwm_output
    min_level: 3.0%
    idle_level: 7.5%
    max_level: 13.0%

### Anything in the logs that might be useful for us?

```txt
INFO ESPHome 2024.4.1
INFO Reading configuration /config/esphome/mainbedroomblinds.yaml...
WARNING Found '${servo_pin}' (see output->0->pin) which looks like a substitution, but 'servo_pin' was not declared
WARNING Found '${servo_pin}' (see output->0->pin) which looks like a substitution, but 'servo_pin' was not declared
Failed config

defaults: [source /config/esphome/devices/servoblinds.yaml:7]

  Component not found: defaults.
  servo_pin: D3
output.esp8266_pwm: [source /config/esphome/devices/servoblinds.yaml:108]
  platform: esp8266_pwm
  id: pwm_output

  Cannot resolve pin name '${servo_pin}' for board d1_mini.
  pin: ${servo_pin}
  frequency: 50 Hz

Additional information

ssieb said to reference: https://github.com/esphome/esphome/pull/5752 and said

ok, apparently you need a (non-empty) vars: section in the include.