Ultra Card now features intelligent action resolution that automatically determines the most appropriate action for each entity type. This provides a native-feeling experience where buttons trigger presses, automations toggle, scripts run, and more - all without explicit configuration.
- New modules are created with
tap_action: { action: 'default', entity: <moduleEntity> } - This is stored in the configuration and persists across sessions
- The
'default'value acts as a smart placeholder that resolves at runtime
- In the Actions tab dropdown,
'default'is displayed as "More Info" (the first item) - This is purely a UI representation - the actual stored value remains
'default' - When viewing the dropdown:
- If stored action is
'default'→ shows as "More Info" (but keeps'default'internally) - Clicking on "More Info" when it's already the default → preserves
'default'action - Changing to a different action → stores that specific action (e.g.,
'toggle','navigate')
- If stored action is
- When an action is triggered with
action: 'default', theresolveDefaultAction()method:- Checks the entity's domain
- Returns the appropriate native action based on entity type
- Falls back to
'more-info'for unknown types
| Entity Domain | Resolved Action | Description |
|---|---|---|
button.* |
perform-action: button.press |
Triggers the button |
script.* |
perform-action: script.turn_on |
Runs the script |
scene.* |
perform-action: scene.turn_on |
Activates the scene |
automation.* |
toggle |
Toggles automation on/off |
switch.* |
toggle |
Toggles switch on/off |
light.* |
toggle |
Toggles light on/off |
fan.* |
toggle |
Toggles fan on/off |
input_boolean.* |
toggle |
Toggles input boolean |
lock.* |
toggle |
Locks/unlocks |
cover.* |
toggle |
Opens/closes |
| All others | more-info |
Shows entity details |
- User adds a module with an entity (e.g., a button entity)
- The Actions tab shows "More Info" as the default selection
- When tapped on the card, it intelligently triggers
button.press(not more-info) - User can still explicitly change to any other action if desired
- Modules with explicit actions (e.g.,
'toggle','navigate') continue to work exactly as before - Modules that were previously using
'more-info'by default now show that explicitly in the dropdown - No breaking changes to existing configurations
- Button entities: Pressing the card triggers the button (native feel)
- Automation entities: Tapping toggles the automation on/off
- Script entities: Tapping runs the script
- Sensor entities: Tapping shows more info (appropriate fallback)
-
src/components/ultra-link.ts- Added
resolveDefaultAction()method for entity domain detection - Modified
handleAction()to resolve'default'actions before execution
- Added
-
src/tabs/global-actions-tab.ts- Display logic converts
'default'to'more-info'for UI representation - Event handler preserves
'default'when user clicks on the displayed value - Entity picker shows for
'default'actions with smart description - Removed
'default'from dropdown options (following Mushroom Cards pattern)
- Display logic converts
-
src/types.ts- Added
'default'toActionTypeunion type
- Added
-
Module defaults updated:
src/modules/info-module.tssrc/modules/icon-module.tssrc/modules/animated-weather-module.tssrc/modules/animated-forecast-module.ts
Following Mushroom Cards' implementation pattern, we discovered that Home Assistant's ui_action selector doesn't properly render custom action types like 'default'. This was causing:
- Blank spaces in the dropdown list
- Rendering issues with list items
- Inconsistent display behavior
By removing 'default' from the dropdown and showing it as 'more-info', we achieve:
- Clean, standard HA dropdown appearance
- No blank spaces or rendering glitches
- Proper integration with HA's native UI components
- Smart resolution still works via stored
'default'value
We preserve the 'default' value in storage rather than converting to specific actions because:
- Future-proof: If entity domain changes or new action types are added, the card adapts automatically
- User Intent: User chose "let the card decide", not "always do X"
- Flexibility: Entity can be swapped without reconfiguring actions
- Maintenance: One source of truth for default behavior logic
The implementation includes safeguards against the common dropdown revert bug:
- Value comparison before processing updates
- Skip processing when displayed value matches current value
- Deferred preview updates to prevent mid-render changes
- Proper distinction between
actualActionanddisplayAction
✅ Button Entity: Tap triggers button.press service
✅ Automation Entity: Tap toggles automation on/off
✅ Switch Entity: Tap toggles switch on/off
✅ Script Entity: Tap runs the script
✅ Sensor Entity: Tap shows more info dialog
✅ Dropdown Stability: No revert-to-previous-value on click
✅ No Blank Spaces: Clean dropdown rendering
✅ Entity Swapping: Changing entity preserves smart default behavior
- Existing cards continue to work without changes
- New modules automatically get smart default behavior
- Users can still override with explicit actions anytime
- No configuration migration needed