Skip to content

Actions and Interactions

aspenrt78 edited this page Nov 29, 2025 · 2 revisions

Actions and Interactions

Configure how your buttons respond to user interaction.

Action Types

Button Builder supports five action trigger points:

Trigger Activation Default
Tap Single tap/click toggle
Hold Long press (~500ms) more-info
Double Tap Two quick taps none

Available Actions

toggle

Toggles the entity's state (on/off).

tap_action:
  action: toggle

Works with:

  • Lights
  • Switches
  • Fans
  • Input booleans
  • Covers
  • Locks
  • Media players

more-info

Opens the entity's detailed dialog.

tap_action:
  action: more-info

Options:

Option Description
entity Override which entity's info to show
tap_action:
  action: more-info
  entity: sensor.temperature  # Show different entity

call-service

Calls any Home Assistant service.

tap_action:
  action: call-service
  service: light.turn_on
  service_data:
    entity_id: light.bedroom
    brightness_pct: 75
    rgb_color: [255, 100, 100]

Options:

Option Description
service Service to call (e.g., light.turn_on)
service_data Data to pass to the service
target Target entities/areas/devices

Common Service Examples

Turn on light with brightness:

tap_action:
  action: call-service
  service: light.turn_on
  service_data:
    entity_id: light.living_room
    brightness_pct: 100

Set light color:

tap_action:
  action: call-service
  service: light.turn_on
  service_data:
    entity_id: light.strip
    rgb_color: [255, 0, 150]

Run a script:

tap_action:
  action: call-service
  service: script.turn_on
  service_data:
    entity_id: script.good_morning

Send notification:

tap_action:
  action: call-service
  service: notify.mobile_app
  service_data:
    title: "Button Pressed"
    message: "Living room button was tapped"

Control media player:

tap_action:
  action: call-service
  service: media_player.play_media
  service_data:
    entity_id: media_player.speaker
    media_content_id: "spotify:playlist:xyz"
    media_content_type: music

Set climate temperature:

tap_action:
  action: call-service
  service: climate.set_temperature
  service_data:
    entity_id: climate.thermostat
    temperature: 72

Control cover position:

tap_action:
  action: call-service
  service: cover.set_cover_position
  service_data:
    entity_id: cover.blinds
    position: 50

navigate

Navigate to another dashboard view.

tap_action:
  action: navigate
  navigation_path: /lovelace/lights

Options:

Option Description
navigation_path Dashboard path to navigate to

Path Examples:

Path Description
/lovelace/0 First view (index)
/lovelace/lights View with path "lights"
/config HA configuration
/developer-tools Developer tools
/my-dashboard/rooms Custom dashboard view

url

Open a URL in a new browser tab.

tap_action:
  action: url
  url_path: https://example.com

Options:

Option Description
url_path URL to open

Examples:

# External website
tap_action:
  action: url
  url_path: https://weather.com

# Internal HA page
tap_action:
  action: url
  url_path: /local/camera_snapshot.jpg

# IP camera stream
tap_action:
  action: url
  url_path: http://192.168.1.100:8080/stream

assist

Open the Home Assistant Assist dialog.

tap_action:
  action: assist

Options:

Option Description
pipeline_id Specific Assist pipeline to use
start_listening Start with microphone active
tap_action:
  action: assist
  start_listening: true

fire-dom-event

Fire a custom browser event for advanced integrations.

tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      content:
        type: entities
        entities:
          - light.bedroom
          - light.bathroom

Common Uses:

  • Browser Mod popups
  • Custom JavaScript handlers
  • Integration with other frontend tools

none

Disable the action entirely.

tap_action:
  action: none

Use Cases:

  • Display-only buttons
  • Prevent accidental toggles
  • Child-proof buttons

Action Configuration in Button Builder

Setting Tap Action

  1. Navigate to Actions category
  2. Select Tap Action
  3. Choose action type from dropdown
  4. Configure action-specific options

