Commit Graph

60 Commits (ca54de095d297a75fce0c8529ac205fbe4641435)

Author SHA1 Message Date
Franck Nijhof 3f96ebeae5
Add selectors to Logger, System Log & Logbook service definitions (#46740) 2021-02-18 16:33:29 +01:00
tkdrob d8a2e0e051
Remove unnecessary variables from logbook (#46350) 2021-02-10 12:17:37 -10:00
Michael Chisholm e35e460e69
Use parent_id to find cause of logbook events with new contexts (#44416)
* Use parent_id to find cause of events with new contexts

When looking up the causing event for logbook display, use the `parent_id`
of the current context if the current context just points back to the
current event.

This now shows in the logbook the cause of an event in the case that a
component has created a new context from an existing context and tied
them together via the `Context.parent_id`.

* Fix exception when parent event not available

* Use async_Log_entry to avoid jump into executor
2021-01-07 20:27:03 -10:00
Franck Nijhof 0e98bc5ea2
Skip template result parsing in several places (#42408)
* Skip template result parsing in several places

* Adjust alert integration

* Adjust Alexa integration

* Adjust apns integration

* Adjust arest integration

* Adjust dialogflow integration

* Adjust generic camera integration

* Adjust imap email content  integration

* Adjust InfluxDB integration

* Adjust intent integration

* Adjust logbook integration

* Adjust HP ILO integration

* Adjust manual alarm control panel integration

* Adjust manual mqtt alarm control panel integration

* Adjust minio integration

* Adjust mqtt integration

* Adjust notify integration

* Adjust persistent notification integration

* Adjust rest integration

* Adjust rss feed template integration

* Adjust slack integration

* Adjust Xiaomi integration

* Adjust TCP integration

* Adjust Telegram Bot integration

* Bump CI cache version

* Revert "Bump CI cache version"

This reverts commit 875efe58cf.

* Adjust demo tests
2020-10-26 19:29:10 +01:00
Philip Allgaier 625bbe6238
Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02:00
J. Nick Koston 2076fc59c4
Remove message and domain from logbook state_changed events (#40070)
These are now handled by the frontend as we move closer
to making the logbook localized.
2020-09-30 11:29:51 -05:00
J. Nick Koston aada6a1d88
Fix logbook with empty filter and remove unused code (#40565) 2020-09-30 13:10:11 +02:00
J. Nick Koston a19e10c57a
Add entity glob matching support to history (#40387) 2020-09-28 15:58:55 +02:00
J. Nick Koston 7029345b9d
Add support for selecting multiple entity ids from logbook (#40075) 2020-09-22 09:27:04 -05:00
J. Nick Koston 15281f468e
Extract the icon and state for logbook state changed events (#40039) 2020-09-14 09:35:19 -05:00
J. Nick Koston 45c28dd9c5
Provide a logbook option entity_matches_only to optimize for single entity lookup (#39555)
* 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>
2020-09-02 10:32:08 -05:00
J. Nick Koston dda4cf4d58
Tune logbook performance to accomodate recent changes (#39348) 2020-08-30 09:20:31 +02:00
J. Nick Koston 6b7a7939d2
Include the first seen context data in the logbook api (#39194)
* 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
2020-08-24 12:44:40 -05:00
J. Nick Koston f6b0f8d6de
Update logbook to use async_add_executor_job (#38217) 2020-07-26 10:42:28 +02:00
J. Nick Koston 9db6318122
Remove support for legacy logbook events created before 0.112 (#37822)
* 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
2020-07-15 10:38:08 -10:00
J. Nick Koston 4b2ebf5487
Ensure removed entities are not displayed in logbook (#37395) 2020-07-03 23:08:46 -07:00
J. Nick Koston 7e664fbb3b
Ensure logbook entries appear when the logbook.log (#37388)
service without a domain or entity_id
2020-07-02 19:53:28 -05:00
J. Nick Koston a87c29b5d9
Ensure logbook performs well when filtering is configured (#37292) 2020-07-02 09:12:27 -07:00
J. Nick Koston 76db2b39b0
Move logbook continuous domain filtering to sql (#37115)
* 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
2020-06-26 09:12:50 -05:00
Paulus Schoutsen 5bc6ed4cef
Add logbook platforms (#37078)
* Add logbook platforms

* Fix logbook describe test
2020-06-24 18:14:50 -07:00
mdegat01 6c7355785a
Add support for glob matching to entity filters (#36913)
* 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
2020-06-23 20:02:29 -05:00
J. Nick Koston 5b79c1f9ef
Remove support for deprecated hidden attribute from logbook and history (#37039) 2020-06-23 13:40:39 -07:00
J. Nick Koston 53a91ece4e
Improve isoformat timestamp performance (#36991)
* adj

* time_fired_isoformat

* remove unused code

* tests for processing timestamps

* restore missing import lost in merge conflict

* test for None case
2020-06-22 12:06:02 -05:00
J. Nick Koston 1de97e3a35
Fix logbook filtering by entity id (#36973)
* Fix logbook filtering by entity_id

* remove debug
2020-06-21 14:34:47 -05:00
J. Nick Koston 59e43ab6e4
Prefilter more logbook events in sql (#36958)
* 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
2020-06-21 10:50:58 -07:00
J. Nick Koston e7d982ee11
Improve db performance of state change events and reduce overall db size (#36883)
* 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
2020-06-17 22:26:41 -05:00
J. Nick Koston 3d385796da
Improve logbook performance when no entities are filtered (#36842)
Various tweaks to reduce the python overhead of
the lazy class
2020-06-17 13:23:42 -07:00
J. Nick Koston b8c9f67533
Remove context_id from logbook api (#36796)
Reduces size of api response, execution, and download time.
2020-06-15 16:13:07 -05:00
J. Nick Koston 0a219081ea
Only process logbook timestamps for events we will keep (#36792)
* 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.
2020-06-15 14:54:20 -05:00
J. Nick Koston b0163b65c6
Use states to avoid decoding logbook state changed events. (#36768)
avg 4.43s -> 1.88s
2020-06-15 13:53:05 -05:00
J. Nick Koston e443dc1274
Speed up logbook with a lazy event decoder (#36730) 2020-06-15 10:53:38 -07:00
Franck Nijhof 238430136e
Migrate script to use describe_event for logbook (#36729) 2020-06-12 16:44:29 -07:00
Franck Nijhof bf95658e24
Fix logbook filtering for described events (#36727) 2020-06-12 20:45:17 +02:00
J. Nick Koston 751e2f4125
Extend logbook api to be able to fetch a slice of data between two time boundaries. (#35847)
* Create logbook_timeslice api

* add end_datetime

* Add tests

* switch to end_time to match history api
2020-06-03 14:07:56 -05:00
Franck Nijhof e6fe34e64d
Migrate automation to use describe_event for logbook (#36356) 2020-06-01 17:18:40 -07:00
J. Nick Koston c2f8e0bf66
Ensure http can startup if homekit fails to load (#35888)
* Ensure HomeAssistant can startup if homekit fails to load

* Update homeassistant/components/logbook/manifest.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-05-21 08:48:01 +02:00
Paulus Schoutsen 19be31d13a
Migrate HomeKit to use describe_event for logbook support (#34485) 2020-04-20 17:48:09 -07:00
Franck Nijhof 24840b54ac
Add yamllint (in pre-commit and CI) (#33676)
* Add yamllint (in pre-commit and CI)

* Fix linting for all YAML files

* Bump and add it to requirements

* Fix gen_requirements for pre-commit, remove 'v' from version
2020-04-05 10:33:45 +02:00
Paulus Schoutsen f1d3c0d19b
Remove unused manifest fields (#33595) 2020-04-03 12:58:19 -07:00
Anders Melchiorsen 17215709e1
Simplify logbook duplicate handling (#32572) 2020-03-07 20:27:51 -08:00
Paulus Schoutsen 8aea538662
Allow teaching logbook about events (#32444)
* Allow teaching logbook about events

* Use async_add_executor_job

* Fix tests
2020-03-05 11:55:50 -08:00
Paulus Schoutsen fed23030d6
Filter out duplicate logbook states (#32427) 2020-03-03 13:56:32 -08:00
springstan 157f972d72
Use f-strings in integrations starting with "H" - "L" (#32265)
* Use f-strings in integrations starting with "H"

* Use f-strings in integrations starting with "I"

* Use f-strings in integrations starting with "J"

* Use f-strings in integrations starting with "K"

* Use f-strings in integrations starting with "L"

* Fix lint error

* Use join instead of f-string in homekit_controller

* Use local variables with f-strings

* Fix lint error

* Escape the characters in f-string

* Sort imports with isort in homeworks light

* Fix pylint error

* Fix broken tests

* Fix broken tests v2
2020-02-28 12:39:29 +01:00
Ville Skyttä 5216477353
Be consistent with Home Assistant and Hass.io spelling (#30500)
* Be consistent with Home Assistant spelling

* Be consistent with Hass.io spelling
2020-01-05 14:09:17 +02:00
springstan 6b3260357f Fix setup error for logbook (#29908)
* Fix setup error by moving an import back into the setup function

* Revert c741664d4d

* Add homekit as after_dependency to logbook manifest.json
2019-12-13 14:08:30 +01:00
Paulus Schoutsen a050d54847 Make hassfest stricter (#29494)
* Make hassfest stricter

* Update manifest.json
2019-12-05 10:15:28 +01:00
Diefferson Koderer Môro 6de95995aa Move imports in logbook component (#28016) 2019-10-21 09:57:31 +02:00
springstan 25bec13335 Filled services.yaml for logbook integration (#27560) 2019-10-12 20:01:12 -07:00
Franck Nijhof c7da781efc Update documentation link URL for integrations in all manifests (#27114) 2019-10-02 09:25:44 -07:00
Franck Nijhof 7203027cbf Use literal string interpolation in integrations K-M (f-strings) (#26389) 2019-09-03 21:14:00 +02:00