Restart a ESPhome device with home assistant automation

I have a device that seems to after awhile drop off my esphome bluetooth. Restarting the ESPhome seems to fix the issue.

Just wondering how I can send a restart command to esphome device via automation so that I can say if this device becomes unavailable restart esphome bluetooth device.

I have found references to this switch Restart Switch — ESPHome

but not sure which YAML this goes in, is it in the actual config of the device?

Thanks

The restart button is a better fit than the restart switch:

Simply because for the switch you never use the turn off service. Once you turn the switch on the device reboots and the switch state becomes off.

The button is used by pressing it and has no state.

The button config goes in your ESPHome device config.

You then use it in a Home Assistant automation like this:

actions:
  - action: button.press
    target:
      enntity_id: button.your_device_name_here_restart
2 Likes

Thanks updating ESP device now.