* Schedule max dt for Riemann Integral sensor
* Simplify validation. Dont integrate on change if either old or new state is not numeric.
* Add validation to integration methods. Rollback requirement for both states to be always numeric.
* Use 0 max_dt for disabling time based updates.
* Use docstring instead of pass keyword in abstract methods.
* Use time_period config validation for max_dt
* Use new_state for scheduling max_dt. Only schedule if new state is numeric.
* Use default 0 (None) for max_dt.
* Rename max_dt to max_age.
* Rollback accidental renaming of different file
* Remove unnecessary and nonsensical max value.
* Improve new config description
* Use DurationSelector in config flow
* Rename new config to max_sub_interval
* Simplify by checking once for the integration strategy
* Use positive time period validation of sub interval in platform schema
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Remove return keyword
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Simplify scheduling of interval exceeded callback
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Improve documentation
* Be more clear about when time based integration is disabled.
* Update homeassistant/components/integration/config_flow.py
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Refactor Integration sensor.
* Use local simple function to verify the State is numeric.
* Merge two methods to one.
* Method renaming: _handle_state_change
* Move async_write_ha_state to the caller.
* Add comment on why attr_icon is set to None
* Remove possible None type of State in validation methods.
* Use a dict to map method name to method class.
* Explain derived unit after integration.
* Renaming to _multiply_unit_with_time and elaborate in docstring.
* Set integral unit_of_measurement explicitly to None if source unit_of_measurement is None
* One function for unit of measurement related steps.
* Improve docstring of _multiply_unit_with_time
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Apply f-string suggestions from code review
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Be more clear in comment about removing the sensors icon default.
* Apply suggestions from code review
Co-authored-by: Diogo Gomes <diogogomes@gmail.com>
* Update homeassistant/components/integration/sensor.py
* Update homeassistant/components/integration/sensor.py
* Update homeassistant/components/integration/sensor.py
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Diogo Gomes <diogogomes@gmail.com>
* Check if attributes are present in new_state before accessing them.
* Early return if new state is None|Unknown|Unavailable
* Removed whitespace at line endings. +black run
* Update test for coverage
* Add and use time related constants
* Sort time constants and reuse them in data rate constants
* Fix greeneyemonitor import
* Fix greeneyemonitor import V2
* Fix failing here_travel_time test
* Add TIME_MONTHS and TIME_YEARS
* Use TIME_MINUTES in opentherm_gw and isy994
* Add and use TIME_MILLISECONDS
* Change inconsistent ones
* Add TIME_MICROSECONDS and TIME_WEEKS
* Use constants in apcupsd and travisci
* Fix import error in upnp sensor.py
* Fix isy994 sensor.py using TIME_YEARS
* Fix dyson tests
* Use TIME_SECONDS in more places
* Use TIME_DAYS in google wifi
* Moved climate components with tests into platform dirs.
* Updated tests from climate component.
* Moved binary_sensor components with tests into platform dirs.
* Updated tests from binary_sensor component.
* Moved calendar components with tests into platform dirs.
* Updated tests from calendar component.
* Moved camera components with tests into platform dirs.
* Updated tests from camera component.
* Moved cover components with tests into platform dirs.
* Updated tests from cover component.
* Moved device_tracker components with tests into platform dirs.
* Updated tests from device_tracker component.
* Moved fan components with tests into platform dirs.
* Updated tests from fan component.
* Moved geo_location components with tests into platform dirs.
* Updated tests from geo_location component.
* Moved image_processing components with tests into platform dirs.
* Updated tests from image_processing component.
* Moved light components with tests into platform dirs.
* Updated tests from light component.
* Moved lock components with tests into platform dirs.
* Moved media_player components with tests into platform dirs.
* Updated tests from media_player component.
* Moved scene components with tests into platform dirs.
* Moved sensor components with tests into platform dirs.
* Updated tests from sensor component.
* Moved switch components with tests into platform dirs.
* Updated tests from sensor component.
* Moved vacuum components with tests into platform dirs.
* Updated tests from vacuum component.
* Moved weather components with tests into platform dirs.
* Fixed __init__.py files
* Fixes for stuff moved as part of this branch.
* Fix stuff needed to merge with balloob's branch.
* Formatting issues.
* Missing __init__.py files.
* Fix-ups
* Fixup
* Regenerated requirements.
* Linting errors fixed.
* Fixed more broken tests.
* Missing init files.
* Fix broken tests.
* More broken tests
* There seems to be a thread race condition.
I suspect the logger stuff is running in another thread, which means waiting until the aio loop is done is missing the log messages.
Used sleep instead because that allows the logger thread to run. I think the api_streams sensor might not be thread safe.
* Disabled tests, will remove sensor in #22147
* Updated coverage and codeowners.