-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
Add Ws as unit of energy #156398
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
base: dev
Are you sure you want to change the base?
Add Ws as unit of energy #156398
Conversation
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Hey there @home-assistant/core, @Shulyaka, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Hey there @Petro31, @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Isn't a "Ws" usually referred to as a Joule ("J")? Are there specific use cases where "Ws" is more common? |
| UnitOfEnergy.KILO_JOULE: _WH_TO_J, | ||
| UnitOfEnergy.MEGA_JOULE: _WH_TO_J / 1e3, | ||
| UnitOfEnergy.GIGA_JOULE: _WH_TO_J / 1e6, | ||
| UnitOfEnergy.WATT_SECOND: 3.6e6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'd make this match the "JOULE" conversion implementation. i.e. _WH_TO_J * 1e3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review! 👍
I added _WH_TO_WS since I thought using the same _WH_TO_J might be confusing.
But please let me know if you’d prefer that I use the same constant instead!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a maintainer, but I don't see the need to duplicate the constants.
It's the same, but probably depends a bit on the context. 😇. From ChatGPT:
I guess that in the context of |
|
Can you find some examples in smart homes where "Ws" is a commonly used unit? Don't believe everything that ChatGPT tells you. |
jpbede
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes our core entity models and thus requires a approved architecture discussion.
Please open a discussion at https://github.com/home-assistant/architecture/discussions. Provide some context and which core integrations would benefit from this unit of energy.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Just one example, the MyStrom API returns Ws. #155132 (comment) My understanding is that the conversion from
Thanks @jpbede , will do! |
|
I'm just a community member, but I don't think that 1 rare example is enough to add something that's just a duplicate of "J", which already exists. But it's not up to me. But let's transfer this to the architecture discussion. |
|
I'm in agreement here, I don't see the benefit when we have Joules. A 2 second google of watt second returns joules and that should satisfy anyones needs. The graph would be identical to Ws. It would just show J over time instead of Ws over time. |
Breaking change
Proposed change
This PR adds Ws (watt-second) as a unit of energy.
Architecture Decision: home-assistant/architecture#1307
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: