Skip to content

Add integration method to sensor.integration#21050

Merged
balloob merged 3 commits into
home-assistant:devfrom
dgomes:integration_algo
Feb 14, 2019
Merged

Add integration method to sensor.integration#21050
balloob merged 3 commits into
home-assistant:devfrom
dgomes:integration_algo

Conversation

@dgomes
Copy link
Copy Markdown
Contributor

@dgomes dgomes commented Feb 13, 2019

Description:

There are various numerical integration methods, and although trapezoidal is the most common, cases are where left or right method are more appropriate.
This PR adds an extra configuration option to make the left and right riemann methods available in addition to the default trapezoidal method.

Related issue (if applicable): fixes https://community.home-assistant.io/t/different-modes-for-integration-sensor/98827

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#8557

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: integration
    name: integration
    method: left
    source: sensor.power
    unit: kWh
    round: 2

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

Comment thread homeassistant/components/sensor/integration.py Outdated
Comment thread homeassistant/components/sensor/integration.py Outdated
Copy link
Copy Markdown
Member

@OttoWinter OttoWinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@balloob balloob merged commit f1f3074 into home-assistant:dev Feb 14, 2019
@ghost ghost removed the in progress label Feb 14, 2019
@balloob balloob mentioned this pull request Feb 20, 2019
@dgomes dgomes deleted the integration_algo branch November 7, 2021 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants