Skip to content

sensor.history_stats was working in the future (fixes #20571)#20589

Merged
balloob merged 1 commit intohome-assistant:devfrom
dgomes:fix_20571
Jan 31, 2019
Merged

sensor.history_stats was working in the future (fixes #20571)#20589
balloob merged 1 commit intohome-assistant:devfrom
dgomes:fix_20571

Conversation

@dgomes
Copy link
Copy Markdown
Contributor

@dgomes dgomes commented Jan 29, 2019

Description:

The sensor.history_stats platform was calculating future statistics which resulted in negative values

Related issue (if applicable): fixes #20571

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Example entry for configuration.yaml (if applicable):

  - platform: history_stats
    name: History Stats test
    entity_id: sensor.test
    state: 'whatever''
    type: time
    end: '{{now().replace(hour=23).replace(minute=0).replace(second=0)}}'
    duration:
      hours: 1

(this only fails before 22h00)

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 communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

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

@ghost ghost assigned dgomes Jan 29, 2019
@ghost ghost added the in progress label Jan 29, 2019
@balloob balloob merged commit c7ff8d4 into home-assistant:dev Jan 31, 2019
@ghost ghost removed the Ready for review label Jan 31, 2019
This was referenced Feb 2, 2019
@dgomes dgomes deleted the fix_20571 branch April 7, 2022 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Negative values in history_stats

3 participants