From f29acc003f7c82a631ea5a858b40b77d9dd5f453 Mon Sep 17 00:00:00 2001 From: Klaas Schoute Date: Wed, 13 Mar 2024 16:51:18 +0100 Subject: [PATCH] Update the FAQ for using the filter from pulse_meter (#418) * Update the FAQ for using the filter from pulse_meter * Remove double quotes --- docs/docs/faq/faq_nr2.md | 43 ++++++++++++++++++++++++---------------- docs/docs/faq/faq_nr7.md | 9 +++++---- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/docs/docs/faq/faq_nr2.md b/docs/docs/faq/faq_nr2.md index 9b3b3638..147e0017 100644 --- a/docs/docs/faq/faq_nr2.md +++ b/docs/docs/faq/faq_nr2.md @@ -4,32 +4,41 @@ title: Reduce amount of sensor data description: How to reduce the amount of sensor data --- -Depending on the configured **pulse rate**, the type of house/apartment and the heating system in use, the sensors that are exposed to Home Assistant may produce a lot of data. For example, with the default **pulse rate** of `1000`, a power consumption of 3600 W means that the sensors produce 2 HA state changes per second (which means 7200 state changes per hour). If you don't need that kind of granularity, you can use [ESPHome sensor filters](https://esphome.io/components/sensor/index.html#sensor-filters) to reduce the rate of updates written to Home Assistant. With the commented-out filters in the [home_assistant_glow.yaml][file] enabled, only 396 state changes will be produced per hour. +Depending on the configured **pulse rate**, the type of house/apartment and the heating system in use, the sensors that are exposed to Home Assistant may produce a lot of data. For example, with the default **pulse rate** of `1000`, a power consumption of 3600 W means that the sensors produce 2 HA state changes per second (which means 7200 state changes per hour). + +If you don't need that kind of granularity, you can use [ESPHome sensor filters][filters] to reduce the rate of updates written to Home Assistant. With the commented-out filters in the [pulse_meter.yaml][file] enabled, only 396 state changes will be produced per hour. You can read more about making YAML adjustments on the [customizing the Firmware](/docs/advanced/firmware_customization.mdx) page. ### Pulse meter - power sensor ```yaml title="components/pulse_meter.yaml" -filters: - # multiply value = (60 / imp value) * 1000 - # - multiply: 60 - - lambda: return x * ((60.0 / id(select_pulse_rate).state) * 1000.0); - - # Update the sensor with an average every 10th second. See - - throttle_average: 10s - - filter_out: NaN +sensor: + - platform: pulse_meter + # ... + filters: + # multiply value = (60 / imp value) * 1000 + # - multiply: 60 + - lambda: return x * ((60.0 / id(select_pulse_rate).state) * 1000.0); + + # Update the sensor with an average every 10th second. See + - throttle_average: 10s + - filter_out: NaN ``` ### Pulse meter - total energy sensor ```yaml title="components/pulse_meter.yaml" -filters: - # multiply value = 1 / imp value - # - multiply: 0.001 - - lambda: return x * (1.0 / id(select_pulse_rate).state); - - # Update the sensor once per 0.1 kWh consumed, or every 5th minute, whichever happens sooner. - - delta: 0.01 - - heartbeat: 300s +sensor: + - platform: total_daily_energy + # ... + filters: + # multiply value = 1 / imp value + # - multiply: 0.001 + - lambda: return x * (1.0 / id(select_pulse_rate).state); + + # Update the sensor once per 0.1 kWh consumed, or every 5th minute, whichever happens sooner. + - delta: 0.01 + - heartbeat: 300s ``` +[filters]: https://esphome.io/components/sensor/index.html#sensor-filters [file]: https://github.com/klaasnicolaas/home-assistant-glow/blob/main/components/pulse_meter.yaml#L73 \ No newline at end of file diff --git a/docs/docs/faq/faq_nr7.md b/docs/docs/faq/faq_nr7.md index 4a4745e2..01357ebe 100644 --- a/docs/docs/faq/faq_nr7.md +++ b/docs/docs/faq/faq_nr7.md @@ -12,10 +12,11 @@ If you have a solar system, and the consumption remains zero for some time and t In your ESP config file, use the `left` [calculation method][method] instead of the default (`right`): -```yaml -- platform: total_daily_energy - # ... - method: left +```yaml title="components/pulse_meter.yaml" +sensor: + - platform: total_daily_energy + # ... + method: left ``` [method]: https://esphome.io/components/sensor/total_daily_energy.html