These tests do not need a config entry, only the integration
to be set up. Since I cannot replicate the issue locally after
1000 runs, I switched it to use async_setup_component to minimize
the potential problem area and hopefully fix the flakey test
I also modified the test to explictly set up hassio to ensure
the patch is effective since we have to patch a late import
last observed flake: https://github.com/home-assistant/core/actions/runs/14503715101/job/40689452294?pr=143106
* Add search to media_player
* rename attr
* Add searchable property
* add pagination parameters
* Add suggested changes
* Apply suggestions
* Fix cast tests
* Fix first set of components
* update snapshot
* More tests
* more test fixes
* Rename attr
* first own test
* Add to google test
* Add service test
* Rename search query arg
* Add required feature to search service
* remove kwarg
* Update homeassistant/components/media_player/__init__.py
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
* fix hue test
---------
Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Add debug logging to homekit when an sensor entity cannot be classified
In #132937 many hours were spent investigating an issue which
turned out to be that the entity did not have a device class
at startup because the group integration does not set the device
class if any of the underlying entities state is invalid.
closes#132937
* coverage
* Update tests/components/homekit/test_get_accessories.py
* Fix a bug parsing a streaming response with no json
* Remove debug lines
* Fix quality loss for LLM conversation agent question answering
* Update tests
* Bump aioesphomeapi to 29.10.0
changelog: https://github.com/esphome/aioesphomeapi/compare/v29.9.0...v29.10.0
* Validate ESPHome mac address before updating IP on discovery
In some cases the data coming in from discovery may be
stale since there is a small race window if devices
get new IP allocations. Since some routers do not update
their names right away and zeroconf has a non-zero TTL
there is a small window where the discovery data can be
stale. This is a rare condition but it does happen. With
aioesphomeapi 29.10.0+ and ESPHome 2025.4.x+ we can validate
the mac address even without the correct encryption key
which allows us to be able to always validate the MAC
before updating the IP from any discovery method.
* tweaks
* fix test
* Update ollama to allow selecting mutiple LLM APIs
* Update homeassistant/helpers/llm.py
* Avoid gather since these don't do I/O
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Disable specific updates for an appliance when is done repeatedly
* Fix deprecation issues fix tests
* Fix message
* Avoid fetching appliance info also
* Apply suggestions
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Create specific RepairFlow for enabling appliance's updates
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Abort reauth flows on config entry reload
* Don't cancel reauth when reload is triggered by a reauth flow
* Revert "Don't cancel reauth when reload is triggered by a reauth flow"
This reverts commit f37c75621e.
* Don't fail in FlowManager._async_handle_step when the flow was aborted
* Update tplink config flow
* Add tests
* Don't allow create_entry from an aborted flow
* Add comment
* Adjust after merge with dev
* Initial commit prototype with empty inverters
* Use modern methods and global variable for character strings
* Platform that get the value of the meter in an entity
* Add check if inverter already configured
* Add tests for config_flow
* Update "imeon_inverter_api" in manifest.json
* Update "imeon_inverter_api" in requirements_all.txt
* Remove async_setup, clean comments, use of const PLATFORM
* Use of global variable and remove configuration of device name
* Use of entry.data instead of user_input variable
* Remove services.yaml
* No quality scale
* Use of common string
* Add sensors, use of EntityDescription and '_attr_device_info'
* Remove name from config_flow tests
* Use sentence case and change integration from hub to device
* Check connection before add platform in config_flow
* Use of _async_setup and minor changes
* Improve sensor description
* Add quality_scale.yaml
* Update the quality_scale.json
* Add tests for host invalid, route invalid, exception and invalid auth
* Type more precisely 'DataUpdateCoordinator'
* Don't use 'self.data' directly in coordinator and minor corrections
* Complete full quality_scale.yaml
* Use of fixtures in the tests
* Add snapshot tests for sensors
* Refactor the try except and use serial as unique id
* Change API version
* Add test for sensor
* Mock the api to generate the snapshot
* New type for async_add_entries
* Except timeout error for get_serial
* Add test for get_serial timeout error
* Move store data out of the try
* Use sentence case
* Use of fixtures
* Use separates fixtures
* Mock the api
* Put sensors fake data in json fixture file
* Use of a const interval, remove except timeout, enhance lisibility
* Try to use same fixture in test_config_flow
* Try use same fixture for all mock of inverter
* Modify the fixture in the context manager, correct the tests
* Fixture return mock.__aenter__ directly
* Adjust code clarity
* Bring all tests to either ABORT or CREATE_ENTRY
* Make the try except more concise
* Synthetize exception tests into one
* Add code clarity
* Nitpick with the tests
* Use unique id sensor
* Log an error on unknown error
* Remove useless comments, disable always_update and better use of timeout
* Adjust units, set the model and software version
* Set full name for Battery SOC and use ip instead of url
* Use of host instead of IP
* Fix the unit of economy factor
* Reduce mornitoring data display precision and update snapshots
* Remove unused variable HUBs
* Fix device info
* Set address label 'Host or IP'
* Fix the config_flow tests
* Re evaluate the quality_scale
* Use of 'host' instead of 'address'
* Make inverter discoverable by ssdp
* Add test ssdp configuration already exist
* Add exemption in quality scale
* Test abort ssdp if serial is unknown
* Handle update error
* Raise other exceptions
* Handle ClientError and ValueError from the api
* Update homeassistant/components/imeon_inverter/quality_scale.yaml
---------
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Josef Zweck <josef@zweck.dev>
* Add support for air purifier type in HomeKit.
Any fan and PM2.5 in the same device will be treated as an air purifier.
type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.
* Refactor to make AirPurifier class extend Fan.
* Ensure all chars are added before creating service
* Add support for switching automatic mode.
* Add test for auto/manual switch
* Add support for air purifier type in HomeKit.
Any fan and PM2.5 in the same device will be treated as an air purifier.
type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.
* Add support for air purifier type in HomeKit.
Any fan and PM2.5 in the same device will be treated as an air purifier.
type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.
* Refactor to make AirPurifier class extend Fan.
* Ensure all chars are added before creating service
* Add support for switching automatic mode.
* Add test for auto/manual switch
* Add support for air purifier type in HomeKit.
Any fan and PM2.5 in the same device will be treated as an air purifier.
type_air_purifiers.py heavily based on type_fans.py -
I tried extending type_fans.py but this looked better to me.
* Improve fan config: allow setting fan type (fan or air purifier)
Be more explicit than assuming a fan is an air purifier if it has a PM2.5 sensor. Set defaults based on the presence of sensors.
* Fix return type annotation for fan/air purifier create_services
* Allow linking air purifier filter level/change indicator
* Remove no longer needed if statement in fan init
* Fix up types and clean up code
* Update homekit tests to account for air purifiers
* Fix pylint errors
* Fix mypy errors
* Improve type annotations
* Improve readability of auto preset mode discovery
* Test air purifier with 'Auto' preset mode
* Handle case with a single preset mode
* Test air purifier edge cases: state updates to same value, and removed linked entities
* Don't create 'auto mode' switch for air purifiers
This is already exposed as a target mode on the air purifier service itself
* Handle unavailable states in air purifier
Also don't remove device class when updating state in test
* Reduce branching in air purifier test
* Split up air purifier tests for with and without auto presets, to reduce branching
* Handle unavailable states in air purifier more explicitly
* Use constant for ignored state values
* Use a set for ignored_states
* Update tests/components/homekit/test_type_air_purifiers.py
---------
Co-authored-by: Andrew Kurowski <62596884+ak6i@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick+github@koston.org>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Abort if a flow is removed during a step
* Reorganize code
* Only call _set_pending_import_done if an entry is created
* Try a new approach
* Add tests
* Update tests
* Move inkbird coordinator logic into coordinator.py
Not a functional change, one to one relocation
* Move inkbird coordinator logic into coordinator.py
Not a functional change, one to one copy
* Move inkbird coordinator logic into coordinator.py
Not a functional change, one to one copy
* add sensor platform to bosch_alarm
* add icon translations for sensors
* translate entity names
* translate entity names
* translate entity names
* update snapshots
* translate ready to arm sensor
* translate ready to arm sensor
* update tests
* update translations
* remove history sensor, we will replace it with an events sensor later
* fix tests
* fix tests
* fix tests
* update tests
* fix sensor links
* only call async_add_entities once
* convert area alarms to sensors based on type
* add sensor for alarms
* add icons
* cleanup area sensor
* add available
* loop over dict
* use entity description
* use entity description
* clean up entity descriptions
* observe_alarms and observe_ready
* refactor alarm_control_panel to use base entity
* remove more old sensors
* add unit of measurement
* update test snapshots
* use correct observer
* Add entity tests
* Add __init__ tests
* Cleanup
* Rename mock_motionmount_config_flow to mock_motionmount
* Remove unneeded PropertyMock
* Set defaults on mock_motionmount
* Test proper device is created
* Check whether proper device is created from test_init.py, also without mac
* Find callback and use that to update name
* Add fan platform to eheimdigital
* Fix pylint
* Convert fan to sensor platform
* Remove unnecessary changes
* Add state update test
* Review
* Review
* Review
* Add DHCP discovery support to Bond
* fixes
* unique ids are always upper
* raise_on_progress=False for user
* Update tests/components/bond/test_config_flow.py
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
* assert unique id
---------
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
* Ensure a flux_led user flow can replace an ignored entry
Allow ignored devices to be selected in the user step and replace the ignored entry.
Same as #137056 and #137052 but for flux_led
* works as-is was a problem with core.config_entries
* Do not fetch disconnected Home Connect appliances
* Apply suggestions
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update docstring
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Hide bad ZBT-1 config entries on the hardware page
* Set up the bad config entry in the unit test
* Roll into a list comprehension
* Remove constant changes
* Fix condition in unit test
Replacing an ignored config entry with one from the user
flow should not generate a warning. We should only warn
if we are replacing a usable config entry.
Followup to adjust the warning added in #130567
cc @epenet
* Deprecate effect none instead of breaking it for Hue
* add guard for unknown effect value
* revert guard
* Fix
* Add test
* Add test
* Add test
---------
Co-authored-by: Joostlek <joostlek@outlook.com>
* now the price will return even if it is exactly 0
* now the price will return even if it is exactly 0
* now the price will return even if it is exactly 0
* clean code
* clean code
* update testing code coverage
* change zero testing to SE4
* remove row duplicate
* fix date comments
* improve testing
* simplify if-return-0
* remove unnecessary tests
* order testing rows
* restore test_sensor_no_next_price
* remove_average_price_test
* fix test name
* Move Z-Wave JS smoke, CO, CO2, Heat, Water problem entities to diagnostic
* Update link + states
* Specify problem class explicitly instead of catch-all
* Heat alarm test is not a problem
* Also split out smoke alarm
* Document mapping rule
* add tests
* format
* update test
* review comments
* remove idle state from doc as it is ignored
---------
Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
* check for empty or missing values when processing state messages for MQTT light entities using 'template' schema
* normalise warning logs
* add tests (one is still failing and I can't work out why)
* fix test
* improve test coverage after PR review
* improve test coverage after PR review
* Reload the config entry when the ZBT-1 is unplugged
* Register the USB event handler globally to react better to re-plugs
* Fix existing unit tests
* Add an empty `CONFIG_SCHEMA`
* Add a unit test
* Fix unit tests
* Fix unit tests for Linux
* Address most review comments
* Address remaining review comments
* Remove unnecessary imports of http integration
* Check reason for test failures
* Revert "Check reason for test failures"
This reverts commit 5ccf356ab0.
* Update tests
* add cover unit tests
* Add unit test for SwitchBot cover
* fix: use mock_restore_cache to mock the last state
* modify unit tests
* modify scripts as suggest
* improve readability
* adjust patch target per review comments
* adjust patch target per review comments
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
* Add authentication support for Model Context Protocol (mcp) integration
* Update homeassistant/components/mcp/application_credentials.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Handle MCP servers with ports
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Set and check unique id in config
* Update homeassistant/components/nut/config_flow.py
Set unique ID and abort only if value is defined
Co-authored-by: J. Nick Koston <nick+github@koston.org>
* Add duplicate ID test case for multiple devices
* Add unique ID check to config flow step for UPS
* Update homeassistant/components/nut/__init__.py
Fix to only set config_entries unique ID if not None
Co-authored-by: J. Nick Koston <nick+github@koston.org>
* Remove duplicate config flow call
---------
Co-authored-by: J. Nick Koston <nick+github@koston.org>
Co-authored-by: J. Nick Koston <nick@koston.org>
* fix: two minor LLM changes to speed up prefill
- moved the current date/time to the end of the prompt
- started sorting all entities by last_changed
* addressed PR comments
* fixed tests
* reduced scope of try/catch in LLM prompt
* addressed more PR comments
* fixed Anthropic test
* addressed another PR comment
* fixed remainder of tests
* Don't turn on thermostat if temp is equal to target temp.
* Update strings to reflect logic change.
* Fix logic and add zero tolerance tests.
* Include tests for cool mode
* Removed unnecessary async_block_till_done calls
* Fix order of palettes, presets and playlists in WLED integration
* fix tests: update palette items order
---------
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Move roborock unique id to be based on roborock userid instead of email
* Remove unnecessary data update
* Update tests
* Add tests coverage for removal of config entry
* Use config entry migration
* Remove unused fixtues
* Remove unnecessary logging
* Fix ESPHome update entities being loaded before device_info is available
Since we load platforms when restoring config, the update
platform could be loaded before the connection to the
device was finished which meant device_info could still
be empty. Wait until device_info is available to
load the update platform.
fixes#135906
* Apply suggestions from code review
* move comment
* Update entry_data.py
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
---------
Co-authored-by: TheJulianJES <TheJulianJES@users.noreply.github.com>
* Fix old ESPHome entities not being removed when configuration changes
fixes#140756
* make sure all callbacks fire
* make sure all callbacks fire
* make sure all callbacks fire
* make sure all callbacks fire
* revert
* cover
* Dynamically add Home Connect event sensors to HA
* Add and remove listeners on paired and depaired events
* Apply suggestion
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update test
* Adjust English
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Increase websocket_api allowed peak time to 10s
fixes#141624
During integration reload or startup, we can end up sending a message for
each entity being created for integrations that create them from an external
source (ie MQTT) because the messages come in one at a time. This can overload
the loop and/or client for more than 5s. While we have done significant work
to optimize for this path, we are at the limit at what we can expect clients
to be able to process in the time window, so increase the time window.
* adjust test
* Add the Yellow and ZBT-1 to the device registry
* Unload platforms
* Fix unit tests
* Rename the Yellow update entity to `Radio firmware`
* Rename `EmberZNet` to `EmberZNet Zigbee`
* Prefix the `sw_version` with the firmware type and clean up
* Fix unit tests
* Remove unnecessary `always_update=False` from data update coordinator
* Fix misleading friendly names of `rainforest_raven` sensors
The three sensors
- power_demand
- total_energy_delivered
- total_energy_received
currently add "meter" in their friendly names.
This does not provide any useful information and is rather irritating instead – it sounds like these are the power demands or consumption of the meter itself. But they are the measured values.
This commit removes "meter" from the names making them simpler and more precise, too.
In addition the sentence-casing of "MAC addresses" is fixed.
* Update test_sensor.ambr
* Update test_sensor.ambr (2)
* Also remove "meter" from Signal strength
* Update test_sensor.ambr (3)
* Change `meter_price` to `energy_price` in strings.json
* Change `meter_price` to `energy_price` in test_sensor.ambr
* Change `meter_price` to `energy_price` in sensor.py