GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Rename `current_consumption` to `power` by ryenitcher · Pull Request #1349 · python-kasa/python-kasa

Conversation

@ryenitcher

@ryenitcher ryenitcher commented Dec 7, 2024

Copy link
Copy Markdown
Contributor
  • Note: This is a breaking change.
  • Fix: Rename current_consumption to power in energy modules, to deconflict and clarify.
  • Fix: Report 0 instead of None for current when current is zero.
  • Fix: Report 0 instead of None for voltage when voltage is zero (not that this was possible to see).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codecov

codecov Bot commented Dec 7, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.13%. Comparing base (cb89342) to head (1c25091).
Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1349   +/-   ##
=======================================
  Coverage   92.13%   92.13%           
=======================================
  Files         122      122           
  Lines        7867     7867           
  Branches      810      810           
=======================================
  Hits         7248     7248           
  Misses        454      454           
  Partials      165      165           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sdb9696

sdb9696 commented Dec 11, 2024

Copy link
Copy Markdown
Contributor

I agree with the setting to zero, but I’m not sure about the value of the rename. Whilst I get that it’s a bit confusing, we’re still left with consumption_today, consumption_this_month etc. It’s a lot of churn to deprecate all this, when updating the docstrings to make clearer this is what the device reports as power could suffice.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryenitcher

ryenitcher commented Dec 11, 2024

Copy link
Copy Markdown
Contributor Author

Yeah I was starting to doubt the cost of the change relative to its’ value. I can see that it would cost the long term history graphs of the power draw metrics in home assistant, but from what I could tell it would leave the energy monitoring integration mostly intact since that uses the accumulated consumption metrics instead of the instantaneous demand values.

I think the term just confuses me since it is current_consumption rather than consumption_current or consumption_now to match the pattern of the other metrics. I see that it is inherited from TPLink themselves though, so I suppose if you are trying to stay as close to the way TPLink phrased it, the current name makes sense (although I’m still not a fan of overloading the term current in this context).

I’ll get the zero setting extracted into a separate PR, since there’s no use in holding that back for this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rytilahti rytilahti added the breaking change Breaking change label Dec 11, 2024
@ryenitcher
ryenitcher force-pushed the dev-power branch 2 times, most recently from 6c83936 to 0963d6f Compare January 25, 2025 01:34
@ryenitcher
Correct Zero Power Reporting
f49391e
- Fix: Report `0` instead of `None` for current when current is zero.
- Fix: Report `0` instead of `None` for voltage when voltage is zero (not that this was possible to see).
@ryenitcher ryenitcher mentioned this pull request Jan 25, 2025
Report 0 for instead of None for zero current and voltage #1483
Merged
@ryenitcher

ryenitcher commented Jan 25, 2025

Copy link
Copy Markdown
Contributor Author

I've extracted the zero power reporting fix into PR #1483

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryenitcher
Rename current_consumption to power
abaf5a7
- Note: This is a breaking change.
- Fix: Rename `current_consumption` to `power` in energy modules, to deconflict and clarify.
@ryenitcher
ryenitcher force-pushed the dev-power branch from 0963d6f to abaf5a7 Compare January 25, 2025 01:57
@rytilahti

rytilahti commented Jan 25, 2025

Copy link
Copy Markdown
Member

We could still look into renaming while keeping the deprecated names available for the time being. The only one we cannot change that easily is the feature identifier (which is used as a unique key).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Apr 26, 2025

Copy link
Copy Markdown

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes.
Thank you for your contribution!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale label Apr 26, 2025
@github-actions github-actions Bot closed this May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

breaking change Breaking change stale

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ryenitcher @sdb9696 @rytilahti
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.