Commit Graph
695 Commits
Author SHA1 Message Date
Erik MontnemeryandGitHub 427aa55789 Correct fallback to state in state machine when processing statistics (#140396) 2025-03-13 09:28:15 +01:00
Erik MontnemeryandGitHub 51c09c2aa4 Add test fixture ignore_translations_for_mock_domains (#139235)
* Add test fixture ignore_translations_for_mock_domains

* Fix fixture

* Avoid unnecessary attempt to get integration

* Really fix fixture

* Add forgotten parameter

* Address review comment
2025-02-25 20:10:29 +01:00
Erik MontnemeryandGitHub 428cc1a951 Update signature of platforms' async_setup_entry in tests (#138271) 2025-02-11 13:17:39 +01:00
epenetandGitHub 0e263aa427 Standardize homeassistant imports in full-CI tests (#136735) 2025-01-28 13:10:20 -05:00
Marc MuellerandGitHub f822fd82bb Fix recorder fixture typing (#136174) 2025-01-21 18:18:05 -10:00
Joost LekkerkerkerandGitHub 53ad02a1eb Enable RUF032 (#135836) 2025-01-20 08:05:33 +01:00
Joost LekkerkerkerandGitHub 8a35261fd8 Remove unused noqas (#135583) 2025-01-15 10:02:18 +01:00
64752af4c2 Change minimum SQLite version to 3.40.1 (#135042)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-01-08 16:34:36 -10:00
Stefan AgnerandGitHub 962f1bad32 Add mW as unit of measurement for Matter electrical power sensors (#133504) 2024-12-19 11:40:05 +00:00
Abílio CostaandGitHub 6db8fced60 Update buienradar sensors only after being added to HA (#131830)
* Update buienradar sensors only after being added to HA

* Move check to util

* Check for platform in sensor state property

* Move check to unit translation key property

* Add test for sensor check

* Properly handle added_to_hass

* Remove redundant comment
2024-12-02 13:52:59 +01:00
Robert ReschandGitHub 1f9ecfe839 Remove deprecated sensor constants (#131843) 2024-11-28 20:49:49 +01:00
Robert ReschandGitHub a67045ee6c Remove deprecated home assistant const constants (#131799) 2024-11-28 12:12:37 +01:00
Abílio CostaandGitHub e4e9d76b45 Raise error if sensor has translated and hardcoded unit (#131657) 2024-11-27 17:45:53 +01:00
Abílio CostaandGitHub d8dd6a99b3 Use default translation on SensorEntity unit_of_measurement (#131633)
* Use translations on SensorEntity unit_of_measurement property

* Use default language for unit translation

* Update brother integration snapshot

* Update snapshots
2024-11-27 14:45:53 +01:00
d8549409f7 Area units and conversion between metric and US (#123563)
* area conversions

* start work on tests

* add number device class

* update unit conversions to utilise distance constants

* add area unit

* update test unit system

* update device condition and trigger

* update statistic unit converters

* further tests work WIP

* update test unit system

* add missing string translations

* fix websocket tests

* add deprecated notice

* add more missing strings and missing initialisation of unit system

* adjust icon and remove strings from scrape and random

* Fix acre to meters conversion

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Tidy up valid units

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* fix ordering of area

* update order alphabetically

* fix broken test

* update test_init

* Update homeassistant/const.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* remove deprecated unit and fix alphabetical order

* change deprecation and add tests, change to millimeter conversion for inches

* fix order

* re-order defs alphabetically

* add measurement as well

* update icons

* fix up Deprecation of area square meters

* Update core integrations to UnitOfArea

* update test recorder tests

* unit system tests in alphabetical

* update snapshot

* rebuild

* revert alphabetization of functions

* other revert of alphabetical order

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-11-21 16:10:44 +01:00
epenetandGitHub 3c3a6dff04 Add translation checks for issue registry (#130593) 2024-11-15 15:05:04 +01:00
Jakob SchlyterandGitHub cd11f01ace Add support for MW/GW/TW and GWh/TWh (#130089) 2024-11-08 22:12:16 +01:00
Erik MontnemeryandGitHub c87415023c Correct cleanup of sensor statistics repairs (#127826) 2024-10-08 09:39:21 +02:00
Erik MontnemeryandGitHub 6d65d6bcf6 Don't create statistics issues when sensor is unavailable or unknown (#127226) 2024-10-01 22:08:48 +02:00
Erik MontnemeryandGitHub 495faf5033 Improve statistics issue title (#126851) 2024-09-27 18:32:20 +02:00
epenetandGitHub 94efd3e230 Cleanup sensor tests (#126881) 2024-09-27 13:43:24 +02:00
Erik MontnemeryandGitHub 771575cfc5 Make statistics validation create issue registry issues (#122595)
* Make statistics validation create issue registry issues

* Disable creating issue about outdated MariaDB version in tests

* Use call_soon_threadsafe instead of run_callback_threadsafe

* Update tests

* Fix flapping test

* Disable creating issue about outdated SQLite version in tests

* Implement agreed changes

* Add translation strings for issue titles

* Update test
2024-09-25 11:11:11 +02:00
96b7fc9a75 Add mm/s and in/s As Unit Of Speed (#125044)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-22 09:01:46 -05:00
3e53cc175f Change POWER_VOLT_AMPERE_REACTIVE to UnitOfReactivePower (#117153)
* Refactoring: exchange POWER_VOLT_AMPERE_REACTIVE with UnitOfReactivePower

* updated iotawatt and mysensors from VOLT_AMPERE_REACTIVE to UnitOfReactivePower.VOLT_AMPERE_REACTIVE

* deprecation period for POWER_VOLT_AMPERE_REACTIVE changed to one year.

* POWER_VOLT_AMPERE_REACTIVE changed to UnitOfReactivePower in blebox integration

* Update homeassistant/const.py

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-08-21 15:36:45 +02:00
epenetandGitHub f66b539027 Add missing hass type hint in component tests (s) (#124272) 2024-08-20 12:53:29 +02:00
Erik MontnemeryandGitHub ce2ffde22e Update sensor recorder tests to async (#124061) 2024-08-18 13:20:58 -05:00
epenetandGitHub 177690bcb3 Rename variable in sensor tests (#122954) 2024-07-31 20:42:05 +02:00
Erik MontnemeryandGitHub ec957e4a94 Run statistics on 5-minute intervals in tests (#122592)
* Run statistics on 5-minute intervals in tests

* Fix test failing when mysql does not return rows in insert order
2024-07-25 17:32:49 +02:00
Erik MontnemeryandGitHub c12a79ecba Deduplicate sensor recorder tests (#122516) 2024-07-25 12:31:11 +02:00
865190f0b0 Get suggested_unit_of_measurement via unit converter's UNIT_CLASS (#119196)
Co-authored-by: Richard <rikroe@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-07-10 17:45:07 +02:00
Erik MontnemeryandGitHub 5029da6919 Make the async_setup_recorder_instance fixture a context manager (#121086) 2024-07-03 14:05:34 -05:00
epenetandGitHub 22f5f59478 Use service_calls fixture in core platform tests [m-z] (#121001) 2024-07-02 12:34:11 +02:00
Marc MuellerandGitHub f11b316dac Import Generator from collections.abc (4) (#120917) 2024-07-01 11:54:42 +02:00
Joost LekkerkerkerandGitHub 0fdf037ba0 Fix ruff type comparison E721 (#120731)
Fix E721
2024-06-28 11:56:49 +02:00
G JohanssonandGitHub b59e7ede9a Raise on incorrect suggested unit for sensor (#120180) 2024-06-22 22:05:45 +02:00
dontinelliandGitHub 0dd5391cd7 Add Siemes and Millisiemens as additional units of conductivity and enable conversion between conductivity units (#118728) 2024-06-21 11:10:15 +02:00
epenetandGitHub 0f0c2f0553 Fix redefined-argument-from-local pylint warning in tests (#119475) 2024-06-12 17:58:58 +02:00
epenetandGitHub 4962895f19 Fix consider-using-enumerate warnings in tests (#119506) 2024-06-12 16:27:56 +02:00
epenetandGitHub abb8c58b87 Fix consider-using-tuple pylint warnings in core tests (#119463) 2024-06-12 12:35:01 +02:00
epenetandGitHub 2e3c3789d3 Use relative imports in tests [s-z] (#119283) 2024-06-10 13:33:15 +02:00
Marc MuellerandGitHub 837ee7c4fb Import Generator from typing_extensions (4) (#118992) 2024-06-06 17:41:37 +02:00
epenetandGitHub c7e065c413 Move enable_custom_integrations fixture to decorator (#118844) 2024-06-05 09:20:08 +02:00
J. Nick KostonandGitHub ed0568c655 Ensure config entries are not unloaded while their platforms are setting up (#118767)
* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* run with error on to find them

* cert_exp, hold lock

* cert_exp, hold lock

* shelly async_late_forward_entry_setups

* compact

* compact

* found another

* patch up mobileapp

* patch up hue tests

* patch up smartthings

* fix mqtt

* fix esphome

* zwave_js

* mqtt

* rework

* fixes

* fix mocking

* fix mocking

* do not call async_forward_entry_setup directly

* docstrings

* docstrings

* docstrings

* add comments

* doc strings

* fixed all in core, turn off strict

* coverage

* coverage

* missing

* coverage
2024-06-04 21:34:39 -04:00
epenetandGitHub 98d24dd276 Improve typing for calls fixture in tests (m-z) (#118350)
* Improve typing for `calls` fixture in tests (m-z)

* More

* More
2024-05-29 09:30:41 +02:00
epenetandGitHub e58d060f82 Use registry fixtures in tests (s) (#118295) 2024-05-28 15:41:03 +02:00
J. Nick KostonandGitHub d06932bbc2 Refactor asyncio loop protection to improve performance (#117295) 2024-05-13 07:01:55 +09:00
Erik MontnemeryandGitHub f309064a7f Convert sensor recorder tests to use async API (#116373)
* Convert sensor recorder tests to use async API

* Fix accidentally renamed test

* Avoid unnecessary calls to async_wait_recording_done

* Avoid auto-commits for every state change

* Make sure recorder patches are set up before hass fixture
2024-05-03 14:07:38 +02:00
169b9b0bfe Fix removing suggested_display_precision from entity registry (#110671)
* Fix removing suggested_display_precision from entity registry

* Fix tests

* Update homeassistant/components/sensor/__init__.py

---------

Co-authored-by: Erik <erik@montnemery.com>
2024-04-24 16:47:03 +02:00
474a1a3d94 Use display_precision if suggested_display_precision is None (#110270)
Co-authored-by: Richard <rikroe@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-04-24 09:46:55 +02:00
SidandGitHub 895f73d8e4 Enable Ruff A001 (#115654) 2024-04-21 23:25:27 +02:00