From 2104b36172e0670d44ffe00449ada55acf29e77c Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 4 Apr 2022 13:22:46 +0200 Subject: [PATCH] Add config flow for Utility Meter (#22180) Co-authored-by: Erik Montnemery --- source/_integrations/utility_meter.markdown | 42 +++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/source/_integrations/utility_meter.markdown b/source/_integrations/utility_meter.markdown index bd788fa70c2..76236ddbe7b 100644 --- a/source/_integrations/utility_meter.markdown +++ b/source/_integrations/utility_meter.markdown @@ -6,6 +6,7 @@ ha_category: ha_release: 0.87 ha_iot_class: Local Push ha_quality_scale: internal +ha_config_flow: true ha_codeowners: - '@dgomes' ha_domain: utility_meter @@ -13,7 +14,7 @@ ha_platforms: - sensor --- -The `utility meter` integration provides functionality to track consumptions of various utilities (e.g., energy, gas, water, heating). +The Utility Meter integration provides functionality to track consumptions of various utilities (e.g., energy, gas, water, heating). From a user perspective, utility meters operate in cycles (usually monthly) for billing purposes. This sensor will track a source sensor values, automatically resetting the meter based on the configured cycle. On reset an attribute will store the previous meter value, providing the means for comparison operations (e.g., "did I spend more or less this month?") or billing estimation (e.g., through a sensor template that multiplies the metered value per the charged unit amount). @@ -23,9 +24,44 @@ Some utility providers have different tariffs according to time/resource availab Sensors created with this integration are persistent, so values are retained across restarts of Home Assistant. The first cycle for each sensor will be incomplete; a sensor tracking daily usage will start to be accurate the next day after the integration was activated. A sensor tracking monthly usage will present accurate data starting the first of the next month after being added to Home Assistant. -## Configuration +{% include integrations/config_flow.md %} +{% configuration_basic %} +Name: + description: The name the sensor should have. It can be changed again later. +Input sensor: + description: The sensor entity providing utility readings (energy, water, gas, heating). +Meter reset cycle: + description: > + How often to reset the counter. If the offered reset cycles do not match + your use case, consider using the YAML configuration below, which allows + for creating CRON-style patterns. +Meter reset offset: + description: > + Cycle reset occur at the beginning of the period. This option enables + the offsetting of these beginnings, counted in days. If you need a more + fine-grained offset, consider using the YAML configuration below, which + allows for that. +Supported tariffs: + description: > + A list of supported tariffs, leave empty if only a single tariff is needed. +Net consumption: + description: > + Enable this if you would like to treat the source as a net meter. + This will allow your counter to go both positive and negative. +Delta values: + description: > + Enable this if the source values are delta values since the last reading instead of absolute values. When this option is enabled, each new value received will be added as-is to the utility meter instead of adding the _difference_ between the new value and previous value. +{% endconfiguration_basic %} -To enable the Utility Meter Sensor in your installation, add the following to your `configuration.yaml` file: +If the meter reset cycle and reset offsets are to limited for your use case, +consider using the YAML configuration below, which support CRON-style patterns +that provide a greater flexibility. + +## YAML Configuration + +Alternatively, 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