Commit graph

34 commits

Author SHA1 Message Date
J. Nick Koston
c399cab427
Small speed up to checking core state () 2024-01-18 08:41:32 -10:00
J. Nick Koston
d04e2d56da
Add support for JSON fragments () 2024-01-07 17:36:31 -10:00
Erik Montnemery
84e74e4c74
Reverse component path ()
* Reverse component path

* Update translations helper

* Fix

* Revert incorrect change of PLATFORM_FORMAT

* Fix use of PLATFORM_FORMAT in tts

* Fix ios
2023-12-05 08:43:58 +01:00
Erik Montnemery
4536fb3541
Remove mock_entity_platform test helper () 2023-11-16 16:55:08 +01:00
J. Nick Koston
b2e708834f
Add slots to the StateMachine class () 2023-07-05 14:00:37 +02:00
Erik Montnemery
59f5b8f2d6
Remove unneeded checks for Entity.platform ()
* Remove unneeded checks for Entity.platform

* Update tests

* Prevent breaking integrations without an EntityComponent

* Warn when entity has no platform
2023-06-09 15:17:41 +02:00
J. Nick Koston
457bc4571d
Make RestoreStateData.async_get_instance backwards compatible () 2023-06-01 19:31:17 +02:00
J. Nick Koston
fba826ae9e
Migrate restore_state helper to use registry loading pattern ()
* Migrate restore_state helper to use registry loading pattern

As more entities have started using restore_state over time, it
has become a startup bottleneck as each entity being added is
creating a task to load restore state data that is already loaded
since it is a singleton

We now use the same pattern as the registry helpers

* fix refactoring error -- guess I am tired

* fixes

* fix tests

* fix more

* fix more

* fix zha tests

* fix zha tests

* comments

* fix error

* add missing coverage

* s/DATA_RESTORE_STATE_TASK/DATA_RESTORE_STATE/g
2023-05-30 20:48:17 -05:00
epenet
5f25b71df7
Add type hints to core tests () 2023-02-20 11:42:56 +01:00
epenet
c98b4e3204
Add typing to tests with single hass argument (2) ()
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
Erik Montnemery
009b31941a
Support restoring SensorEntity native_value () 2022-02-08 14:00:26 -08:00
Paulus Schoutsen
8a611eb640
Fix singleton not working with falsey values () 2021-09-11 12:02:01 -07:00
Richard T. Schaefer
3184f0697f
Add Save Persistent States service () 2021-08-10 00:38:56 +02:00
J. Nick Koston
f96a6e878f
Ensure restore state is not written after the stop event ()
If everything lined up, the states could be written
while Home Assistant is shutting down after the stop
event because the interval tracker was not canceled on
the stop event.
2021-04-17 09:03:18 +02:00
Franck Nijhof
65cf2fcb6f
Drop asynctest () 2021-01-01 22:31:56 +01:00
Joakim Plate
15db2225da
async_get_instance was not reentrant during await () 2020-08-12 22:35:24 +02:00
Paulus Schoutsen
ec47216388
Use built-in test helpers on 3.8 () 2020-04-30 13:29:50 -07:00
Paulus Schoutsen
24b25b8917
Restore state helper to work with entity registry restoration ()
* Restore state helper to work with entity registry restoratino

* Update restore_state.py
2020-01-05 11:58:59 +01:00
Bas Nijholt
f60125b5c9 Sort imports according to PEP8 for 'tests' () 2019-12-09 16:52:24 +01:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus Schoutsen
073327831f
Correctly store removed entities for restore state ()
* Correctly store removed entities for restore state

* Lint

* Do not assume about set encoding
2019-07-10 20:41:03 -07:00
Paulus Schoutsen
06af6f19a3
Entity to handle updates via events ()
* Entity to handle updates via events

* Fix a bug

* Update entity.py
2019-06-26 09:22:51 -07:00
Paulus Schoutsen
af3afb673a
Fix restore state crashing invalid entity ID () 2019-01-23 21:12:38 -08:00
Adam Mills
a10cbadb57 Restore states when removing/adding entities () 2018-12-02 10:51:15 +01:00
Adam Mills
22f27b8621 Store state last seen time separately ()
* Store state last seen time separately

This ensures that infrequently updated entities aren't accidentally
dropped from the restore states store

* Fix mock restore cache
2018-11-30 08:26:19 +01:00
Adam Mills
5c3a4e3d10 Restore states through a JSON store instead of recorder ()
* Restore states through a JSON store

* Accept entity_id directly in restore state helper

* Keep states stored between runs for a limited time

* Remove warning
2018-11-28 13:16:43 +01:00
Adam Mills
c4810da82f Unit tests to improve core coverage ()
* Code coverage of logging util

* Improve async util coverage

* Add test coverage for restore_state

* get_random_string test
2017-10-02 20:25:04 -07:00
Paulus Schoutsen
e8a22cb4a8 Tweak recorder/restore_state ()
* Tweak recorder/restore_state

* Lint
2017-03-05 10:52:08 +01:00
Paulus Schoutsen
2650c73a89 Split bootstrap into bs + setup ()
* Split bootstrap into bs + setup

* Lint
2017-03-05 10:41:54 +01:00
Pascal Vizeli
41f558b181 Bootstrap / Component setup async ()
* Bootstrap / Entiy setup async

* Cleanup add_job stuff / return task/future object

* Address paulus comments / part 1

* fix install pip

* Cleanup bootstrap / move config stuff to config.py

* Make demo async

* Further bootstrap improvement

* Address Martin's comments

* Fix initial tests

* Fix final tests

* Fix bug with prepare loader

* Remove no longer needed things

* Log error when invalid config

* More cleanup

* Cleanups platform events & fix lint

* Use a non blocking add_entities callback for platform

* Fix Autoamtion is setup befor entity is ready

* Better automation fix

* Address paulus comments

* Typo

* fix lint

* rename functions

* fix tests

* fix test

* change exceptions

* fix spell
2017-02-28 20:33:19 -08:00
Paulus Schoutsen
61909e873f Feature/reorg recorder ()
* Re-organize recorder

* Fix history

* Fix history stats

* Fix restore state

* Lint

* Fix session reconfigure

* Move imports around

* Do not start recording till HASS started

* Lint

* Fix logbook

* Fix race condition recorder init

* Better reporting on errors
2017-02-26 14:38:06 -08:00
Johann Kellerman
5d007e636b No wait for start and more async 2017-02-25 17:51:37 +02:00
Johann Kellerman
aee8758fc1 Restore input_select and test helper proposal ()
* Restore input_select and test helper proposal

* DB still active
2017-02-22 00:15:48 -08:00
Johann Kellerman
fdc373f27e Restore_state helper to restore entity states from the DB on startup ()
* Restore states

* feedback

* Remove component move into recorder

* space

* helper

* Address my own comments

* Improve test coverage

* Add test for light restore state
2017-02-20 23:40:27 -08:00