J. Nick Koston
3db0331378
Avoid converting to same units when compiling stats ( #109531 )
2024-02-04 15:21:05 +01:00
Joakim Plate
eefc6cd50a
Correct flow rate conversion review after merge ( #109501 )
2024-02-04 15:01:06 +01:00
J. Nick Koston
7d9935d24b
Reduce overhead to convert history to float states ( #109526 )
2024-02-04 11:37:14 +01:00
Marc Mueller
d2dee9e327
Update ruff to 0.1.15 ( #109303 )
2024-02-01 13:29:01 +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
karwosts
ef4e72f218
Fix precipitation typo in icons ( #109156 )
2024-01-30 10:32:53 -10: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
Franck Nijhof
206e6dfd62
Add sensor icon translations ( #108450 )
...
* Add sensor icon translations
* Add missing moisture
2024-01-20 11:05:16 +01:00
J. Nick Koston
50edc334de
Refactor sensor recorder _get_sensor_states to check for state class first ( #107046 )
...
The state class check is cheap and the entity filter check is much
more expensive, so do the state class check first
2024-01-07 22:36:03 -05:00
Erik Montnemery
c805ea7b4f
Include deprecated constants in wildcard imports ( #107114 )
2024-01-05 11:46:45 +01:00
Erik Montnemery
c1f1b5c50b
Ensure it's safe to call Entity.__repr__ on non added entity ( #106032 )
2023-12-31 18:54:34 +01:00
J. Nick Koston
178e4f9e25
Use converter factory in sensor platform ( #106508 )
...
This is a bit faster than calling .covert
2023-12-28 00:06:36 +01:00
J. Nick Koston
1c96cf33b8
Avoid recreating a set each time sensor unit_of_measurement is called ( #106401 )
2023-12-25 21:11:48 -10:00
J. Nick Koston
50f64e053e
Use identity checks for sensor device class enums ( #106383 )
2023-12-25 08:35:44 -10: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
J. Nick Koston
ff004a1c20
Add support for attribute caching to the sensor platform ( #106252 )
2023-12-23 11:13:02 +01:00
Robert Resch
d47ec91231
Deprecate deprecated sensor constants ( #106120 )
2023-12-21 00:02:20 +01:00
Michael
c87f2027d4
Use check_valid_float helper in significant change support of sensor and weather ( #106013 )
2023-12-19 12:31:10 +01:00
Erik Montnemery
104bcc64b7
Allow inheriting base component entity descriptions in frozen dataclasses ( #105512 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-12-15 23:33:50 -10:00
Marc Mueller
a70ec64408
Update mypy to 1.7.0 ( #103800 )
2023-11-11 23:31:04 +01:00
J. Nick Koston
6ce5f190c1
Avoid duplicate property calls when writing sensor state ( #101853 )
...
* Avoid duplicate attribute lookups when writing sensor state
_numeric_state_expected would call self.device_class,
self.state_class, self.native_unit_of_measurement,
and self.suggested_display_precision a second time
when the `state` path already had these values.
* one more
* avoid another
2023-10-12 08:45:20 +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
Marc Mueller
d5f07ef45f
Add override decorators to sensor ( #94998 )
2023-10-06 13:44:07 +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
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
df73850f56
Move definition of attributes excluded from history to entity classes ( #100430 )
...
* Move definition of attributes excluded from history to entity classes
* Revert change which should be in a follow-up PR
* Fix sun unrecorded attributes
* Fix input_select unrecorded attributes
2023-09-21 15:02:47 +02:00
Erik Montnemery
d1afcd773f
Revert "Cache entity properties that are never expected to change in the base class" ( #100422 )
...
Revert "Cache entity properties that are never expected to change in the base class (#95315 )"
This reverts commit 042776ebb8
.
2023-09-15 11:25:24 +02:00
J. Nick Koston
042776ebb8
Cache entity properties that are never expected to change in the base class ( #95315 )
2023-09-14 17:48:48 -05:00
Erik Montnemery
09ad1a9a36
Remove unnecessary block use of pylint disable in components p-z ( #100192 )
2023-09-12 20:47:48 +02:00
Erik Montnemery
51576b7214
Improve typing of entity.entity_sources ( #99407 )
...
* Improve typing of entity.entity_sources
* Calculate entity info source when generating WS response
* Adjust typing
* Update tests
2023-09-12 20:41:26 +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
Erik Montnemery
e1f0b44ba4
Use math.isfinite instead of explicitly checking for both nan and inf ( #98103 )
2023-08-09 14:13:57 +02:00
Franck Nijhof
30058297cf
Migrate backported StrEnum to built-in StrEnum ( #97101 )
2023-07-23 23:19:24 +02:00
Franck Nijhof
910c897ceb
Fix typo hidrogen to hydrogen ( #97096 )
2023-07-23 20:34:47 +02:00
Miguel Camba
38111141f9
Add new device class: PH (potential hydrogen) ( #95928 )
2023-07-23 18:49:10 +02:00
J. Nick Koston
61532475f9
Cleanup sensor unit conversion code ( #97074 )
2023-07-23 10:49:45 +02:00
Marc Mueller
77f38e33e5
Import names from typing instead of typing_extensions [3.11] ( #97065 )
2023-07-22 17:03:44 -05:00
Erik Montnemery
fa0d68b1d7
Add NumberDeviceClass.DURATION ( #96932 )
2023-07-20 11:10:03 +02:00
Joost Lekkerkerker
a8e92bfcb6
Fix typo for PM 1 ( #96473 )
2023-07-17 09:22:07 +02:00
J. Nick Koston
260e00ffb4
Check the registry entry in sensor unit_of_measurement instead of unique_id ( #96731 )
...
The unit_of_measurement check was checking to see if the entity has
a unique_id instead of a registry entry. Its much cheaper to check
for the registry_entry than the unique id since some entity have
to construct it every time its read
2023-07-17 08:50:06 +02:00
Erik Montnemery
86a397720f
Move platform_integration_no_support issue to the homeassistant integration ( #95927 )
...
* Move platform_integration_no_support issue to the homeassistant integration
* Update test
* Improve repair text
* Update test
2023-07-07 13:31:54 +02:00
J. Nick Koston
3f9d5a0192
Use the converter factory in sensor.recorder._normalize_states ( #95785 )
...
We have a factory to create converters now which avoids
the overhead of calling convert to create the converter
every time
2023-07-03 14:20:23 -04: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
3c015f85f4
Revert "Change the device class name volatile organic compounds parts
to VOCs ratio
" ( #95332 )
2023-06-27 12:28:31 +02:00