Button Press Actions Using Labels Not Working

I have many ESPHome devices with reboot buttons. I have an automation which will ‘press’ this button on all my devices some time after a network power cycle to help the wifi devices connect to the nearest wifi mesh node.

I thought a more elegant way to approach this would be to use a label instead of triggering all the button entities individually, and allow for better management and scaling. However, the ‘button press’ action does not seem to work with labels. When I trigger the automation with the labels action, the button is not pressed. But if I try the identical setup targeting the button entities specifically, the automation triggers the button press. Am I doing something wrong with this label setup or is this a bug?

Example of ESP reboot button entities with label:

action: button.press
metadata: {}
data: {}
target:
  label_id: esp_reboot

action: button.press
metadata: {}
data: {}
target:
  entity_id:
    - button.garage_bay_1_restart
    - button.garage_bay_2_restart
    - button.humen_sensor_1m_314e18_esp_reboot
    - button.screek_kitchen_mmw_2a_esp_reboot
    - button.screek_humen_sensor_1u_eab1e8_esp_reboot
    - button.screek_co2_sensor_1_d119f4_esp_reboot
    - button.screek_humen_sensor_1u_eab1f8_esp_reboot
    - button.screek_humen_sensor_1u_e1e2d8_esp_reboot
    - button.screek_humen_sensor_1u_eab1d4_esp_reboot
    - button.screek_downstairs_foyer_pir_motion_esp_reboot
    - button.humen_sensor_1m_30bd70_esp_reboot

I don’t see any related log entries or issues in the trace result for the automation either.

Probably a bug. I ran into something similar, though I can’t quite remember the details. Just seems like labels aren’t quite fully implemented for everything everywhere.

Have you tried replacing the literal label id with a template? I.e. replace label_id: esp_reboot with entity_id: "{{ label_entities('esp_reboot') }}"

1 Like

Hadn’t thought of that; this is a good workaround for now. Thanks for the suggestion!