* Provide a logbook option entity_matches_only to optimize for single entity id lookup
When entity_matches_only is provided, contexts and events that do not
contain the entity_id are not included in the logbook response.
* Update homeassistant/components/logbook/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* api only takes a single entity
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Include the context_entity_id in the logbook api
context_entity_id is the first entity seen during
a time period that includes the context
* update test
* more of them
* include friendly name
* pylint wants a ternary
* Refactor
* performance
* fix homekit context
* Fix self describing events
* Fix external_events
* Remove support for legacy logbook events created before 0.112
Reduce the complexity of the logbook code. This
should also have a small performance boost.
* None is the default
* Move logbook continuous domain filtering to sql
sensors tend to generate a significant amount of states
that are filtered out by logbook. In testing 75% of
states can be filtered away in sql to avoid the
sqlalchemy ORM overhead of creating objects that will
be discarded.
* remove un-needed nesting
* Added GLOB capability to entityfilter and every place that uses it. All existing tests are passing
* added tests for components affected by glob change
* fixed flake8 error
* mocking the correct listener
* mocking correct bus method in azure test
* tests passing in 3.7 and 3.8
* fixed formatting issue from rebase/conflict
* Checking against glob patterns in more performant way
* perf improvments and reverted unnecessarily adjusted tests
* added new benchmark test around filters
* no longer using get with default in entityfilter
* changed filter name and removed logbook from filter benchmark
* simplified benchmark tests from feedback
* fixed apache tests and returned include exclude schemas to normal
* fixed azure event hub tests to properly go through component logic
* fixed azure test and clean up for other tests
* renaming test files to match standard
* merged mqtt statestream test changes with base
* removed dependency on recorder filter schema from history
* fixed recorder tests after merge and a bunch of lint errors
* adj
* time_fired_isoformat
* remove unused code
* tests for processing timestamps
* restore missing import lost in merge conflict
* test for None case
* Prefilter more logbook events in sql
Prefilter sensor events in _keep_event before humanify
Cache static attribute lookup
Reduces logbook execution time by ~35%
* fix mocking in benchmark
* Update tests for logbook users
* Add old_state_id to states, remove old/new state data from events since it can now be found by a join
* remove state lookup on restart
* Ensure old_state is set for exisitng states
* Only process logbook timestamps for events we will keep
Since we group by minute we were previously processing
every timestamp. We can avoid this by making all the
minute checks use the unprocessed datetime since
the groupings will be the same regardless of timezone.
This reduces the number of datetime object recreations
by at least an order of magnitude.
* Part 1 of 2 (no breaking changes in part 1).
When integrations configured via the UI block startup or fail to start,
the webserver can remain offline which make it is impossible
to recover without manually changing files in
.storage since the UI is not available.
This change is the foundation that part 2 will build on
and enable a listener to start the webserver when the frontend
is finished loading.
Frontend Changes (home-assistant/frontend#6068)
* Address review comments
* bump timeout to 1800s, adjust comment
* bump timeout to 4h
* remove timeout failsafe
* and the test
* Add a commit interval setting to recorder
* Make the default every 1s instead of immediate
* See attached py-spy flamegraphs for why 1s
* This avoids disk thrashing during event storms
* Make Home Assistant significantly more responsive on busy systems
* remove debug
* Add commit forces for tests that expect commits to be immediate
* Add commit forces for tests that expect commits to be immediate
* make sure _trigger_db_commit is in the right place (all effective "wait_recording_done" calls)
* De-duplicate wait_recording_done code
* Store last working HTTP settings
* Add safe mode
* Fix tests
* Add cloud to safe mode
* Update logging text
* Fix camera tests leaving files behind
* Make emulated_hue tests not leave files behind
* Make logbook tests not leave files behind
* Make tts tests not leave files behind
* Make image_processing tests not leave files behind
* Make manual_mqtt tests not leave files behind
Persons are now threated the same as device trackers, so the logbook states
"<name> is at <location>" or "<name> is away" instead of "<name> changed to <location|not_home>"
Binary sensors now show phrases that relate to their device_class attribute.
So "Front door is closed" instead of "Front door turned off" or "Hallway PIR detected movement"
instead of "Hallway PIR turned on"