1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00
Commit Graph

112 Commits

Author SHA1 Message Date
Pascal Vizeli
41849eab06 Core cleanup: two stage shutdown (#5876)
* Core cleanup: two stage shutdown

* fix spell

* fix

* add async logger to close

* change aiohttp to use CLOSE

* address paulus comments

* Fix tests

* Add unittest
2017-02-13 06:24:07 +01:00
Paulus Schoutsen
6ffab53377 Core: cleanup timer (#5825)
* Minor core cleanup

* Cleanup timer

* Lint

* timeout with correct loop

* Improve timer thanks to pvizeli

* Update core.py

* More tests
2017-02-10 09:00:17 -08:00
Paulus Schoutsen
c54517de90 Convert config.components to a set (#5824) 2017-02-09 20:21:57 +02:00
Pascal Vizeli
2cbed9cd96 Move signal handling out of core to bootstrap (#5815)
* Move signal handling out of core to bootstrap

* Fix tests
2017-02-08 21:58:45 -08:00
Pascal Vizeli
3f82ef64a1 Move core service from core to components (#5787)
* Move core servcie from core to components

* add new handler for signals/exception

* Static persistent id

* Move unittest

* fix coro/callback

* Add more unittest for new services

* Address comments

* Update __init__.py
2017-02-08 09:17:52 -08:00
andrey-git
f774538e66 Check config before restarting (#5609)
* Check config before restarting.

* Make check_config on restart async

* don't check if notification service exists

* Use .communicate()

* Reduce the number of notifications. Add tests.
2017-02-07 01:19:08 -08:00
Fabian Affolter
2ed0e76e7c Add elevation to as_dict and use unified style for quoting (#5448) 2017-01-19 23:55:29 -08:00
Pascal Vizeli
50a8ec7335 Bugfix aiohttp connector pool close on shutdown (#5190)
* Bugfix aiohttp connector pool close on shutdown

* fix circular import

* remove lint disable
2017-01-05 23:09:04 +01:00
Paulus Schoutsen
01e6bd2c92 Gracefully exit with async logger (#4965)
* Gracefully exit with async logger

* Lint
2016-12-18 00:14:59 -08:00
Pascal Vizeli
50c8224365 Bugfix async log handler (#4954)
* Bugfix async log handler

* fix boostrap test

* Use hass.data for store handler and cleanup on async_stop

* Update bootstrap.py
2016-12-17 12:21:52 -08:00
Pascal Vizeli
1d60760e21 Protect add_job (#4932) 2016-12-15 21:30:09 -08:00
Paulus Schoutsen
b35fa4f1c1 Finish all tasks before setup phase is done (#4606) 2016-11-30 13:02:45 -08:00
Pascal Vizeli
cf57db919e Refactory aiohttp clientsession handling in HA (#4602)
* Refactory aiohttp clientsession handling in HA

* remove from core / update platforms / rename file
2016-11-27 16:26:46 -08:00
Paulus Schoutsen
febe16d700 Set executor pool size to 10 (#4571) 2016-11-24 14:56:33 -08:00
Paulus Schoutsen
eacdce9ed9 Track tasks only during shutdown and tests (#4428)
* Track tasks only when needed

* Tweak async_block_till_done
2016-11-24 14:49:29 -08:00
Paulus Schoutsen
42c99b0ccb Pass hass object to ServiceRegistry constructor (#4570) 2016-11-24 14:02:39 -08:00
Pascal Vizeli
c04a002c55 Hotfix executor pool size (#4552) 2016-11-23 09:52:03 -08:00
Paulus Schoutsen
726bc5b670 Do not report on shutting down errors (#4431)
* Do not report on shutting down errors

* Lint
2016-11-17 12:02:43 -08:00
Paulus Schoutsen
38d201a54a Increase logging level of errors while doing jobs (#4429) 2016-11-16 23:01:14 -08:00
Pascal Vizeli
c8bc1e3c5d change add_job to use call_soon_threadsafe (#4410)
* change add_job to use call_soon_threadsafe

* address comments from paulus

* Tweak core tests

* Fix tests Python 3.4.2
2016-11-16 20:00:08 -08:00
Pascal Vizeli
71da21dcc8 Change pending task sheduler to time based cleanup (#4324)
* Change pending task sheduler to time based cleanup

* update unittest
2016-11-09 08:41:17 -08:00
Pascal Vizeli
114ece1848 Fix possible sigterm / unittest / Fix all lazy test (#4297)
* replace weakref with a list

* add unittest

* fix lint

* fix handling

* fix unittest

* change code style

* fix lazy tests
2016-11-08 10:24:50 +01:00
Pascal Vizeli
618a86a37c Set executor to 15 and help to reduce flooting async core with updates (#4252)
* Set executor to 15 and help to reduce flooting async core with udpates

* fix typing

* if it a executor, wait

* address comments from paulus

* add space for style :)

* fix spell

* Update entity_component.py

* Update entity_component.py
2016-11-06 22:28:03 -08:00
Paulus Schoutsen
a343c20404 Async gather wait (#4247)
* Fix config validation for input_*, script

* Allow scheduling coroutines

* Validate entity ids when entity ids set by platform

* Async: gather -> wait

* Script/Group: use async_add_job instead of create_task
2016-11-06 09:26:40 -08:00
Paulus Schoutsen
98f41d6b84 Tweak block_till_done (#4245) 2016-11-06 08:43:32 -08:00
Pascal Vizeli
ece58ce78f Remove ThreadPool with async executor (#4154)
* Remove ThreadPool with async executor

* Fix zigbee

* update unittest

* fix remote api

* add pending task to remote

* fix lint

* remove unused import

* remove old stuff for lazy tests

* fix bug and add a exception handler to executor

* change executor handling

* change to wait from gather

* fix unittest
2016-11-05 09:27:55 -07:00
Pascal Vizeli
26490109ac Change event loop on windows (#4075)
* Change event loop on windows

* fix

* split PR

* remove set event loop

* Add paulus suggestion

* fix missing import

* revert stuff from PR Splitting

* fix event loop on test
2016-11-02 21:53:52 +01:00
Paulus Schoutsen
7f699b4261 Lazy initialise the worker pool (#4110)
* Lazy initialise the worker pool

* Minimize pool initialization in core tests

* Fix tests on Python 3.4

* Remove passing in thread count to mock HASS

* Tests: Allow pool by default for threaded, disable for async

* Remove JobPriority for thread pool

* Fix wrong block_till_done

* EmulatedHue: Remove unused test code

* Zigbee: do not touch hass.pool

* Init loop in add_job

* Fix core test

* Fix random sensor test
2016-10-31 08:47:29 -07:00
Fabian Affolter
be272ac64a Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Paulus Schoutsen
4163e55dbd Introducing hass.data (#4121)
* Hello hass.data

* Migrate setup_component to hass.data
2016-10-29 14:51:17 -07:00
Paulus Schoutsen
5a2b4a5376 Core Async improvements (#4087)
* Clean up HomeAssistant.start

* Add missing pieces to remote HA constructor

* Make HomeAssistant constructor async safe

* Code cleanup

* Init websession lazy
2016-10-29 08:57:59 -07:00
Pascal Vizeli
3324995e70 Async clientsession / fix stuff on aiohttp and camera platform (#4084)
* add websession

* convert to websession

* convert camera to async

* fix lint

* fix spell

* add import

* create task to loop

* fix test

* update aiohttp

* fix tests part 2

* Update aiohttp.py
2016-10-27 21:40:10 -07:00
Paulus Schoutsen
4c8d1d9d2f Clean up some async stuff (#3915)
* Clean up some async stuff

* Adjust comments

* Pass hass instance to eventbus
2016-10-17 19:38:41 -07:00
Paulus Schoutsen
fe317b806f Close event loop to avoid error on exiting HASS (#3762) 2016-10-08 18:56:36 +02:00
Pascal Vizeli
f1e5d32ef5 Async exception handling (#3731)
* remove unused exception

* add logging

* disable pylint broad-except

* add exception handler

* fix lint

* update log output

* change log message in async with exc_info

* Add exc_info to asyncio exception handler
2016-10-07 17:20:39 -07:00
Paulus Schoutsen
4f0064b00e Fix broken tests (#3704)
* Fix broken tests

* Lint
2016-10-04 22:19:12 -07:00
Pascal Vizeli
0bf8bb62ad Service & signal (stop/restart) fix (#3690)
* Bugfix signhandling/services

* change from coroutine to callback

* add error handling

* fix bug with endless running

* fix unit test

* Revert "fix unit test"

This reverts commit 31135c7709.

* Disable sigterm/sighup test
2016-10-04 21:00:36 -07:00
Paulus Schoutsen
5085cdb0f7 Add async_safe annotation (#3688)
* Add async_safe annotation

* More async_run_job

* coroutine -> async_save

* Lint

* Rename async_safe -> callback

* Add tests to core for different job types

* Add one more test with different type of callbacks

* Fix typing signature for callback methods

* Fix callback service executed method

* Fix method signatures for callback
2016-10-04 20:44:32 -07:00
Justin Weberg
0219df17f5 Expose Configuration path to frontend (#3660)
* Expose config path to frontend

* Fix typo

* Add deleted code.
2016-10-03 00:04:43 -07:00
Paulus Schoutsen
abb8bcb6d9 Protect waiting for event loop from within event loop (#3658)
* Protect waiting for event loop from within event loop

* Faster fetching of loop attribute for ident check
2016-10-02 15:07:23 -07:00
Paulus Schoutsen
c36d30f4fe Typo 2016-10-01 15:43:33 -07:00
Paulus Schoutsen
b650b2b0db Spread async love (#3575)
* Convert Entity.update_ha_state to be async

* Make Service.call async

* Update entity.py

* Add Entity.async_update

* Make automation zone trigger async

* Fix linting

* Reduce flakiness in hass.block_till_done

* Make automation.numeric_state async

* Make mqtt.subscribe async

* Make automation.mqtt async

* Make automation.time async

* Make automation.sun async

* Add async_track_point_in_utc_time

* Make helpers.track_sunrise/set async

* Add async_track_state_change

* Make automation.state async

* Clean up helpers/entity.py tests

* Lint

* Lint

* Core.is_state and Core.is_state_attr are async friendly

* Lint

* Lint
2016-09-30 12:57:24 -07:00
Lewis Juggins
54248863b3 Use uvloop for asyncio policy (#3417) 2016-09-20 00:06:33 -07:00
Paulus Schoutsen
be68fe0d85 Move worker pool monitoring to be time based instead of add_job based. (#3439)
* Move worker pool monitoring to be time based instead of add_job based.

* Stub out worker pool monitor during tests

* Add test for monitor worker pool.

* Improve naming

* Test stop_monitor coroutine

* Add async_create_timer test

* Finish rename create_timer
2016-09-19 23:39:49 -07:00
Ben Bangert
256062fd99 Fix test shutdown to ensure loop/threads are clean. (#3447)
* Fix test shutdown to ensure loop/threads are clean.

We now ensure the loop is closed, it has completed, and the
executer has completed. This ensure all threads are freed
up with any test calling hass.stop().

* Fix lint issue with run_loop
2016-09-18 20:35:58 -07:00
Paulus Schoutsen
aca375c312 Asyncio event helpers (#3415)
* Automation - Event: Use coroutine

* Convert event helpers to coroutine

* Fix linting

* Add hass.async_add_job

* Automation - Event to use async_add_job
2016-09-17 18:28:01 -07:00
Paulus Schoutsen
609d7ebea5 Migrate core from threads to async awesomeness (#3248)
* Add event loop to the core

* Add block_till_done to HA core object

* Fix some tests

* Linting core

* Fix statemachine tests

* Core test fixes

* fix block_till_done to wait for loop and queue to empty

* fix test_core for passing, and correct start/stop/block_till_done

* Fix remote tests

* Fix tests: block_till_done

* Fix linting

* Fix more tests

* Fix final linting

* Fix remote test

* remove unnecessary import

* reduce sleep to avoid slowing down the tests excessively

* fix remaining tests to wait for non-threadsafe operations

* Add async_ doc strings for event loop / coroutine info

* Fix command line test to block for the right timeout

* Fix py3.4.2 loop var access

* Fix SERVICE_CALL_LIMIT being in effect for other tests

* Fix lint errors

* Fix lint error with proper placement

* Fix slave start to not start a timer

* Add asyncio compatible listeners.

* Increase min Python version to 3.4.2

* Move async backports to util

* Add backported async tests

* Fix linting

* Simplify Python version check

* Fix lint

* Remove unneeded try/except and queue listener appproriately.

* Fix tuple vs. list unorderable error on version compare.

* Fix version tests
2016-09-12 19:16:14 -07:00
Pascal Vizeli
e632a47772 protect service data for changes in calls (#3249)
* protect service data for changes in calls

* change handling

* move MappingProxyType to service call
2016-09-07 08:19:19 -07:00
Paulus Schoutsen
5995f2438e fix remove listener (#3196) 2016-09-07 06:59:59 -07:00
Paulus Schoutsen
d9ecc4af64 EventBus: return function to unlisten 2016-08-25 23:25:35 -07:00