Skip to content

Add additional context data to logbook events#71721

Merged
balloob merged 15 commits intohome-assistant:devfrom
bdraco:logbook_contexts
May 13, 2022
Merged

Add additional context data to logbook events#71721
balloob merged 15 commits intohome-assistant:devfrom
bdraco:logbook_contexts

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented May 12, 2022

frontend home-assistant/frontend#12667

Proposed change

Add additional context data to logbook events by removing the guards that prevented context data from being added to anything that wasn't a state_changed event (if not entity_id). Most of the special cases are gone so this is no longer needed. Additionally the EVENT_HOMEASSISTANT_START and EVENT_HOMEASSISTANT_STOP events no longer need to be special cases to they have been moved to an integration platform.

Drops the has been from trigger messages as it doesn't mesh well:

Screen Shot 2022-05-12 at 00 56 18

Before:
Put Master Bed TV Lift Up started from automation Master Bed Harmony is Switch Off for 25 seconds has been triggered by state of Watching TV in Master Bedroom

After:
Put Master Bed TV Lift Up started from automation Master Bed Harmony is Switch Off for 25 seconds triggered by state of Watching TV in Master Bedroom

Type of change

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

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link
Copy Markdown

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (logbook) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-home-assistant
Copy link
Copy Markdown

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (automation) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@bdraco bdraco force-pushed the logbook_contexts branch from b4855dc to e1731e5 Compare May 12, 2022 21:49
@bdraco bdraco marked this pull request as ready for review May 12, 2022 22:46
@bdraco bdraco requested review from a team, Kane610, balloob, bieniu, chemelli74 and thecode as code owners May 12, 2022 22:46
message.hass = hass
message = message.async_render(parse_result=False)
async_log_entry(hass, name, message, domain, entity_id)
async_log_entry(hass, name, message, domain, entity_id, service.context)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh that's a good catch.



@callback
def async_describe_events(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch that we can move this here.

@balloob balloob merged commit 24a0007 into home-assistant:dev May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants