Skip to content

Utility Meter offset defined by a time_period#20926

Merged
cgarwood merged 5 commits into
home-assistant:devfrom
dgomes:utility_meter_offset
Mar 6, 2019
Merged

Utility Meter offset defined by a time_period#20926
cgarwood merged 5 commits into
home-assistant:devfrom
dgomes:utility_meter_offset

Conversation

@dgomes
Copy link
Copy Markdown
Contributor

@dgomes dgomes commented Feb 10, 2019

Description:

Breaking-change: offset is no longer an integer value dependent on the cycle, but a a very flexible time_period.

Currently offset configuration parameter is an integer that limits daily cycles to have offsets in days, monthly cycles to have offsets in months, etc.
This PR increases the flexibility of offset by making it a time_period that can be described in a combination of hours, days, months, etc. This makes it possible for a yearly cycle to start at a given day of a given month.

It causes a breaking change, but since the component is very recent (0.87) I believe users will acknowledge the improvement and fix the configuration.

Related issue (if applicable): fixes #20918

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

Example entry for configuration.yaml (if applicable):

utility_meter: 
  energy_bill:
    source: sensor.energy
    cycle: yearly
    offset:
      days: 31  

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 tests/components/utility_meter/test_sensor.py Outdated
@dgomes dgomes force-pushed the utility_meter_offset branch from 4d9edac to 6495d47 Compare February 10, 2019 01:44
Comment thread tests/components/utility_meter/test_sensor.py Outdated
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good. Just found a typo.

Comment thread homeassistant/components/utility_meter/sensor.py Outdated
@MartinHjelmare
Copy link
Copy Markdown
Member

Can be merged when conflict is solved and the breaking change is highlighted in a paragraph in the PR description.

@cgarwood cgarwood merged commit 8e9a496 into home-assistant:dev Mar 6, 2019
@ghost ghost removed the Ready for review label Mar 6, 2019
@balloob balloob mentioned this pull request Mar 20, 2019
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.

Utility Meter should allow setting a yearly offset on a specific day

6 participants