Add config flow for Derivative (#22063)

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Franck Nijhof 2022-03-21 13:56:24 +01:00 committed by GitHub
parent 603967c2da
commit aac0a11527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,16 +12,35 @@ ha_qa_scale: internal
ha_codeowners:
- '@afaucogney'
ha_domain: derivative
ha_config_flow: true
ha_platforms:
- sensor
---
The `derivative` platform creates a sensor that estimates the derivative of the values provided by a source sensor.
Derivative sensors are updated upon changes of the **source**.
The derivative integration creates a sensor that estimates the derivative of the
values provided by another sensor (the **source sensor**). Derivative sensors are updated upon changes of the **source sensor**.
## Configuration
{% include integrations/config_flow.md %}
{% configuration_basic %}
Name:
description: The name the sensor should have. You can change it again later.
Input sensor:
description: The entity providing numeric readings to create the derivative of.
Precision:
description: Round the calculated integration value to at most N decimal places.
Time window:
description: The time window in which to calculate the derivative. Derivatives in this window will be averaged with a simple moving average algorithm (SMA) weighted by time. This is for instance useful for a sensor that outputs discrete values, or to filter out short duration noise. By default the derivative is calculated between two consecutive updates without any smoothing.
Metric Prefix:
description: Metric unit to prefix the derivative result ([Wikipedia](https://en.wikipedia.org/wiki/Unit_prefix)).
Time unit:
description: SI unit of time of the derivative. If this parameter is set, the unit of measurement will be set to **x/y** where **x** is the unit of the source sensor and **y** is the value of this parameter.
{% endconfiguration_basic %}
To enable Derivative Sensor in your installation, add the following to your `configuration.yaml` file:
## YAML Configuration
Alternatlively, this integration can be configured and set up manually via YAML
instead. To enable the Integration sensor in your installation, add the
following to your `configuration.yaml` file:
```yaml
# Example configuration.yaml entry
@ -72,7 +91,7 @@ For example, you have a temperature sensor `sensor.temperature` that outputs a v
That means that two consecutive output values might be the same (so the derivative is `Δy/Δx=0` because `Δy=0` !)
However, the temperature might actually be changing over time.
In order to capture this, you should use a `time_window`, such that immediate jumps don't result in high derivatives and that after the next sensor update, the derivatives doesn't vanish to zero.
An example configuration that uses `time_window` is
An example YAML configuration that uses `time_window` is
```yaml
sensor: