Erik Montnemery
fca5cc6ea3
Add number + sensor device class volume storage ( #88312 )
...
* Add number + sensor device class volume storage
* Fix typo
* Format code
* Update device automations
2023-03-01 11:22:57 +01:00
Erik Montnemery
69ce6980d6
Add number + sensor device class energy storage ( #88310 )
...
* Add number + sensor device class energy storage
* Format code
* Update device automations
2023-02-28 19:35:43 +01:00
Erik Montnemery
390daf1723
Sort unit lists sent to frontend ( #88898 )
2023-02-28 16:12:49 +01:00
Erik Montnemery
fe8f3602ff
Fix sensor unit conversion bug ( #88825 )
...
* Fix sensor unit conversion bug
* Ensure the correct unit is stored in the entity registry
2023-02-27 11:46:55 +01:00
epenet
488d78571e
Add missing device class triggers ( #88316 )
...
* Add constant tests for sensor device classes
* Add missing strings
* Adjust tests
* Add missing conditions
* Add missing trigger
* Cleanup
2023-02-20 08:30:51 +01:00
Franck Nijhof
1e05697080
Enable Ruff B007 ( #88356 )
...
* Enable Ruff B007
* Adjust existing cases
2023-02-17 21:08:18 -05:00
Erik Montnemery
9989a4787b
Fix recorder platform tests ( #88330 )
2023-02-17 08:22:15 -06:00
Franck Nijhof
d3ed8de232
Update Ruff to v0.0.247 ( #88210 )
...
* Update Ruff to v0.0.247
* Fix new found violations
2023-02-15 16:46:03 -05:00
epenet
80ee196fd8
Add type hints to integration tests (part 19) ( #88178 )
2023-02-15 18:07:40 +01:00
Gertjan
66ba0cb1d3
Fixed float number validation in sensor component ( #88074 )
2023-02-15 15:53:44 +01:00
Franck Nijhof
ed79265843
Enable Ruff PT006 ( #88165 )
...
* Enable Ruff PT006
* Adjust existing cases
* Fix tests
* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Erik Montnemery
4ca0a24f87
Increase test scope of MariaDB + PostgreSQL tests ( #87019 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-13 15:58:13 -06:00
Erik Montnemery
8f2a764a43
Adjust suggested_display_precision according to unit conversion ( #87614 )
2023-02-13 13:55:12 +01:00
Erik Montnemery
3f910b49ae
Fix sensor unit conversion ( #87978 )
2023-02-13 10:08:07 +01:00
J. Nick Koston
85649ec589
Reduce overhead to see if an entity is recorded ( #87912 )
...
A significant chunk of list_statistic_ids was checking if the entity
was recorded because it had to get the recorder instance over and
over
2023-02-11 23:21:16 -05:00
J. Nick Koston
c35661947a
Optimize fetching statistics by avoiding timestamp conversions ( #87845 )
...
* Optimize fetching statistics by avoiding timestamp conversions
* remove accidential unrelated change
* fix test
* recreate so we handle timezone changes
2023-02-10 11:26:46 -05:00
Erik Montnemery
cc564026fa
Move EntityCategory to homeassistant.const ( #87792 )
...
* Move EntityCategory to homeassistant.const
* Fix more imports
2023-02-09 20:15:37 +01:00
Franck Nijhof
51a9f65a01
Clean up unnecessary registry mocks from Core tests ( #87726 )
2023-02-08 13:28:44 -06:00
epenet
4142f0d15d
Add return type to tests without arguments ( #87613 )
...
* Add return type to tests without arguments
* Black
* Cancel fixture amends
2023-02-07 14:20:06 +01:00
Erik Montnemery
bcc1aa03b4
Move sensor rounding to frontend ( #87330 )
...
* Move sensor rounding to frontend
* Update integrations
* Add comment
2023-02-04 14:54:36 -05:00
Franck Nijhof
bf482eee24
Extend state class sensor warnings with expected values ( #87294 )
2023-02-04 11:49:24 +01:00
Erik Montnemery
4d4fb2477d
Optionally update sensor units when unit system is changed ( #83851 )
2023-02-03 16:30:50 +01:00
epenet
810367b757
Fix `can not` typo ( #87254 )
2023-02-03 11:37:16 +01:00
epenet
cc469ab9a9
Add unit conversion to Power sensors ( #87136 )
...
* Add missing PowerConverter to UNIT_CONVERTERS
* Adjust tests
2023-02-02 10:27:12 +01:00
Jan Bouwhuis
2e16b7e2df
Add numeric_state_expected property to Sensor class ( #87013 )
...
* Add is_numeric property to Sensor class
* Follw up comment
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Tests and corrections
* Simplify converion check
* Correct custom device class handling
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* rename to numeric_state_expected
* Replace with new const
* Adjust docstr
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
* Move to const
* Correct logic
* Do not use bool
* Adjust docstr must be numeric
* remote state from docstr
* protect numeric_state_expected
* Use try_parse_enum for custom class check
* Remove redundant type hints
---------
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-02-01 18:45:13 +01:00
Erik Montnemery
d4489faa68
Drop minus sign on negative zero ( #86939 )
...
* Drop minus sign on negative zero
* Add tests
2023-01-30 08:31:27 -05:00
J. Nick Koston
c612a92cfb
Use python defaults for comparing State, LazyState, and Event objects ( #86856 )
...
* Speed up comparing State and Event objects
Use default python implementation for State and Event __hash__ and __eq__
The default implementation compared based on the id() of the object
which is effectively what we want here anyways. These overrides are
left over from the days when these used to be attrs objects
By avoiding implementing these ourselves all of the equality checks
can happen in native code
* tweak
* adjust tests
* write out some more
* fix test to not compare objects
* more test fixes
* more test fixes
* correct stats tests
* fix more tests
* fix more tests
* update sensor recorder tests
2023-01-29 13:31:43 -05:00
Franck Nijhof
e4a78420b8
Enable Ruff PT013 ( #86757 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-01-27 09:09:46 +01:00
Joakim Plate
1b97a51b5e
Print expected device class units in error log ( #86125 )
2023-01-25 20:45:50 +01:00
Erik Montnemery
086a6460ef
Allow customizing sensor state precision ( #86074 )
...
* Allow customizing sensor precision
* Don't convert integer strings to floats
* Tweak converting sensor state to number
* Drop default rounding to 2 decimals
* Adjust test
* Tweak rounding, improve test coverage
* Don't convert to a number if not necessary
* Raise if native_precision is set and state is not numeric
* Address review comments
* Address comments, simplify
* Don't call property twice
* Make exception more helpful
2023-01-25 08:55:46 +01:00
epenet
30bf0634fe
Add per-file-ignore to pylint ( #86289 )
2023-01-22 17:26:24 +01:00
Franck Nijhof
0a367359f4
Add sensor state class validation for device classes ( #84402 )
...
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-01-16 14:31:24 +01:00
epenet
3179101fbc
Warn if numeric sensors have an invalid value ( #85863 )
...
Co-authored-by: mib1185 <mail@mib85.de>
2023-01-16 11:00:07 +01:00
Michael
9709391b52
Replace the usage of unit constants by enumerations in Tests [s-u] ( #85937 )
2023-01-16 09:00:27 +01:00
Erik Montnemery
e4e96d3394
Fix sensor test ( #85740 )
2023-01-12 12:21:19 +01:00
Erik Montnemery
305fb86d50
Add WS command sensor/device_class_convertible_units ( #85213 )
...
* Add WS command sensor/device_class_units
* Rename new command to device_class_convertible_units
2023-01-12 09:31:06 +01:00
Erik Montnemery
b0d4b73874
Add unitless unit converter ( #85694 )
...
* Add unitless unit converter
* Adjust type hints
* Adjust tests
* Rename to UnitlessRatioConverter
2023-01-12 09:20:00 +01:00
epenet
9eb06fd59d
Simplify sensor state validation ( #85513 )
2023-01-10 11:52:29 +01:00
Erik Montnemery
72c9ca2567
Update sensor test ( #85522 )
2023-01-09 14:26:52 +01:00
Franck Nijhof
f8fa676ac8
Do not validate device classes when entity state is unknown ( #84860 )
2022-12-30 13:07:49 -05:00
Franck Nijhof
c832982d94
Add sensor unit of measurement validation for device classes ( #84366 )
2022-12-21 16:14:11 +01:00
epenet
f4c13645d2
Add support for CCF volume unit ( #84029 )
2022-12-19 14:57:04 +01:00
epenet
0c9a78fb8e
Use tuple in test parametrization ( #83379 )
2022-12-06 09:46:10 +01:00
Franck Nijhof
762eb57636
Validate state class and unit of measurement for non-numeric sensors ( #83344 )
...
* Validate state class and unit of measurement for non-numeric sensors
* Remove duration
* Fix rest tests
2022-12-06 00:07:02 +01:00
Erik Montnemery
67875b99a3
Refactor support for integrations to drop custom unit conversion ( #83228 )
...
* Refactor support for integrations to drop custom unit conversion
* Fix lying comment
* Address review comment
2022-12-05 16:12:37 +01:00
Franck Nijhof
ce00f093d6
Add enum device_class and state options property to sensor entities ( #82489 )
2022-12-02 09:11:15 +01:00
Erik Montnemery
a038314d8b
Add display unit to WS recorder/get_statistics_metadata ( #82870 )
2022-11-28 13:46:57 -05:00
Erik Montnemery
b6586d5c34
Align number and sensor device classes ( #81909 )
...
* Align number and sensor device classes
* Add tests
* Tweak tests
2022-11-17 14:00:28 +01:00
Erik Montnemery
607a0e7697
Reduce size of get_statistics_during_period WS API response ( #82131 )
2022-11-16 17:36:30 +01:00
Erik Montnemery
7aa4654eb4
Improve docstring for sensor testcase ( #81875 )
2022-11-09 23:59:58 +01:00