Skip to content
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

fix derived rate, fixes #20097 #21620

merged 8 commits into from Mar 3, 2019


None yet
5 participants
Copy link

wburgers commented Mar 3, 2019


The rate (m3/h) was calculated as current_reading - previous_reading. So time was not considered.
This PR fixes the rate by calculating the time between the readings and converting that to m3/h.

Related issue (if applicable): fixes #20097

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

Example entry for configuration.yaml (if applicable):


  • 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/
  • 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.

This comment has been minimized.

Copy link

homeassistant commented Mar 3, 2019

Hi @wburgers,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.


@homeassistant homeassistant added cla-signed and removed cla-needed labels Mar 3, 2019

Show resolved Hide resolved homeassistant/components/sensor/ Outdated
Fix typo

@amelchio amelchio self-requested a review Mar 3, 2019

Copy link

amelchio left a comment

Sorry for clicking around, in fact I had one more comment.

Show resolved Hide resolved tests/components/sensor/ Outdated

wburgers and others added some commits Mar 3, 2019

Make the test more realistic
Took values from my own smart meter for the test
Copy link

amelchio left a comment

Great, thank you 🎉

@amelchio amelchio merged commit 2017e45 into home-assistant:dev Mar 3, 2019

3 checks passed

Hound No violations found. Woof!
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed

@wafflebot wafflebot bot removed the in progress label Mar 3, 2019

mxworm added a commit to mxworm/home-assistant that referenced this pull request Mar 4, 2019

Merge branch 'dev' into current
* dev: (344 commits)
  Better output of workflow
  Upgrade youtube_dl to 2019.03.01 (home-assistant#21647)
  GitHub Workflow (home-assistant#21643)
  Fix actions with tox (home-assistant#21642)
  Replace travis (home-assistant#21641)
  Allow configuration of update interval for ness_alarm (home-assistant#21415)
  Updated frontend to 20190303.0
  Update translations
  Add storage helper to ZHA and use it for the device node descriptor (home-assistant#21500)
  Log exception occurred in WS service call command (home-assistant#21584)
  Fix calc next (home-assistant#21630)
  Expose create/delete cloudhook (home-assistant#21606)
  Return Netatmo climate operation_mode instead of boiler status (home-assistant#21633)
  Bump pyflunearyou to 1.0.3 (home-assistant#21634)
  fix derived rate, fixes home-assistant#20097 (home-assistant#21620)
  Add optional sender name for SendGrid (home-assistant#21610)
  Add 'app_name' property and 'apps' config entry to Fire TV (home-assistant#21601)
  Add device HMIP-eTRV-C to HomematicIP (home-assistant#21612)
  Bumping aioasuswrt (home-assistant#21627)
  SmartThings remove SmartApp/Automation on integration removal (home-assistant#21594)

This comment has been minimized.

Copy link

leeuwte commented Mar 6, 2019

by chance I added this component as a custom_component to already use my changes in advance. But I'm getting an error after this PR;

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/", line 347, in async_device_update
    await self.async_update()
  File "/config/custom_components/sensor/", line 354, in async_update
    self._state = diff / timediff * 3600
TypeError: unsupported operand type(s) for /: 'decimal.Decimal' and 'datetime.timedelta'

This comment has been minimized.

Copy link

amelchio commented Mar 6, 2019

@leeuwte Thanks for testing 👍. Please file a GitHub issue to track this regression.

@wburgers wburgers deleted the wburgers:fix-derived-rate-dsmr branch Mar 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.