ehendrix23 d2e102ee2f Init statistics sensor upon HASS start (#18236)
* Update query to include maxAge

Updated the query from recorded to include MaxAge if set; reducing the amount of records retrieved that would otherwise be purged anyway for the sensor.

* Initialization upon HASS start

Register the state listener and read previous information from recorder once HASS is started.

* Updated test_statistics.py for HASS start

Updated test_statistics.py to start HASS and wait it is completed before running test.

* Added newline in docstring

Added newline in docstring.

* Added start of HASS to test_initialize_from_database_with_maxage

Added start of HASS to new test test_initialize_from_database_with_maxage.

* Updates based on review

Following updates based on review:
-) Removed self._hass and passing hass
-) Changed async_add_job to async_create_task
-) For state update, calling async_schedule_update_ha_state
2018-11-14 15:13:32 +01:00
..
2016-03-09 10:25:50 +01:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-11-08 19:19:30 +01:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00
2018-10-24 12:10:05 +02:00