From f00c1865519004aef7570bcf60f48430b4999c92 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 18 Mar 2022 11:41:02 +0100 Subject: [PATCH] Add config flow for integration sensor (#22060) Co-authored-by: Erik Montnemery --- source/_integrations/integration.markdown | 37 ++++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/source/_integrations/integration.markdown b/source/_integrations/integration.markdown index b9ea8adcd79..bd88948bfff 100644 --- a/source/_integrations/integration.markdown +++ b/source/_integrations/integration.markdown @@ -11,15 +11,42 @@ ha_quality_scale: internal ha_codeowners: - '@dgomes' ha_domain: integration +ha_config_flow: true ha_platforms: - sensor --- -The `integration` platform provides the [Riemann sum](https://en.wikipedia.org/wiki/Riemann_sum) of the values provided by a source sensor. The Riemann sum is an approximation of an **integral** by a finite sum. The integration sensors is updated upon changes of the **source**. Fast sampling source sensors provide better results. In this implementation, the default is the Trapezoidal method, but Left and Right methods can optionally be used. +This integrations provides the [Riemann sum](https://en.wikipedia.org/wiki/Riemann_sum) +of the values provided by a source sensor. The Riemann sum is an approximation +of an **integral** by a finite sum. -## Configuration +The integration sensors are updated upon changes of the **source**. Fast +sampling source sensors provide more accurate results. In this implementation, the +default is the Trapezoidal method, but Left and Right methods can optionally +be used. -To enable Integration Sensor in your installation, add the following to your `configuration.yaml` file: +{% 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 integrate. +Integral method: + description: Riemann sum method to be used. +Precision: + description: Round the calculated integration value to at most N decimal places. +Metric prefix: + description: Metric unit to prefix the integration result. +Integration time: + description: SI unit of time to integrate over. +{% endconfiguration_basic %} + + +## YAML Configuration + +Alternatlively, this integration can be configured and set up manually via YAML +as well. To enable the Integration sensor in your installation, add the +following to your `configuration.yaml` file: ```yaml # Example configuration.yaml entry @@ -66,9 +93,9 @@ The unit of `source` together with `unit_prefix` and `unit_time` is used to gene ## Energy -An `integration` sensor is quite useful in energy billing scenarios since energy is generally billed in kWh and many sensors provide power in W (Watts). +An integration sensor is quite useful in energy billing scenarios since energy is generally billed in kWh and many sensors provide power in W (Watts). -If you have a sensor that provides you with power readings in Watts (uses W as `unit_of_measurement`), then you can use the `integration` sensor to track how much energy is being spent. Take the next configuration as an example: +If you have a sensor that provides you with power readings in Watts (uses W as `unit_of_measurement`), then you can use the `integration` sensor to track how much energy is being spent. Take the next manual YAML configuration as an example: ```yaml sensor: