Skip to content

Fix duplicate 'triggered' text in Logbook context messages (#23083)#51508

Draft
ellegamee wants to merge 1 commit into
home-assistant:devfrom
ellegamee:fix-logbook-duplicate-triggered
Draft

Fix duplicate 'triggered' text in Logbook context messages (#23083)#51508
ellegamee wants to merge 1 commit into
home-assistant:devfrom
ellegamee:fix-logbook-duplicate-triggered

Conversation

@ellegamee
Copy link
Copy Markdown
Contributor

Proposed change

This PR improves the readability of Logbook entries by removing redundant "triggered" text that often appears twice when automations are run manually or via certain services.

In many languages (like Swedish or German), this creates grammatically awkward sentences where a localized "Triggered by" is followed by a hardcoded English "triggered" from the backend. By filtering out the exact string "triggered" from the context_message, the UI remains clean while still allowing other important context messages to be displayed.

Screenshots

Before in German:
image

After in German:
image

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Member

@MindFreeze MindFreeze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it is removing more than just the "triggered" suffix

@silamon
Copy link
Copy Markdown
Contributor

silamon commented Apr 14, 2026

I don't think this is the way to go. The triggered comes from a suffix in the replacement and I guess it makes sense to fix it properly.

Copy link
Copy Markdown
Member

@MindFreeze MindFreeze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code extracted the trigger source from either item.context_source or from item.context_message.replace("triggered by ", "") and then localized it via localizeTriggerSource. The new code removes this entire branch, so the useful source of the trigger is no longer rendered at all. The fix removes information rather than removing the duplicate.

@home-assistant home-assistant Bot marked this pull request as draft April 20, 2026 06:16
@home-assistant
Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logbook: Duplicated "triggered" in entries when using "Run actions" for automations

3 participants