Skip to content

Adjust logbook stream consumer to handle new metadata#12755

Merged
balloob merged 1 commit intohome-assistant:devfrom
bdraco:logbook_stream_metadata
May 24, 2022
Merged

Adjust logbook stream consumer to handle new metadata#12755
balloob merged 1 commit intohome-assistant:devfrom
bdraco:logbook_stream_metadata

Conversation

@bdraco
Copy link
Member

@bdraco bdraco commented May 23, 2022

Wait for home-assistant/core#72394

Proposed change

Adjust logbook stream consumer to handle new metadata

The response format has changed to allow for metadata:

{
  'events': list[...],
  'start_time': float | None
  'end_time': float | None
  'partial': bool
}

events now contains the event stream
start_time is the start time of the query against the historical data (only present for historical data)
end_time is the end time of the query against the historical data (only present for historical data)
partial if present indicates more historical data is coming in a future message.

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

Example configuration

Additional information

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

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

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

this._logbookEntries = newEntries;
return;
}
if (!newEntries.length) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This will fix the Cannot read properties of undefined (reading 'when') error logbook data is empty for the live period.

I noticed it when I put the prerelease from an hour ago on my RPi3 (not powerful enough to run the dev setup for frontend so I have to wait for releases to test)

Copy link
Member Author

@bdraco bdraco May 24, 2022

Choose a reason for hiding this comment

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

Besides that, logbook is quite responsive on my RPi3 test machine with the lowest quality micro sd card I have that I could get to boot for testing.

@balloob balloob merged commit 3acab5a into home-assistant:dev May 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 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