* 17Track tests
* add 17Track sensor to coverage
* extract repeated code
* 1. _goto_future - call tick only once
2. change test name to reflect test
3. remove ifs from test
* remove undersocre from _goto_future
We have a few places where we call async_listen with a callback so we can schedule
the coro eagerly. We can drop these in favor of setting run_immediately now.
* Allow Just-in-Time platform setup for mqtt
* Only forward the setup of new platforms
* Fix new platforms being setup at reload + test
* Revert not related changes
* Remove unused partial
* Address comments, only import plaforms if needed
* Apply suggestions from code review
* Add multipl platform discovery test
* Improve test
* Use a lock per platform
* Phase out periodic tasks
* false by default or some tests will block forever, will need to fix each one manually
* kwarg works
* kwarg works
* kwarg works
* fixes
* fix more tests
* fix more tests
* fix lifx
* opensky
* pvpc_hourly_pricing
* adjust more
* adjust more
* smarttub
* adjust more
* adjust more
* adjust more
* adjust more
* adjust
* no eager executor
* zha
* qnap_qsw
* fix more
* fix fix
* docs
* its a wrapper now
* add more coverage
* coverage
* cover all combos
* more fixes
* more fixes
* more fixes
* remaining issues are legit bugs in tests
* make tplink test more predictable
* more fixes
* feedreader
* grind out some more
* make test race safe
* one more
* Never update the device path from config flows
* Bring coverage up to 100%
* Update tests/components/zha/test_config_flow.py
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
---------
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
* Bump python-telegram-bot package version to the latest.
* PySocks is no longer required as python-telegram-bot doesn't use urllib3 anymore.
* Fix moved ParseMode import
* Update filters import to new structure.
* Refactor removed Request objects to HTTPXRequest objects.
* Update to support asyncc functions
* Update timeout to new kwarg
connect_timeout is the most obvious option based on current param description, but this may need changing.
* Compatibility typo.
* Make methods async and use Bot client async natively
* Type needs to be Optional
That's what the source types are from the library
Also handle new possibility of None value
* Add socks support version of the library
* Refactor load_data function
Update to be async friendly
Refactor to use httpx instead of requests.
* Refactor Dispatcher references to Application
This is the newer model of the same class.
* Make more stuff async-friendly.
* Update tests to refactor Dispatcher usage out.
* Remove import and reference directly
* Refactor typing method
* Use async_fire now we have async support
* Fix some over complicate inheritance.
* Add the polling test telegram_text event fired back in.
* Add extra context to comment
* Handler should also be async
* Use underscores instead of camelCase
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Renamed kwarg.
* Refactor current timeout param to be read timeout
Reading the old version of the library code I believe this matches the existing functionality best
* Combine unload methods into one listener
* Fix test by stopping HA as part of fixture
* Add new fixture to mock stop_polling call
Use this in all polling tests.
* No longer need to check if application is running
It was to stop a test failing.
* Make sure the updater is started in tests
Mock external call methods
Remove stop_polling mock.
* Use cleaner references to patched methods
* Improve test by letting the library create the Update object
* Mock component tear down methods to be async
* Bump mypy cache version
* Update dependency to install from git
Allows use as a custom component in 2024.3
Allows us to track mypy issue resolution.
* Update manifest and requirements for new python-telegram-bot release.
* Remove pytest filterwarnings entry for old version of python-telegram-bot library.
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Schedule periodic coordinator updates as background tasks.
Currently, the coordinator's periodic refreshes delay startup because they are not scheduled as background tasks. We will wait if the startup takes long enough for the first planned refresh. Another coordinator's scheduled refresh will be fired on busy systems, further delaying the startup. This chain of events results in the startup taking a long time and hitting the safety timeout because too many coordinators are refreshing.
This case can also happen with scheduled entity refreshes, but it's less common. A future PR will address that case.
* periodic_tasks
* periodic_tasks
* periodic_tasks
* merge
* merge
* merge
* merge
* merge
* fix test that call the sync api from async
* one more place
* cannot chain
* async_run_periodic_hass_job
* sun and pattern time changes from automations also block startup
* Revert "sun and pattern time changes from automations also block startup"
This reverts commit 6de2defa05.
* make sure polling is cancelled when config entry is unloaded
* Revert "Revert "sun and pattern time changes from automations also block startup""
This reverts commit e8f12aad55.
* remove DisabledError from homewizard test as it relies on a race
* fix race
* direct coverage
Move analytics setup to stage 1 to avoid delaying frontend startup
analytics was only needed in the frontend startup phase for onboarding.
Its very unlikely the user will be able to complete the onboarding
steps and get to the analytics screen before analytics is done loading
so we can delay loading it until stage 1. To be absolutely sure that
it is ready, the core_config step in onboarding will wait to proceed
if it is some how still being setup
* Avoid errors when no internet connection
* Add error
* Create task in HA
* change from matter to automower
* tests
* Update homeassistant/components/husqvarna_automower/coordinator.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* address review
* Make websocket optional
* fix aioautomower version
* Fix tests
* Use stored websocket
* reset reconnect time after sucessful connection
* Typo
* Remove comment
* Add test
* Address review
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Dont remove api key during migration
* Fix return
* Fix test
* Make lambda more readable
* Move fixtures to init, move migration test to test_init.py
* Refactor config_entry data assignment
* Refactor system_bridge migration tests
* Fix type for debug message
* Fix type for debug message
* Remove duplicated unused code (rebase error)
* Refactor test_migration_minor_2_to_1 to test_migration_minor_future_to_2
* Fix version check in async_migrate_entry
* Update migration logic to handle future minor version
* Add ConfigEntryState assertion in test_init.py
* Change condition to minor_version < 2
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Refactor system bridge migration tests
* Remove minor downgrade code
* Update tests/components/system_bridge/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update tests/components/system_bridge/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Move dataclass to store requested data to data.py
* Use dataclass in config flow
* Move media player and sensor onto data.py dataclass
* Move data and handler inside validate
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
These were very likely to be cached so they were low on the
list to migrate, but since they are called in the event loop
its best to be sure we do no blocking I/O
discovered in https://github.com/home-assistant/core/pull/112295#discussion_r1513505710
We only checked if the last language had files to load
instead of all of them. The checks for each language
are the same because the only reason we would skip
a language is a missing/broken integration or the integration
is a single file. Both of these loop conditions are always
the same reguardless of the language so the check worked
* Add system_health to the hassio pre-imports to avoid a late executor job
`2024-03-05 17:01:33.034 DEBUG (MainThread) [homeassistant.loader] Importing platforms for hassio executor=[system_health] loop=[] took 0.12s`
This one does not take that much time but it happens at a time where
the import executor is the most busy during startup
* key
* move patch as its too early now
* Fix config modules being imported in the event loop
There was a late import in this integration because of the circular import.
The code has been rearranged to avoid the circular imports
* fixes
* fixes
* fix patching
* make eager
* remove unrelated change from this branch
We previously checked Integration.config_flow to see if we should
pre-import the config flow, but this is now always set for some
integration like `homeassistant_green`, `hassio`, etc. Instead
we can add it to the rest of the platforms since we already know
which files exist. This simplifies the logic and ensures the pre-import
still happens if the file is there even if its not listed in the
manifest
`2024-03-04 22:54:31.906 DEBUG (MainThread) [homeassistant.loader] Importing platforms for homeassistant_green executor=[config_flow] loop=[] took 2.74s`
* Migrate remaining calls in config modules to async_get_component
There were a few cases that were still using get_component that
could have done blocking I/O in the event loop, although it
was unlikely.
The caching check in async_get_component has been moved
up to avoid creating the future if the module is already in
the cache
* fix one more
* Handle case where deCONZ light entity might not report a supported color mode
* If in an unknown color mode set ColorMode.UNKNOWN
* Fix comment from external discussion
* add deprecaction
* Deprecate old config options for mqtt json light
* Do not deprecate brightness flag
* Enable brightness support by default
* Keep `false` as default for brightness flag
* Add warnings and register issue
* log warning and register on use of color_mode flag
* Remove redundant cv.deprecated logging + follow up comments
Some of the data we had to search for was already available
in a dict or underlying data structure. Make it available
instead of having to build it every time.
There are more places these can be used, but I only did
the device registry cleanup for now
* Adding Energy
* Adding Energy
* Work in progress
* Add fixtures
* Add product info
* Add sensors
* Add icons
* Update metadata
* Use SensorEntityDescription for Energy
* Use ENERGY_STORAGE
* Add tests
* Fix coverage
* Update wall connector precision and units
* Change devices
* Fix serial number
* Add icons and VIN to wall connector
* Fix serial number again
* Update snapshots
* Use timestamp for minutes to arrival
* Cleanup snapshot
* Improvements
* Update fixture
* Add "code" to translations
* Add "code" to snapshot
* Use async_add_entities once
* Disable a bunch of sensors
* Ruff
* Improve fixture and test coverage
* Regen Snapshots
* Add init to coordinator
* Add 'issues' template function for listing active issues.
* Add issue template function test
* Add 'issue' template function for getting specific issue by domain and issue_id
* Remove comment
* Fix function description
* Remove reduntant function,
Fix tests
* remove pass_context
* remove issues filter
Co-authored-by: Erik Montnemery <erik@montnemery.com>
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Import in the executor by default for core integration
* merge correct branch in
* Group loading of platforms in the import executor
* adjust test
* remove other pr
* Fix async_prepare_setup_platform test
The message changed because the order changed but was not caught before
merge because it required the combination of PRs to change
the error message
* fix
* tweak
* fix
* self review
* review
* fix hue mocking
* Update homeassistant/loader.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* lint
* Fix async_get_component loading in the executor when the module is already loaded
The sys.modules check was incorrect (only on dev)
* fix
* Avoid multiple executor jobs with concurrent calls to async_get_component
Return a future that can be awaited if the component is
curently being loaded
* adjust
* coverage
* coverage
* concurrent platforms load test
* doc strings
* coverage
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Add support for local (lan) panel integration
* Fix merge conflicts
* Remove executable flag from non-executable files
* Fix tests
* Update homeassistant/components/elmax/__init__.py
Shorten comment
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Fix typehint
* Rename DummyPanel into DirectPanel
* Update homeassistant/components/elmax/__init__.py
Rewording
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/elmax/__init__.py
Rewording
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Refactor option step into menu step
* Change requirement statement
* Refactor dictionary key entries to use existing constants
* Align step names to new constants
* Align step names to new constants amd align tests
* Align step names to new constants amd align tests
* Align step names to new constants
* Simplify logic to handle entire entry instead of a portion of the state
* Simplify working mode checks
* Add data_description dictionary to better explain SSL and FOLLOW_MDSN options
* Add support for local (lan) panel integration
* Fix merge conflicts
* Remove executable flag from non-executable files
* Fix tests
* Update homeassistant/components/elmax/__init__.py
Shorten comment
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Fix typehint
* Rename DummyPanel into DirectPanel
* Update homeassistant/components/elmax/__init__.py
Rewording
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/elmax/__init__.py
Rewording
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Refactor option step into menu step
* Change requirement statement
* Refactor dictionary key entries to use existing constants
* Align step names to new constants
* Align step names to new constants amd align tests
* Align step names to new constants amd align tests
* Align step names to new constants
* Simplify logic to handle entire entry instead of a portion of the state
* Simplify working mode checks
* Add data_description dictionary to better explain SSL and FOLLOW_MDSN options
* Add newline at end of file
* Remove CONF_ELMAX_MODE_DIRECT_FOLLOW_MDNS option
* Fix Ruff pre-check
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update System Bridge to support version 4.x.x and above
Update systembridgeconnector to version 4.0.0.dev4
Update system_bridgeconnector version to 4.0.0.dev6
Refactor WebSocket client handling in config_flow.py
Update strings
Update data handling
Add default field values to SystemBridgeCoordinatorData
Add version check and issue creation for unsupported System Bridge versions
Update coordinator.py to set disks and memory to None
Update system bridge coordinator to use token instead of API key
Update systembridgeconnector version to 4.0.0.dev7
Update systembridgeconnector version to 4.0.0.dev8
Update systembridgeconnector version to 4.0.0.dev9
Changes
Update units
Fix GPU memory calculation in sensor.py
Update GPU memory unit of measurement
Add translation keys for binary sensor names
Cleanup
Add async_migrate_entry function for entry migration
Update systembridgeconnector version to 4.0.0.dev10
Update systembridgeconnector version to 4.0.0.dev11
Add version check and authentication handling
Update token description in strings.json
Fix skipping partitions without data in system_bridge sensor
Update systembridgeconnector version to 4.0.0.dev12
Update systembridgeconnector version to 4.0.0
Add check for unsupported version of System Bridge
Update systembridgeconnector version to 4.0.1
Update debug log message in async_setup_entry function
Remove debug log statement
Fixes
Update key to token
Update tests
Update tests
Remove unused import in test_config_flow.py
Remove added missing translations for another PR
Refactor CPU power per CPU calculation
Make one liner into lambda
Refactors
Fix exception type in async_setup_entry function
Move checks to class and set minor version
Remove unnecessary comment in gpu_memory_free function
Remove translation_key for memory_used_percentage sensor
Reverse string change
Update token placeholder in strings.json
Remove suggested_display_precision from sensor descriptions
Remove suggested_display_precision from GPU sensor setup
Refactor sensor code
* Update migrate entry
* Refactor GPU-related functions to use a decorator
* Move per cpu functions to use decorator
* Refactor functions to use decorators for data availability
* Remove CONF_API_KEY from config entry data
* Add test for migration
* Refactor import statement in test_config_flow.py
Since config_entries always requires the config_flow to be loaded
to check for migrations, load it if we know it exists when loading
the underlying integration
* Split up hassio coordinator and data into new file to allow preload
Since we cannot mark hassio as having a config_flow, it will
not get preloaded and since cloud will almost always load right
after it and block the import executor, we want to preload
the hassio config_flow and platform modules so the other
dependants can continue on while cloud is being imported
to not delay startup
* tweak
* tweak
* Add tests for number of devices created
* Change default fixture to 2 devices in one system
* Update snapshot
* Change deviuce to test
* Merge tests to one module
* Avoid trying to import platforms that do not exist
* adjust
* fixes
* cleanup
* cleanup
* cleanup
* Apply suggestions from code review
* docs
* fixes
* fixes
* comment
* coverage
* coverage
* coverage
* Switch config to use async_get_component
This was another path where integrations that were marked to load in the executor
would be loaded in the loop
* Switch config to use async_get_component/async_get_platform
This was another path where integrations that were marked to load in the executor
would be loaded in the loop
* merge
* refactor
* refactor
* coverage
* preen
* preen
* Avoid expensive inspect calls in config validators
inspect has a performance problem https://github.com/python/cpython/issues/92041
We now avoid calling inspect unless we are going to log
* remove unused
* reduce
* get_integration_logger
* Rename device.py to hub.py
* Rename AxisNetworkDevice to AxisHub
* Move hub.py into hub package
* Rename get_axis_device to get_axis_api
* Split out get_axis_api to its own module
* Rename device object to hub
* Rename device to api in config flow
* Convenience method to get hub
* Fix utility meter reset without tarrifs
When using a utility_meter helper set up with a "Meter reset cycle" of
"No cycle" it is impossible to properly reset the meter to 0 and utilize
the "last reset" and "last period" attributes on the helper.
With these changes the service call can now directly reset a meter in
such a configuration and the UI selector has been updated to include
utility meters in the selection list.
Fixes#96920
* Undo UI target selection modes
As requested to not cause confusion by being able to reset individual
meters when using multiple tariffs.
* Adjust logic to only reset standalone sensors
The original logic would allow resetting meters with multiple tariffs
which was an unintended side effect.
* Vallox: reset filter button
* Better names
* Change from button to date platform
* Review
* Fix
* Drop ValloxDateEntityDescription
* Stale docstrings
* Stale docstring
* Move HassSetPosition to homeassistant domain
* Add test for unsupported domain with HassSetPosition
* Split service intent handler
* cleanup
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Use correct service name with satellite + local wake word detection
* Don't load platforms for satellite services
* Update homeassistant/components/wyoming/data.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Fix ruff error
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Add counter entities to the ZHA coordinator device
* rework to prepare for non coordinator device counters
* Initial scaffolding to support quirks v2 entities
* update for zigpy changes
* add assertion error message
* clean up test
* update group entity discovery kwargs
* constants and clearer names
* apply custom device configuration
* quirks switches
* quirks select entities
* quirks sensor entities
* update discovery
* move call to super
* add complex quirks v2 discovery test
* remove duplicate replaces
* add quirks v2 button entity support
* add quirks v2 binary sensor entity support
* fix exception in counter entitiy discovery
* oops
* update formatting
* support custom on and off values
* logging
* don't filter out entities quirks says should be created
* fix type alias warnings
* sync up with zigpy changes and additions
* add a binary sensor test
* button coverage
* switch coverage
* initial select coverage
* number coverage
* sensor coverage
* update discovery after rebase
* coverage
* single line
* line lengths
* fix double underscore
* review comments
* set category from quirks in base entity
* line lengths
* move comment
* imports
* simplify
* simplify