8000 Use time-based filters and add on_update trigger to make the default config work for all hardware revisions by kahrendt · Pull Request #200 · emporia-vue-local/esphome · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use time-based filters and add on_update trigger to make the default config work for all hardware revisions #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 3, 2023

Conversation

kahrendt
Copy link
Contributor
@kahrendt kahrendt commented Sep 2, 2023

This PR adds two things to improve the configuration for all hardware revisions:

  • Modifies the default configuration to use time based filters and improving the accuracy of total daily energy sensors as well as balance and power sensors
    • Using a throttle_average filter let's us specify a time to average over compared to the sliding window average that depends on knowing the update frequency, so it doesn't matter which revision Emporia Vue you have
    • The raw power measurements are left as internal sensors with no throttle
      • The total daily energy sensors use these internal sensors, and should accurately capture very fast changes in the power measurements
        • Apply a time based throttle filter to the energy sensors so as to not publish updates too frequently; this sends the most recent value after the specified time has passed since last publishing
      • Copy sensors publish the raw internal sensors and filter them with throttle_average
      • The template total power and balance power sensors use the raw internal sensors as their source; this should improve accuracy as we are not averaging averages
        • throttle_average filter is applied after combining the internal sensors to reduce publishing rates
    • Adam Jaques wrote a great blog post that motivated using these filters with copy sensors to improve accuracy
  • Add an on_update automation trigger to the component that is called after all sensors have updated, improving total/balance power accuracy
    • The template total and balance power sensors now have an update_interval of never, and they are instead updated only via this trigger
      • This let's us avoid having to specify a time based update_interval that relies on the hardware revision's internal update rate
      • Having more accurate power sensors that update every time the Emporia hardware sends new measurements should improve the daily energy sensor's accuracy for total power and balance power
    • This behaves much like the built in ESPHome automation trigger on_value. The on_update trigger is guaranteed to execute once after every individual sensor in the component has updated. This allows the template sensors to simultaneously update after all the internal power sensors have finished publishing new values. In contrast, the on_value trigger is executed after a specific individual sensor has updated.

@kahrendt kahrendt requested a review from flaviut as a code owner September 2, 2023 19:31
@flaviut
Copy link
Collaborator
flaviut commented Sep 3, 2023

Nice work! This is all a great idea, and thanks for pointing me towards https://www.technowizardry.net/2023/02/local-energy-monitoring-using-the-emporia-vue-2/

@flaviut flaviut merged commit 4d11f1f into emporia-vue-local:dev Sep 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0