Commit Graph

47 Commits (b2ceb2043b00545414d09b12f264f6baa61402fe)

Author SHA1 Message Date
Marc Mueller ac858cc2b5
Improve singleton helper typing ()
* Improve singleton helper typing

* Fix type errors
2022-07-21 00:19:02 +02:00
Marc Mueller d09fff595c
Rename existing TypeVars referencing Self type () 2022-07-20 03:03:22 +02:00
epenet 16900dcef1
Make Store a generic class () 2022-07-09 22:32:57 +02:00
Marc Mueller bfb1abd3a2
Add type ignore error codes [helpers] () 2022-02-18 11:31:37 +01:00
Erik Montnemery 009b31941a
Support restoring SensorEntity native_value () 2022-02-08 14:00:26 -08:00
Marc Mueller 021debb5c5
Resolve implicit imports () 2022-01-10 17:10:46 +01:00
Marc Mueller 3a32fe9a34
Add strict typing to `core.py` (2) - State () 2022-01-04 18:33:56 +01:00
Ruslan Sayfutdinov 55f4962c06
Fix pylint plugin which checks relative imports () 2021-12-23 11:14:47 -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
Marc Mueller 6fb2e63e49
Update typing 02 () 2021-03-17 18:34:19 +01:00
Franck Nijhof 5d5a110a20
None optional hass typing in base entity and notify () 2021-03-15 15:11:41 +01:00
Franck Nijhof 9b7c39d20b
Postponed evaluation of annotations in core ()
* Postponed evaluation of annotations in core

* Remove unneeded future
2021-02-12 10:58:20 +01:00
Joakim Plate 15db2225da
async_get_instance was not reentrant during await () 2020-08-12 22:35:24 +02:00
Paulus Schoutsen 5a9970e63c
Dump states in event handler for HA_Stop ()
* Dump states in event handler for HA_Stop

* Fix type
2020-04-13 17:41:01 -07:00
Franck Nijhof 7d3c974747
Use set & dict literals ()
Co-authored-by: Daniel Høyer Iversen <mail@dahoiv.net>
2020-04-04 20:05:15 +02:00
David F. Mulcahey 8b0a0ee521
Don't write storage to disk while stopping ()
* Don't write storage to disk while stopping

* rework change

* lint

* remove delay save and schedule final write at stop

* update tests

* fix test component using private methods

* cleanup

* always listen

* use stop in restore state again

* whitelist JSON exceptions for later

* review comment

* make zwave tests use mock storage
2020-04-02 10:25:28 -07:00
David F. Mulcahey bcd1eb952c
RFC - Add a 3rd state to the HA shutdown sequence for writing… ()
* add third stage to hass shutdown

* use 3rd stage in storage

* update core state

* add writing data to multi stop ignore

* update core test

* review comment

* update name based on feedback
2020-03-30 10:18:39 -07:00
Ville Skyttä 733f1e1101
Helpers typing improvements () 2020-02-15 13:03:53 -08:00
Paulus Schoutsen e019280d94
Annotate more async functions correctly () 2020-02-14 10:00:22 -08:00
Paulus Schoutsen e9e44dbd97
Fix callback and async ()
* Fix callback and async

* Fix a return

* Fix test

* Fix mqtt tests

* Fix some more callbacks
2020-01-29 13:59:45 -08:00
Ville Skyttä 5216477353
Be consistent with Home Assistant and Hass.io spelling ()
* Be consistent with Home Assistant spelling

* Be consistent with Hass.io spelling
2020-01-05 14:09:17 +02: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 67c56c860d Sort imports according to PEP8 for 'homeassistant' folder ()
Components are already done
2019-12-09 16:42:10 +01:00
Ville Skyttä 70ddab2f3c
Helpers type hint additions and improvements ()
* Helpers type hint additions and improvements

* Fix async setup dump callback signature
2019-10-21 17:54:59 +03:00
Franck Nijhof 2f0eb07624 Migrate legacy typehints in core to PEP-526 ()
* Migrate legacy typehints in core to PEP-526

* Fix one type
2019-09-03 20:36:04 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Ville Skyttä d64f1e767c Type check all helpers ()
* Type check all helpers, add inline exclusions for work in progress

* Remove unused Script._template_cache

* Add some missing type hints

* Remove unneeded type: ignore

* Type hint fixes

* Mypy assistance tweaks

* Don't look for None in deprecated config "at most once" check

* Avoid None name slugify attempt when generating entity id

* Avoid None state store attempt on entity remove
2019-07-21 09:59:02 -07:00
Paulus Schoutsen cde3f670c2 pylint 2019-07-10 20:47:27 -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
Otto Winter f5093b474a
Python 3.5 async with () 2018-03-17 12:27:21 +01:00
Julius Mittenzwei 16cb7388ee Removing asyncio.coroutine syntax from HASS core ()
* changed asyncio.coroutine syntax to new async def/await

* removed py34 from tox environment

* reverted some changes within entity.py

* -

* reverted changes within bootstrap.py

* reverted changes within discovery.py

* switched decorators

* Reverted change within aiohttp_client.py

* reverted change within logging.py

* switched decorators

* Await lock properly

* removed asyncio.coroutine from test
2018-02-25 03:38:46 -08:00
Paulus Schoutsen ca54bbfcc9 RFC: Use bind_hass for helpers ()
* Add Helpers bind_hass functionality

* Update other helpers
2017-10-08 08:17:54 -07:00
Paulus Schoutsen f43db3c615 Replace executor with async_add_job ()
* Remove executor

* Lint

* Lint

* Fix tests
2017-05-26 08:28:07 -07:00
Fabian Affolter a4f1f6e724 Update docstrings ()
* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstring

* Update docstrings

* Update docstrings

* Fix lint issues

* Update docstrings

* Revert changes in dict
2017-05-02 09:18:47 -07:00
Paulus Schoutsen 7655b6271d Better restore_state warnings () 2017-03-05 10:54:49 +01:00
Paulus Schoutsen e8a22cb4a8 Tweak recorder/restore_state ()
* Tweak recorder/restore_state

* Lint
2017-03-05 10:52:08 +01: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 c940d26f07 Bugfix restore startup state () 2017-02-23 20:06:21 -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