* Add missing platforms_exist guard to check_config
related issue #112811
When the exception hits, the config will end up being saved in the traceback
so the memory is never released.
This matches the check_config code to homeassistant.config to avoid having
the exception thrown.
* patch
* merge branch
* Fix memory leak when importing a platform fails
re-raising ImportError would trigger a memory leak
* fixes, coverage
* Apply suggestions from code review
* Default agent as entity
* Migrate constant to point at new value
* Fix tests
* Fix more tests
* Move assist pipeline back to cloud after dependenceis
* Add uptime sensor to Glances
* Merge upstream
* Merge upstream
* Fix coverage
* Add uptime sensor to Glances
* Merge upstream
* Merge upstream
* Fix coverage
* Move most uptime specific code to DataUpdateCoordinator
* Add last_reported after merge with upstream
* Add unit tests for uptime sensor
* Add unit tests for uptime sensor
* Add unit tests for uptime sensor
* Add unit tests for uptime sensor
* Move update code out of getter native_value()
* Add unit tests for uptime sensor
* Update uptime method signatures
* Set uptime icon in icons.json
* Use freezer.tick for uptime tests
* Frozen time test fails on github
* Add MIN_UPTIME_VARIATION const value
* Only update uptime on startup or when remote server restarts
* Fix for 0 values
* Set value to None to set state to Unknown if key is not found
* Add unit test for uptime change
* Code reduction
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Re-organize conversation integration
* Clean up 2 more imports
* Re-export models
* Fix imports
* Uno mas
* Rename agents to models
* Fix cast test that i broke?
* Just blocking till I'm done
* Wrong place
* Mark executor jobs as background unless created from a tracked task
If the current task is not tracked the executor job should not
be a background task to avoid delaying startup and shutdown.
Currently any executor job created in a untracked task or
background task would end up being tracked and delaying
startup/shutdown
* import exec has the same issue
* Avoid tracking import executor jobs
There is no reason to track these jobs as they are always awaited
and we do not want to support fire and forget import executor jobs
* fix xiaomi_miio
* lots of fire time changed without background await
* revert changes moved to other PR
* more
* more
* more
* m
* m
* p
* fix fire and forget tests
* scrape
* sonos
* system
* more
* capture callback before block
* coverage
* more
* more races
* more races
* more
* missed some
* more fixes
* missed some more
* fix
* remove unneeded
* one more race
* two
* Use `setup_test_component_platform` helper for select entity component tests instead of `hass.components`
* Use _values instead of _attr_current_option
* Clean up
* Set default current_option for second mock entity
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Integration for Energenie Power-Strips (EGPS)
* cleanups reocommended by reviewer
* Adds missing exception handling when trying to send a command to an unreachable device.
* fix: incorrect handling of already opened devices in pyegps api. bump to pyegps=0.2.4
* Add blank line after file docstring, and other cosmetics
* change asyncio.to_thread to async_add_executer_job
* raises HomeAssistantError EgpsException in switch services.
* switch test parameterized by entity name
* reoved unused device registry
* add translation_key and update_before_add
* bump pyegps dependency to version to 0.2.5
* combined get_device patches and put into conftest.py
* changed switch entity to use _attr_is_on and cleanups
* further cleanup
* Apply suggestions from code review
* refactor: rename egps to energenie_power_sockets
* updated test snapshot
---------
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
* Address late review comments for fan entity component test
* Update tests/components/fan/common.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* SharkIQ Dep & Codeowner Update
* Update code owners
* SharkIQ Room-Targeting Support
* Add Tests for New Service
* Remove unreachable code
* Refine tests to reflect unreachable code changes
* Updates based on PR comments
* Updates based on PR review comments
* Address issues found in PR Review
* Update Exception type, add excption message to strings. Do not save room list in state history.
* Update message to be more clear that only one faild room is listed
* couple more updates based on comments
---------
Co-authored-by: jrlambs <jrlambs@gmail.com>
Co-authored-by: Robert Resch <robert@resch.dev>
* Use `setup_test_component_platform` helper for switch entity component tests instead of `hass.components`
* Do not import fixtures
* Re-add switch.py to testing_config as stub
* Rename to mock_toggle_entities
* Remove deprecated forecast attribute from WeatherEntity
* Fix some
* Ruff
* ipma
* buienradar
* some more
* Some more
* More and more
* strings
* attr_forecast
* Fix nws
* Fix
* remove from coverage
* Remove recorder test
* Review comments
* Record state.last_reported
* Include last_reported in parts of the history API
* Use a bulk update
* fix refactoring error
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
* Use `mock_platform` for cover entity component tests instead of `hass.components`
* Remove setup fixture and use helper function
* Remove is_on from MockCover
* Run ruff
* Do not override state in `MockCover` in cover tests
* Remove is_on from MockCover
* 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>
* initial fork
* intial tests
* Initial test coverage
* extra coverage
* complete config flow tests
* fix generated
* Update CODEOWNERS
* Move logic to PyPi library and update to pass config_flow test and pre-commit
* Remove Button, Select and Sensor platform for initial PR
* Update manifest.json
* Change info logs to debug in cover
* Use _abort_if_unique_id_configured instead of custom loop checking existing entries
* Change platforms list to PLATFORMS global
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
* Remove VERSION from ConfigFlow
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
* Replace all info logs by debug
* Use instance attributes in ConfigFlow
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
* Add return type and docstring to init in ConfigFlow
* Add recovery to tests containing errors
* Make NoBluetoothAdapter and NoDevicesFound abort instead of show error
* Change info logs to debug
* Add and change integration type from hub to device
* Use CONF_ADDRESS from homeassistant.const
* Move cover attributes initialization out of constructor
* Change CONF_ADDRESS in tests from const to homeassistant.const
* Remove unused part of tests
* Change 'not motion_device' to 'motion_device is None'
* Change _attr_connection_type to _connection_type
* Add connections to DeviceInfo
* Add model to DeviceInfo and change MotionBlindType values
* Remove identifiers from DeviceInfo
* Move constants from const to library
* Move calibration and running to library, re-add all platforms
* Remove platforms from init
* Remove button platform
* Remove select platform
* Remove sensor platform
* Bump motionblindsble to 0.0.4
* Remove closed, opening and closing attribute default values
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
* Remove CONFIG_SCHEMA from init
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
* Remove unused platform attributes and icons
* Re-add _attr_is_closed to GenericBlind to fix error
* Use entry.async_create_background_task for library instead of entry.async_create_task
* Move updating of position on disconnect to library
* Remove type hints, keep for _attr_is_closed
* Use DISPLAY_NAME constant from library for display name
* Add TYPE_CHECKING condition to assert in config_flow
* Re-add CONFIG_SCHEMA to __init__ to pass hassfest
* Change FlowResult type to ConfigFlowResult
* Fix import in tests
* Fix ruff import
* Fix tests by using value of enum
* Use lowercase name of MotionBlindType enum for data schema selector and translation
* Fix using name instead of value for MotionBlindType
* Improve position None handling
Co-authored-by: starkillerOG <starkiller.og@gmail.com>
* Improve tilt None handling
Co-authored-by: starkillerOG <starkiller.og@gmail.com>
* Change BLIND_TO_ENTITY_TYPE name
* Set entity name of cover to None and use DeviceInfo name
* Add base entity
* Move async_update to base entity
* Move unique ID with suffix to base class
* Add entity.py to .coveragerc
* Remove extra state attribute connection type
* Remove separate line hass.data.setdefault(DOMAIN, {})
* Remove use of field for key and translation_key in MotionCoverEntityDescription
* Remove entity translation with extra state_attributes from strings.json
* Use super().__init__(device, entry)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
* Change if block in async_update_running
* Use if blocks in async_update_position
* Add additional scanner check before show_form
* Remove default value of device_class in MotionCoverEntityDescription
* Fix entry.data[CONF_BLIND_TYPE] uppercase
* Fix device info model name
* Bump motionblindsble to 0.0.5
* Fix tests
* Move entity_description to MotionblindsBLEEntity
* Change double roller blind name
* Bump motionblindsble to 0.0.6
* Fix ruff
* Use status_query for async_update
* Bump motionblindsble to 0.0.7
* Change bluetooth local name
* Set kw_only=True for dataclass
* Change name of GenericBlind
* Change scanner_count conditional
* Wrap async_register_callback in entry.async_on_unload
* Bump motionblindsble to 0.0.8
* Use set_create_task_factory and set_call_later_factory
* Update bluetooth.py generated
* Simplify COVER_TYPES dictionary
* Move registering callbacks to async_added_to_hass
* Remove check for ATTR_POSITION and ATTR_TILT_POSITION in kwargs
* Add naming consistency for device and entry
* Use if block instead of ternary for _attr_unique_id
* Improve errors ternary in config_flow
* Use set instead of list for running_type
* Improve errors ternary in config_flow
* Remove init from MotionblindsBLECoverEntity and move debug log to async_added_to_hass
* Update debug log create cover
* Fix ruff
* Use identity check instead of equals
* Use identity check instead of equals
* Change MotionblindsBLECoverEntityDescription name
* Change debug log text
* Remove ATTR_CONNECTION from const
* Add types for variables in async_setup_entry
* Add types for variables in async_setup_entry
* Change PositionBlind class name to PositionCover etc
* Improve docstrings
* Improve docstrings
---------
Co-authored-by: starkillerOG <starkiller.og@gmail.com>
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This function was only ever used in homekit, and since there is
now an index of devices in the entity registry, homekit no longer
uses it.
I searched github code for all references to async_get_device_class_lookup
and the only think I could find using it were forks of core. It seems
unlikely that any custom components are affected by removing this
function
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Add generic entity platform setup fixture
* rename fixture
* No need for passing hass
* Make function instead of fixture
* Improve typing
* Use Sequence instead
* Migrate flux to use the new helper
* Use list instead
* Use Sequence instead
* Add restrictions for listening to event_reported events
* Update homeassistant/core.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Fetch ConfigValidationError message from translation cache
* Sync error logmessages with translation cache
* More sync
* Cleanup
* Remove unrelated change
* Follow up comments
* Rebase and improve contructor
* Improve name
* Rename to MULTIPLE_INTEGRATION_CONFIG_ERRORS
* Implement diagnostic platform for APCUPSd
* Put APCUPSd in gold quality scale
* Revert quality scale update
* Use snapshot testing for apcupsd
* Prettify the code
* Move setup time logging into the context manager
We were fetching the time twice but since the context
manager already has the timing, move it there
* remove log setup assertions from integration test
* tweak logging to give us better data for tracking issues
* redundant
* adjust
* preen
* fixes
* adjust
* make api change internal so nobody uses it
* coverage
* fix test
* fix more tests
* coverage
* more tests assuming internal calls
* fix more
* adjust
* adjust
* fix axis tests
* fix broadlink -- it does not call async_forward_entry_setup
* missed some
* remove useless patch
* rename, detect it both ways
* clear
* debug
* try to fix
* handle phase finishing out while paused
* where its set does not need to know its late as that is an implemenation detail of setup
* where its set does not need to know its late as that is an implemenation detail of setup
* tweak
* simplify
* reduce complexity
* revert order change as it makes review harder
* revert naming changes as it makes review harder
* improve comment
* improve debug
* late dispatch test
* test the other way as well
* Update setup.py
* Update setup.py
* Update setup.py
* simplify
* reduce
* Use CONF_CORE to reference `homeassistant` domain
* Just use DOMAIN
* USE DOMAIN for `homeasistant` domain in config_schema.py
* Use DOMAIN_HA as constant for homeassistant domain
* Rename CONF_CORE to DOMAIN_HA
* Rename DOMAIN_HA to HA_DOMAIN
* Use relative import
* Use direct imports
* Set TTS repairs as not fixable
* Return default confirm flow for fixable cloud issues
* Depend on repairs
* Test default repair flow
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add guard to HomeAssistantError `__str__` method to prevent a recursive loop
* Use repr of class instance instead
* Apply suggestion to explain __str__ method is missing
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
* Generic camera: Insufficient error message when configuration fails
Fixes#112279
* Add tests
* Fix typo in string
* Add new error strings to options flow.
* Group and improve error strings following PR review
* Add Shelly RGB/RGBW profiles support
* Update homeassistant/components/shelly/light.py
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
* Use walrus in rgbw_key_ids
* Use walrus in light_key_ids
---------
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
* Fetch MaxLengthExceeded exception mesage from the translation cache
* Update homeassistant/components/homeassistant/strings.json
Co-authored-by: J. Nick Koston <nick@koston.org>
* Add case without homeassistant integration
* Fix test
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
* Refactor rate limit helper to track time in seconds
Currently we created datetime and timedelta objects to enforce the
rate limit. When the rate limit was being hit hard, this got expensive.
We now use floats everywhere instead as they are much cheaper which
is important when we are running up against a rate limit, which is
by definition a hot path
The rate limit helper is currently only used for templates and
we do not have any code in the code base that directly passes
in a rate limit so the impact to custom components is expected
to be negligible if any
* misesd two
* Cache parsing the url for the device registry
There are lots of hub integrations that use the same url for every
sub-device which results in a lot of url parsing at startup. The
logic can be simplified quite a bit here by only using yarl
for URLs
* fix onvif
* Deprecate cloud tts gender option
* Update http api and prefs
* Test migration of prefs to minor version 4
* Adjust breaking date
* Add test for bad voice in http api
* Flatten tts info
* Fix comments
* Fix comment date
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Clarify voice validator
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Reduce overhead to write dlna_dmr state
- Only update supported_features once per state write cycle
- Use a dict lookup for state
* useless dispatch
* fix tests
* remove unreachable code
* update to 1.18.5 and add Brand to config, required for getting shared appliances
* update version to 0.18.6
* start fixing tests
* fix typo
* check for falsy values instead of explicit None
* move CONF_BRAND from global constants to whirlpool constants
* add test for no brand, fix __init__ import
* add brand to string.json
* add brand to re-auth
* add title/description, add brand info to description
* add reauth strings
* pass already initialized data dict
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* remove trailing comma
* Update strings again
* fix reauth tests to add brand
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Allow retries on SerialException, AuroraError
* Add test to verify that retry is occuring
* Fix tests and indents
* Only log to info level for normal on/offline
* Review comment: don't log warning, debug and raise UpdateFailed
* Fix tests
* Refactor setup time tracking to exclude time waiting on other operations
We now exclude the import time and th time waiting on
base platforms to setup from the setup times
* tweak
* tweak
* tweak
* tweak
* adjust
* fixes
* fixes
* preen
* preen
* tweak
* tweak
* adjust
* tweak
* reduce
* do not count integrtion platforms against their parent integration
* handle legacy tts platforms
* stt as well
* one more wait
* use the same pattern in all the legacy
* fix tts and stt legacy
* fix
* fix
* reduce
* preen
* entity comp does not wait for platforms
* scene blocks as well
* fix test
* test fixes
* coverage
* coverage
* coverage
* fix test
* Update tests/test_setup.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update tests/test_setup.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/setup.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* strip
* strip WAIT_PLATFORM_INTEGRATION
* strip WAIT_PLATFORM_INTEGRATION
* strip WAIT_PLATFORM_INTEGRATION
* strip WAIT_PLATFORM_INTEGRATION
* remove complexity
* Apply suggestions from code review
* no longer works that way
* fixes
* fixes
* fixes
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add Config Flow for Rova component
* Add tests for Rova config flow
* Fix data type
* Add rova to requirements for tests
* Removed seperate function for area check and global variable
* Add unique name and id to rova entities
* Add support for multiple rova entries
* Fix correct error after connection timeout or http error
* Revert SENSOR_TYPES update
* Add existing rova configuration from yaml as new entity
* Add tests for import configuration.yaml flow
* Cleanup code
* Update valid rova area check in config flow
* Changed abort keys and messages
* Updated using self.add_suggested_values_to_schema
* Update to pass tests
* Added missing strings
* Update sensor unique_ids
* Fix service name formatting
* Update tests for Rova entry
* Update tests to recover after error
* Update test name
* Apply suggestions from code review
---------
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>