Add Restart Button fails

I want to add a restart button according to https://esphome.io/components/button/restart.html to my Bluetooth Proxy ESP32.

Out of the box it only comes with a safe mode boot button.

YAML of the ESP:

...
button:
  - platform: restart
    name: Restart
    entity_category: diagnostic
    disabled_by_default: false
    icon: mdi:restart
    device_class: restart
...

Validation gives:

button:
- platform: safe_mode
  name: Safe Mode Boot
  entity_category: diagnostic
  disabled_by_default: false
  icon: mdi:restart-alert
  device_class: restart
- platform: restart
  name: Restart
  entity_category: diagnostic
  disabled_by_default: false
  icon: mdi:restart
  device_class: restart

INFO Configuration is valid!

But when trying to install (wirelessly), I get:

Linking /data/esp-bluetooth-proxy/.pioenvs/esp-bluetooth-proxy/firmware.elf
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp-bluetooth-proxy/.pioenvs/esp-bluetooth-proxy/src/main.o:(.literal._Z5setupv+0xbc): undefined reference to `vtable for esphome::restart::RestartButton'
/data/cache/platformio/packages/[email protected]+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esp-bluetooth-proxy/.pioenvs/esp-bluetooth-proxy/src/main.o:(.literal._Z5setupv+0xc0): undefined reference to `vtable for esphome::restart::RestartButton'
collect2: error: ld returned 1 exit status
*** [/data/esp-bluetooth-proxy/.pioenvs/esp-bluetooth-proxy/firmware.elf] Error 1

As a complete ESPHome amateur, let me guess: the ESP itself does not support the restart button, maybe? It’s a Lolin32 Lite ESP32.

Try to make a clean build and deploy. If you are adding new dependencies, it is my go to solution.

  • clean build files
  • validate if you haven’t
  • install

So you mean… this order?

I only added the button definition for the restart button.

1 Like

Yes, and this would take less than 10 minutes and not harmful. Give it a try

Did so already few minutes ago, worked. File cleanup seems to be a good first try whenever installing fails in the first place. Thanks.

grafik

Button component was not there in the previous build, so this is a new component and it requires clean build. If you just change/modify existing components, you can just install which will hse previous artifacts rather than building everything from stratch.

Clean and install takes much more time than just install.

1 Like

Understood. Compiling takes some time indeed, system is not the fastest one. I built my “standard set” of interesting buttons and sensors now, even if I tend to disable some of them in the end in HA.

grafik

button:
  - platform: restart
    name: Restart
    entity_category: diagnostic
    disabled_by_default: false
    icon: mdi:restart
    device_class: restart
sensor:
  - platform: uptime
    name: Uptime
    update_interval: 60s
    entity_category: diagnostic
    disabled_by_default: false
    icon: mdi:clock
    unit_of_measurement: s
    state_class: total
  - platform: wifi_signal
    name: "WiFi RSSI"
    update_interval: 60s
    entity_category: diagnostic
    disabled_by_default: false
    icon: mdi:signal-variant
    unit_of_measurement: dBm
    state_class: measurement
  - platform: internal_temperature
    name: "Internal Temperature"
    update_interval: 60s
    entity_category: diagnostic
    disabled_by_default: false
    unit_of_measurement: °C
    state_class: measurement
    device_class: temperature

…where this has been there as default already:

button:
- platform: safe_mode
  name: Safe Mode Boot
  entity_category: diagnostic
  disabled_by_default: false
  icon: mdi:restart-alert
  device_class: restart
1 Like