Erik Montnemery
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
Phil Bruckner
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
Richard Kroegel
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
Sid
895f73d8e4
Enable Ruff A001 ( #115654 )
2024-04-21 23:25:27 +02:00
Sid
9bf87329da
Enable Ruff FLY002 rule ( #115112 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-12 09:04:16 +02:00
Sid
9cbed10372
Enable Ruff PYI041 ( #115229 )
2024-04-08 09:29:05 -10:00
Sid
d5f883fbf0
Unignore Ruff PLR in tests ( #114470 )
...
* Unignore Ruff PLR in tests
* Address review comments
* review comments
* fix import
* Update test_api.py
* Update test_api.py
* Update test_api.py
2024-04-01 11:11:59 +02:00
Jan-Philipp Benecke
22b14d83e8
Use `setup_test_component_platform` helper for sensor entity component tests instead of `hass.components` ( #114316 )
...
* Use `setup_test_component_platform` helper for sensor entity component tests instead of `hass.components`
* Missing file
* Fix import
* Remove invalid device class
2024-03-28 12:07:55 +01:00
Sid
00ec7f11f0
Enable Ruff rule PT007 ( #113764 )
...
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Sid
69564b1a17
Add ruff rule PIE800 ( #113619 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-16 16:31:30 -10:00
Marc Mueller
aa16a9d707
Add empty line after module docstring (3) ( #112750 )
2024-03-08 20:38:34 +01:00
Marc Mueller
32f3f46542
Add empty line after module docstring (2) [tests.components] ( #112737 )
2024-03-08 19:16:21 +01:00
Marc Mueller
7d6251ca08
Add empty line after module docstring [tests q-s] ( #112711 )
2024-03-08 14:47:22 +01:00
fwestenberg
385b29bdf5
Add Beaufort to wind_speed ( #105795 )
...
* Add Beaufort to wind_speed
* Add Bft to UnitOfSpeed
* Update tests with Bft
* Remove check for unit
* Fix test_deprecated_constants
* Test depricated constant Beaufort
* Fix test_unit_system.py for Beaufort
* Remove _DEPRECATED_SPEED_FEET_BEAUFORT
* Remove maxsize from lru_cache
* Update test_deprecated_constants
* Update comment
* Add missing docstring
* Apply suggestions from code review
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-03-05 14:55:59 +01:00
J. Nick Koston
d9addc45f9
Avoid scheduling a task to add each entity when not using update_before_add ( #110951 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-02-23 10:49:26 -10:00
Marc Mueller
2ef2172b01
Convert test helpers to get hass instance to contextmanagers ( #109990 )
...
* Convert get_test_home_assistant helper to contextmanager
* Convert async_test_home_assistant helper to contextmanager
* Move timezone reset to async_test_home_assistant helper
2024-02-11 21:23:51 +01:00
Jan Bouwhuis
5dfffb0818
Allow weight to be used as total_increasing state_class for sensors ( #108505 )
...
* Allow weight to be used as total_increasing state_class for sensors
* Add SensorStateClass.TOTAL
2024-02-05 18:01:06 +01:00
Joakim Plate
eefc6cd50a
Correct flow rate conversion review after merge ( #109501 )
2024-02-04 15:01:06 +01:00
Robert Resch
b409933d19
Add DurationConverter ( #108865 )
...
* Add DurationConverter
* Update withings snapshots
* Add sensor test
* Fix tests
* Update snapshots after #108902 was merged
2024-01-30 23:08:12 +01:00
Robert Resch
7d2c6a1bb6
Add check for valid initial_suggested_unit ( #108902 )
...
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-01-30 18:55:59 +01:00
Joakim Plate
cece117c93
Flow rate unit conversions and device class ( #106077 )
...
* Add volume flow rate conversions
* Add missing translations
* Adjust liter unit and add gallons per minute
* Adjust to min instead of m for minutes
* Add matching class for number
* Add some tests for number and sensor platform
* Add deprecated constants
* Add explicit list of flow rate for check
This reverts commit 105171af31
.
2024-01-30 15:01:08 +01:00
Jan-Philipp Benecke
80bfd4cef7
Raise ValueError when `last_reset` set and not `total` state class ( #108391 )
...
* Raise ValueError when last_reset set and not total state class
* Fix test
* Break long string into smaller ones
2024-01-29 20:21:35 +01:00
J. Nick Koston
c399cab427
Small speed up to checking core state ( #107845 )
2024-01-18 08:41:32 -10:00
Erik Montnemery
c805ea7b4f
Include deprecated constants in wildcard imports ( #107114 )
2024-01-05 11:46:45 +01:00
Robert Resch
ebdf7b9c8c
Deprecate some deprecated const constants ( #106230 )
...
* Deprecate some deprecated const constants
* Improve code
* fix typing
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-12-23 20:18:51 +01:00
Robert Resch
d47ec91231
Deprecate deprecated sensor constants ( #106120 )
2023-12-21 00:02:20 +01:00
Jan Bouwhuis
a66c9bb7b6
Update stale doc strings in entity platform tests ( #105526 )
2023-12-12 08:28:08 +01:00
Erik Montnemery
b5a6e6b9d5
Use real devices in sensor device condition tests ( #102713 )
2023-10-24 23:37:36 +02:00
Erik Montnemery
82cc62416e
Use real devices in sensor device trigger tests ( #102695 )
2023-10-24 22:37:44 +02:00
Robert Resch
f7292d5b00
Add check that sensors don't have EntityCategory.CONFIG set ( #101471 )
2023-10-09 13:37:52 +02:00
J. Nick Koston
c6ed022cce
Fix compiling missing statistics losing rows ( #101616 )
2023-10-08 19:43:00 +02:00
Erik Montnemery
775751ece5
Add WS command sensor/numeric_device_classes ( #101257 )
2023-10-06 10:27:45 +02:00
Erik Montnemery
659d437cac
Use loader.async_suggest_report_issue in sensor ( #101389 )
2023-10-05 20:07:56 +02:00
Erik Montnemery
17779c5f0c
Add loader.async_suggest_report_issue and loader.async_get_issue_tracker ( #101336 )
...
* Add loader.async_suggest_report_issue and loader.async_get_issue_tracker
* Update tests
* Add tests
* Address review comments
* Address review comments
2023-10-04 13:40:33 +02:00
Erik Montnemery
d0dc4d0963
Add missing device class to sensor.DEVICE_CLASS_UNITS ( #101256 )
2023-10-02 13:01:26 +02:00
Erik Montnemery
7a1ee98bb6
Fix handling of unit system change in sensor ( #100715 )
2023-09-23 13:28:14 +02:00
Erik Montnemery
bbcbb2e322
Improve Entity._suggest_report_issue ( #100204 )
2023-09-12 21:07:32 +02:00
Ville Skyttä
b51c0f6ddc
Remove unnnecessary pylint configs from components [s-z]* ( #98925 )
2023-08-24 01:25:32 +02:00
Erik Montnemery
e3b945a8d0
Don't allow numerical sensor state to be NaN or inf ( #98110 )
2023-08-23 14:16:40 +02:00
Ville Skyttä
2399cd283a
Python 3.10 support cleanups ( #98640 )
2023-08-21 19:14:07 +02:00
Miguel Camba
38111141f9
Add new device class: PH (potential hydrogen) ( #95928 )
2023-07-23 18:49:10 +02:00
J. Nick Koston
b24c6adc75
Avoid regex for negative zero check in sensor ( #95691 )
...
* Avoid regex for negative zero check in sensor
We can avoid calling the regex for every sensor value
since most of the time values are not negative zero
* tweak
* tweak
* Apply suggestions from code review
* simpler
* cover
* safer and still fast
* safer and still fast
* prep for py3.11
* fix check
* add missing cover
* more coverage
* coverage
* coverage
2023-07-02 21:53:50 -04:00
Erik Montnemery
b71e0302d6
Use entity registry id in sensor device conditions ( #95260 )
2023-06-26 21:20:40 +02:00
Erik Montnemery
5884afd485
Teach sensor device trigger about entity registry ids ( #94988 )
2023-06-22 11:13:54 +02:00
Erik Montnemery
446a820cbb
Name unnamed sensors by their device class ( #94646 )
2023-06-20 23:09:24 +02:00
Erik Montnemery
eba04824a4
Replace assert_lists_same with pytest_unordered in integrations n-s ( #94902 )
2023-06-20 20:23:14 +02:00
J. Nick Koston
fba826ae9e
Migrate restore_state helper to use registry loading pattern ( #93773 )
...
* Migrate restore_state helper to use registry loading pattern
As more entities have started using restore_state over time, it
has become a startup bottleneck as each entity being added is
creating a task to load restore state data that is already loaded
since it is a singleton
We now use the same pattern as the registry helpers
* fix refactoring error -- guess I am tired
* fixes
* fix tests
* fix more
* fix more
* fix zha tests
* fix zha tests
* comments
* fix error
* add missing coverage
* s/DATA_RESTORE_STATE_TASK/DATA_RESTORE_STATE/g
2023-05-30 20:48:17 -05:00
Jan Bouwhuis
ec98e22330
Add type hints for stub_blueprint_populate fixture ( #93568 )
...
Add typehints for stub_blueprint_populate fixture
2023-05-26 08:13:13 +02:00
Erik Montnemery
3cca338c6e
Improve blueprint test fixtures ( #93519 )
2023-05-25 13:45:19 +02:00
J. Nick Koston
7ec6e03d5d
Update sensor tests to avoid patching utcnow ( #93497 )
2023-05-24 19:54:08 -05:00