Setting Hold Action

  1. Navigate to Actions category
  2. Select Hold Action
  3. Configure as above

Setting Double Tap Action

  1. Navigate to Actions category
  2. Select Double Tap Action
  3. Configure as above

Confirmation Dialogs

Require user confirmation before executing an action.

tap_action:
  action: toggle
  confirmation:
    text: "Are you sure you want to toggle this light?"

Confirmation Options:

Option Description
text Custom confirmation message
exemptions Users exempt from confirmation

With Exemptions:

tap_action:
  action: call-service
  service: script.arm_alarm
  confirmation:
    text: "Arm the alarm system?"
    exemptions:
      - user: admin_user_id

When to Use Confirmation

  • Destructive actions (delete, reset)
  • Security actions (lock, arm alarm)
  • Expensive operations (garage door, irrigation)
  • Public dashboards (prevent accidental triggers)

Haptic Feedback

Provide tactile feedback on mobile devices.

tap_action:
  action: toggle
  haptic: medium

Haptic Options:

Value Description
success Success vibration
warning Warning vibration
failure Error vibration
light Light tap
medium Medium tap
heavy Heavy tap
selection Selection feedback

Advanced Action Patterns

Different Actions per Trigger

tap_action:
  action: toggle
hold_action:
  action: more-info
double_tap_action:
  action: call-service
  service: light.turn_on
  service_data:
    entity_id: light.bedroom
    brightness_pct: 100

Multi-Entity Control

Control multiple entities with one button:

tap_action:
  action: call-service
  service: light.turn_on
  target:
    entity_id:
      - light.living_room
      - light.kitchen
      - light.hallway
  service_data:
    brightness_pct: 100

Scene Activation

tap_action:
  action: call-service
  service: scene.turn_on
  service_data:
    entity_id: scene.movie_time

Conditional Actions with Templates

Using button-card templates:

tap_action:
  action: |
    [[[
      if (entity.state === 'on') {
        return {
          action: 'call-service',
          service: 'light.turn_off',
          service_data: { entity_id: entity.entity_id }
        };
      }
      return {
        action: 'call-service',
        service: 'light.turn_on',
        service_data: { 
          entity_id: entity.entity_id,
          brightness_pct: 50
        }
      };
    ]]]

Action Recipes

Quick Brightness Toggle

Tap for toggle, hold for full brightness:

tap_action:
  action: toggle
hold_action:
  action: call-service
  service: light.turn_on
  service_data:
    entity_id: light.bedroom
    brightness_pct: 100
double_tap_action:
  action: call-service
  service: light.turn_on
  service_data:
    entity_id: light.bedroom
    brightness_pct: 25

Room Overview Button

Tap for main light, hold for all lights:

entity: light.living_room_main
tap_action:
  action: toggle
hold_action:
  action: call-service
  service: light.turn_on
  target:
    entity_id:
      - light.living_room_main
      - light.living_room_lamp
      - light.living_room_strip

Info + Control Button

Tap for info, hold for toggle:

tap_action:
  action: more-info
hold_action:
  action: toggle

Navigation Hub

tap_action:
  action: navigate
  navigation_path: /lovelace/living-room
hold_action:
  action: navigate
  navigation_path: /lovelace/settings
double_tap_action:
  action: navigate
  navigation_path: /lovelace/overview

Troubleshooting Actions

Action Not Working

  1. Check entity availability - Is entity in "unavailable" state?
  2. Check service name - Use Developer Tools > Services to verify
  3. Check permissions - Does user have access to entity?
  4. Check service data - Validate JSON/YAML format

Toggle Not Working

Some entities don't support toggle:

  • Use homeassistant.toggle for broad compatibility
  • Or use explicit turn_on/turn_off services

Navigation Not Working

  • Ensure path starts with /
  • Check dashboard and view names match exactly
  • Case-sensitive paths

Next Steps

Clone this wiki locally