Commit Graph

732 Commits

Author SHA1 Message Date
krahabb
afeaf2409f Add TEMPERATURE_DELTA device class to Number and Sensor entities (#147358) 2025-10-15 11:49:12 +02:00
Domochip
8464dad8e0 Add milliPascal (mPa) as unit of measurement for Pressure (#153087) 2025-10-14 12:38:14 +01:00
Erik Montnemery
fbf875b5af Deprecate has_mean in favor of mean_type in recorder statistic API (#154093) 2025-10-14 13:34:25 +02:00
Marc Mueller
1e5f5f4ad3 Enable pylint consider-math-not-float check (#154338) 2025-10-13 21:14:57 +02:00
Erik Montnemery
a3b67d5f28 Add support to sensor statistics for changing unit_class (#154130) 2025-10-13 12:35:10 +01:00
epenet
b25622f40e Use SI constants in CO unit converter (#153187) 2025-10-10 14:59:20 +02:00
Erik Montnemery
ee67619cb1 Add mg/m³ as a valid UOM for sensor/number Carbon Monoxide device class (#154074)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-10-10 11:31:31 +01:00
Erik Montnemery
951978e483 Include unit class in units_changed statistics issue (#154069) 2025-10-10 10:50:40 +03:00
Erik Montnemery
d45114cd11 Improve unit handling in recorder (#153941) 2025-10-09 10:29:42 +02:00
Dave T
1a0abe296c Remove deprecated conductivity constants (#153942) 2025-10-07 23:20:36 +01:00
Erik Montnemery
1cd1b1aba8 Remove to_native method from recorder database schemas (#153334) 2025-10-01 21:25:05 +02:00
Erik Montnemery
7f63ba2087 Improve saved state of RestoreSensor when using freezegun (#152740) 2025-09-30 18:27:56 +02:00
Erik Montnemery
5975cd6e09 Revert "Add mg/m³ as a valid UOM for sensor/number Carbon Monoxide device class" (#153196) 2025-09-29 15:43:13 +01:00
Abílio Costa
b26b1df143 Fix unitless converter missing valid units (#152665) 2025-09-22 15:19:31 +01:00
Simon Roberts
ec148e0459 Add PM4 (particulates < 4μm) sensor and number device classes (#112867)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-09-19 08:12:09 -06:00
Jan Bouwhuis
5eef6edded Add mg/m³ as a valid UOM for sensor/number Carbon Monoxide device class (#152456) 2025-09-17 22:04:23 +01:00
Alessandro Manighetti
eb4a873c43 Add m/min of speed sensors (#146441) 2025-09-16 18:02:22 +02:00
Bram Gerritsen
a3a4433d62 Add missing unit conversion for BTU/h (#152300) 2025-09-14 19:00:44 +02:00
ekobres
4c22264b13 Add support for inH₂O pressure unit (#148289)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-09-12 11:24:45 +02:00
Joost Lekkerkerker
e3c0cfd1e2 Enable RUF059 and fix violations (#152071) 2025-09-10 21:16:09 +02:00
epenet
56c865dcfe Fix _is_valid_suggested_unit in sensor platform (#151912) 2025-09-08 16:35:33 +02:00
Mike Kelly
1cca65b5c5 Add MCF (1000 Cubic Feet) as an alternate unit of measure for volume (#150015) 2025-09-04 09:29:37 +03:00
Jan Bouwhuis
48300f4563 Use greek small letter mu "\u03bc" instead of micro sign "\u00B5" for micro unit prefix (alt 1) (#144853)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-08-19 18:48:50 +02:00
Matthias Alphart
63640af4d4 Update voluptuous-serialize to 2.7.0 (#150822) 2025-08-19 16:42:49 +02:00
Ludovic BOUÉ
cc4b9e0eca Extend UnitOfReactivePower with 'mvar' (#150415) 2025-08-14 11:46:06 +02:00
Ludovic BOUÉ
eb4b75a9a7 Extend UnitOfApparentPower with 'mVA' (#150422)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-08-13 15:56:04 +02:00
Michael
50047f0a4e Add new device class for absolute humidity (#148567) 2025-07-14 11:46:17 +02:00
Abílio Costa
0cce4d1b81 Test all device classes in Sensor device condition/trigger tests (#146366) 2025-06-09 14:22:58 +01:00
epenet
de4a5fa30b Remove unnecessary DOMAIN alias in tests (s-z) (#146010) 2025-06-02 08:48:37 +02:00
epenet
c3ade400fb Use Platform constant in tests (#145801)
* Use Platform constant in tests

* spelling

* Fix platform
2025-05-28 15:51:37 +02:00
Abílio Costa
b626204f63 Add default device class display precision for Sensor (#145013)
* Add default device class display precision for Sensor

* Renaming, docstrings, cleanup

* Simplify units list

* Fix tests

* Fix missing precision when suggested is specified

* Update snapshots

* Fix when unit of measurement is not valid

* Fix tests

* Fix deprecated unit usage

* Fix goalzero tests

The sensor native_value method was accessing the data dict and trowing,
since the mock did not have any data for the sensors.

Since now the precision is always specified (it was missing for those
sensors), the throw was hitting async_update_entity_options in _update_suggested_precision.
Previously, async_update_entity_options was not called since it had no
precision.

* Fix metoffice

* Fix smartthings

* Add default sensor data for Tesla Wall Connector tests

* Update snapshots

* Revert spaces

* Update smartthings snapshots

* Add missing sensor mock for tesla wall connector

* Address review comments

* Add doc comment

* Add cap to doc comment

* Update comment

* Update snapshots

* Update comment
2025-05-26 19:40:29 +02:00
Abílio Costa
54dce53628 Add sensor tests for device class enums (#145523) 2025-05-26 14:28:30 +01:00
alorente
1d47dc41c9 Add reactive energy device class and units (#143941) 2025-05-15 12:05:46 +01:00
Robert Resch
64e1735647 Fix circular mean by always storing and using the weighted one (#142208)
* Fix circular mean by always storing and using the weighted one

* fix

* Fix test
2025-04-04 21:19:15 +02:00
Robert Resch
f842640249 Add check that sensor state classes are used only with valid unit of measurements (#141444) 2025-03-26 13:52:00 +01:00
Robert Resch
e3f2f30395 Add circular mean statistics and sensor state class MEASUREMENT_ANGLE (#138453)
* Add circular mean statistics

* fixes

* Add has_circular_mean and fix tests

* Fix mypy

* Rename to MEASUREMENT_ANGLE

* Fix kitchen_sink tests

* Fix sensor tests

* for testing only

* Revert ws command change

* Apply suggestions

* test only

* add custom handling for postgres

* fix recursion limit

* Check if column is already available

* Set default false and not nullable for has_circular_mean

* Proper fix to be backwards compatible

* Fix value is None

* Align with schema

* Remove has_circular_mean from test schemas as it's not required anymore

* fix wrong column type

* Use correct variable to reduce stats

* Add guard that the uom is matching a valid one from the state class

* Add some tests

* Fix tests again

* Use mean_type in StatisticsMetato difference between different mean type algorithms

* Fix leftovers

* Fix kitchen_sink tests

* Fix postgres

* Add circular mean test

* Add mean_type_changed stats issue

* Align the attributes with unit_changed

* Fix mean_type_change stats issue

* Add missing sensor recorder tests

* Add test_statistic_during_period_circular_mean

* Add mean_weight

* Add test_statistic_during_period_hole_circular_mean

* Use seperate migration step to null has_mean

* Typo ARITHMETIC

* Implement requested changes

* Implement requested changes

* Split into #141444

* Add StatisticMeanType.NONE and forbid that mean_type can be None

* Fix mean_type

* Implement requested changes

* Small leftover of latest StatisticMeanType changes
2025-03-26 13:15:58 +01:00
Robert Resch
65c05d66c0 Use a constant for sensor statistics issues (#141441) 2025-03-26 09:43:09 +01:00
Erik Montnemery
427aa55789 Correct fallback to state in state machine when processing statistics (#140396) 2025-03-13 09:28:15 +01:00
Erik Montnemery
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 Montnemery
428cc1a951 Update signature of platforms' async_setup_entry in tests (#138271) 2025-02-11 13:17:39 +01:00
epenet
0e263aa427 Standardize homeassistant imports in full-CI tests (#136735) 2025-01-28 13:10:20 -05:00
Marc Mueller
f822fd82bb Fix recorder fixture typing (#136174) 2025-01-21 18:18:05 -10:00
Joost Lekkerkerker
53ad02a1eb Enable RUF032 (#135836) 2025-01-20 08:05:33 +01:00
Joost Lekkerkerker
8a35261fd8 Remove unused noqas (#135583) 2025-01-15 10:02:18 +01:00
G Johansson
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 Agner
962f1bad32 Add mW as unit of measurement for Matter electrical power sensors (#133504) 2024-12-19 11:40:05 +00:00
Abílio Costa
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 Resch
1f9ecfe839 Remove deprecated sensor constants (#131843) 2024-11-28 20:49:49 +01:00
Robert Resch
a67045ee6c Remove deprecated home assistant const constants (#131799) 2024-11-28 12:12:37 +01:00
Abílio Costa
e4e9d76b45 Raise error if sensor has translated and hardcoded unit (#131657) 2024-11-27 17:45:53 +01:00