Commit Graph
59 Commits
Author SHA1 Message Date
Artur PragaczandGitHub 6c38a774cb Do not set a device on YAML derivative entities (#177595) 2026-07-30 08:48:44 +02:00
Erik MontnemeryandGitHub 1d885bd073 Restrict device registry entries to a single config entry and subentry (#175785) 2026-07-16 22:10:10 +02:00
Franck NijhofandGitHub 87b151a436 Fix line length violations in tests/components d-f (#170881) 2026-05-16 21:17:51 +02:00
karwostsandGitHub 2f3a6243f7 Restore state_class to derivative sensor (#163557) 2026-04-28 09:09:21 +02:00
karwostsandGitHub 9f551f3d5b Improve derivative units and auto-device_class (#157369) 2026-02-17 08:08:59 -08:00
epenetandGitHub 336ef4c37b Remove outdated device registry cleanup in derivative (#161858) 2026-01-29 13:55:49 +01:00
b27b357b91 Add hot reload for derivative (#156898)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2025-11-22 20:23:29 +01:00
karwostsandGitHub 263839a6c0 Add unique_id for derivative (#157055) 2025-11-22 19:25:46 +01:00
d0cad43a6c Recalculate derivative unit correctly when source or options change (#147527)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-10-15 18:17:41 +02:00
karwostsandGitHub a3dec46d59 Add derivative tests exhibiting unit issues (#153051) 2025-10-14 15:58:14 +02:00
karwostsandGitHub 770f41d079 Diagnostics for derivative sensor (#152445) 2025-09-16 14:24:05 -04:00
Joost LekkerkerkerandGitHub e3c0cfd1e2 Enable RUF059 and fix violations (#152071) 2025-09-10 21:16:09 +02:00
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
Erik MontnemeryandGitHub 3bd70a4698 Improve derivative sensor tests (#149179) 2025-07-21 17:51:26 +02:00
Erik MontnemeryandGitHub ee35fc495d Improve derivative sensor tests (#148941) 2025-07-17 11:44:37 +02:00
155fc134b6 Do not add derivative config entry to source device (#148674)
Co-authored-by: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com>
2025-07-14 13:33:00 +02:00
karwostsandGitHub 26d71fcdba Fix derivative migration from 'none' unit_prefix (#147820) 2025-07-14 08:17:20 +02:00
karwostsandGitHub 22e46d9977 Make derivative sensor unavailable when source sensor is unavailable (#147468) 2025-07-04 22:48:48 +02:00
39c431c55c Add 'max_sub_interval' option to derivative sensor (#125870)
* Add 'max_sub_interval' option to derivative sensor

* add strings

* little coverage

* improve test accuracy

* reimplement at dev head

* string

* handle unavailable

* simplify

* Add self to codeowner

* fix on remove

* Update homeassistant/components/derivative/sensor.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Fix parenthesis

* sort strings

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2025-06-24 15:05:28 +02:00
2afdec4711 Do not remove derivative config entry when input sensor is removed (#146506)
* Do not remove derivative config entry when input sensor is removed

* Add comments

* Update homeassistant/helpers/helper_integration.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-06-11 11:19:44 +02:00
Erik MontnemeryandGitHub 16a0b7f44e Handle changes to source entity in derivative helper (#146407)
* Handle changes to source entity in derivative helper

* Rename helper function, improve docstring

* Add tests

* Improve derivative tests

* Deduplicate tests

* Rename helpers/helper_entity.py to helpers/helper_integration.py

* Rename tests
2025-06-10 14:31:18 +02:00
epenetandGitHub a3605921c9 De-duplicate test helper function (#143437)
* De-duplicate test helper function

* One more
2025-04-22 12:04:12 +02:00
Juan GrandeandGitHub 8e7960fa0e Fix bug in derivative sensor when source sensor's state is constant (#139230)
Previously, when the source sensor's state remains constant, the derivative
sensor repeats its latest value indefinitely.

This patch fixes this bug by consuming the state_reported event and updating
the sensor's output even when the source sensor doesn't change its state.
2025-03-01 09:10:35 +01:00
epenetandGitHub 7b1b229718 Standardize homeassistant imports in component tests (a-l) (#136806) 2025-01-29 10:00:45 +01:00
G JohanssonandGitHub 6ff2ce1895 Use shorthand attribute in derivative sensor (#128610) 2024-10-18 09:33:02 +02:00
156a88a3a3 Ignore negative derivative when the input is total_increasing (#119141)
* if the derivative is negative, ignore it

* add option to ignore the negatives or not

* add tests for a new ignore negative derivative

* add missing description when editing

* rename to ignore_negative_derivative
to increase clarity of which negative I mean
in case in the future we want a ignore_negative_value...

* use state_class=total_increasing to ignore the negative derivative

* remove ignore negative from the config

* add test for total_increasing_reset case

* add comments

* update test_total_increasing_reset with history tests
Also remove the last comment because the test is already clear
My existing comment there isn't unique to this unit test but applies to the entire component. The existing web documentation pointing to Wikipedia should suffice.

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-09-16 10:49:15 +02:00
epenetandGitHub 7d326ff076 Add missing hass type hint in component tests (d) (#124074) 2024-08-18 18:57:29 +02:00
dougiteixeiraandGitHub 02f0050819 Update test_device_cleaning in Derivative (#120162) 2024-06-22 15:54:35 +02:00
dougiteixeiraandGitHub 89b7bf2108 Add the ability to change the source entity of the Derivative helper (#119754) 2024-06-22 15:03:43 +02:00
epenetandGitHub 3d1165519d Fix broad-exception-raised in component tests (#119467) 2024-06-12 17:53:42 +02:00
SidandGitHub 3799d20d43 Enable Ruff B905 (#114197) 2024-04-14 00:14:26 -05:00
Joost LekkerkerkerandGitHub 9b41e3d124 Use is in enum comparison in config flow tests A-E (#114669) 2024-04-02 11:22:05 -10:00
00ec7f11f0 Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
SidandGitHub ccd2e989c3 Enable ruff RUF005 and fix occurrences (#113589) 2024-03-16 07:37:20 -10:00
Marc MuellerandGitHub 32f3f46542 Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc MuellerandGitHub 38adfbf1a3 Add empty line after module docstring [tests a-e] (#112708) 2024-03-08 08:50:25 -05:00
Jan-Philipp BeneckeandGitHub 81450f0117 Update d-e* tests to use entity & device registry fixtures (#103804) 2023-11-12 10:38:32 +01:00
Robert ReschandGitHub 7db2fdd68c Remove "none" in favor of optional select in derivate (#101312) 2023-10-11 17:36:15 +02:00
Erik MontnemeryandGitHub 57d0fd7bb1 Adjust derivative tests which create devices (#98186) 2023-08-10 18:25:28 +02:00
dougiteixeiraandGitHub 11146ff40b Fix device source for Derivative (#95621)
Fix Device Source
2023-06-30 14:29:44 -04:00
dougiteixeiraandGitHub 403496eb92 Add the device of the source entity in the helper entities for Derivative (#94751)
* Adds the device of the original entity in the helper entities for Derivative

* Update

* Update
2023-06-26 18:06:25 +02:00
J. Nick KostonandGitHub cff72f9653 Update derivative tests to avoid patching utcnow (#93477) 2023-05-24 20:54:50 +02:00
Erik MontnemeryandGitHub 9ab95b6348 Revert "Add state_class = MEASUREMENT to Derivative sensor (#88408)" (#88952) 2023-03-01 08:53:05 +01:00
Carlos Gustavo SarmientoandGitHub fa2e7aa592 Add state_class = MEASUREMENT to Derivative sensor (#88408)
* Add `state_class = MEASUREMENT` to Derivative sensor

One line change per title.

* Update sensor.py

* Update tests for Derivative Sensor
2023-02-20 21:57:58 +01:00
Franck NijhofandGitHub 9030ca05b1 Enable Ruff SIM118 (#87772) 2023-02-15 12:39:12 +01:00
epenetandGitHub 3052de3e8e Add type hints to integration tests (d-e) (#87699) 2023-02-08 13:01:44 +01:00
MichaelandGitHub 2850583085 Replace the usage of unit constants by enumerations in Tests [a-e] (#85932) 2023-01-15 14:44:01 +01:00
Franck NijhofandGitHub a6244eea28 Search/replace RESULT_TYPE_* by FlowResultType enum (#74656) 2022-07-07 21:28:18 +02:00
Erik MontnemeryandGitHub 5bb271c9fb Add config flow for derivative sensor (#68268) 2022-03-18 12:14:38 +01:00
sophofandGitHub 79d267f8d7 Fix derivative integration showing unexpected spikes (#65528) 2022-02-23 10:16:12 -08:00