esphome / issues

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

"adafruit_qtpy_esp32c3" board type not supported #3563

Open Zettaga opened 2 years ago

Zettaga commented 2 years ago

The problem

"adafruit_qtpy_esp32c3"(https://docs.platformio.org/en/latest/boards/espressif32/adafruit_qtpy_esp32c3.html) board type not supported, you get a "KeyError: 'target_platform'" error when attempting to use that board type. When using the default "esp32-c3-devkitm-1" device does not connect to wifi or communicate over usb once flashed

Which version of ESPHome has the issue?

2022.8.3

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.9.0

What platform are you using?

ESP32-IDF

Board

adafruit_qtpy_esp32c3

Component causing the issue

No response

Example YAML snippet

YAML for the correct board type (adafruit_qtpy_esp32c3)
esphome:
  name: esp32-c3-test

esp32:
  board: adafruit_qtpy_esp32c3
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "###"

ota:
  password: "###"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot in case wifi connection fails
  ap:
    ssid: "Esp32-C3-Test Fallback Hotspot"
    password: "0Wqr14boOJ38"

YAML for the incorrect board type (esp32-c3-devkitm-1)
esphome:
  name: esp32-c3-test

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "##"

ota:
  password: "##"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot in case wifi connection fails
  ap:
    ssid: "Esp32-C3-Test Fallback Hotspot"
    password: "0Wqr14boOJ38"

Anything in the logs that might be useful for us?

Logs when trying to install using the correct board type (adafruit_qtpy_esp32c3)

INFO Reading configuration /config/esphome/esp32-c3-test.yaml...
ERROR Unexpected exception while reading configuration:
Traceback (most recent call last):
  File "/usr/local/bin/esphome", line 33, in <module>
    sys.exit(load_entry_point('esphome', 'console_scripts', 'esphome')())
  File "/esphome/esphome/__main__.py", line 931, in main
    return run_esphome(sys.argv)
  File "/esphome/esphome/__main__.py", line 909, in run_esphome
    config = read_config(dict(args.substitution) if args.substitution else {})
  File "/esphome/esphome/config.py", line 973, in read_config
    res = load_config(command_line_substitutions)
  File "/esphome/esphome/config.py", line 828, in load_config
    return _load_config(command_line_substitutions)
  File "/esphome/esphome/config.py", line 816, in _load_config
    result = validate_config(config, command_line_substitutions)
  File "/esphome/esphome/config.py", line 743, in validate_config
    result.run_validation_steps()
  File "/esphome/esphome/config.py", line 124, in run_validation_steps
    task.step.run(self)
  File "/esphome/esphome/config.py", line 498, in run
    validated = schema(self.conf)
  File "/esphome/esphome/voluptuous_schema.py", line 34, in __call__
    res = super().__call__(data)
  File "/usr/local/lib/python3.9/dist-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.9/dist-packages/voluptuous/validators.py", line 229, in _run
    return self._exec(self._compiled, value, path)
  File "/usr/local/lib/python3.9/dist-packages/voluptuous/validators.py", line 353, in _exec
    v = func(path, v)
  File "/usr/local/lib/python3.9/dist-packages/voluptuous/schema_builder.py", line 818, in validate_callable
    return schema(data)
  File "/esphome/esphome/voluptuous_schema.py", line 34, in __call__
    res = super().__call__(data)
  File "/usr/local/lib/python3.9/dist-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.9/dist-packages/voluptuous/schema_builder.py", line 595, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/esphome/esphome/voluptuous_schema.py", line 118, in validate_mapping
    not isinstance(key.default, vol.Undefined)
  File "/esphome/esphome/config_validation.py", line 1455, in default
    if CORE.is_esp8266:
  File "/esphome/esphome/core/__init__.py", line 591, in is_esp8266
    return self.target_platform == "esp8266"
  File "/esphome/esphome/core/__init__.py", line 587, in target_platform
    return self.data[KEY_CORE][KEY_TARGET_PLATFORM]
KeyError: 'target_platform'

Additional information

I would love to just use esp32-c3-devkitm-1, however when I install using that board type the device does not connect to wifi at all, nor communicate over usb as far as I can tell. If im doing something wrong just let me know, thanks.

devoh747 commented 1 year ago

I believe the issue is esphome is using platformio/espressivif32 3.5.0 and support for this board was introduced in https://github.com/platformio/platform-espressif32/releases/tag/v4.3.0

The updates are covered in https://github.com/esphome/esphome/pull/3564 and https://github.com/esphome/esphome/pull/3565