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

Add methods to Item to get the state as Quantity or Number #231

Closed
rkoshak opened this issue Jan 31, 2023 · 2 comments · Fixed by #234
Closed

Add methods to Item to get the state as Quantity or Number #231

rkoshak opened this issue Jan 31, 2023 · 2 comments · Fixed by #234
Assignees
Labels
enhancement New feature or request

Comments

@rkoshak
Copy link
Contributor

rkoshak commented Jan 31, 2023

Opening the issue so I don't forget and, if someone gets to it before me that's good too.

HistoricItem has a numericState method to return the state already cast/converted to a value we can do math with. This would be very useful to have on the Item class too.

In addition, this method should be Quantity aware or we should also provide an alternative quantityState method to make it easier to deal with the new Quantity API.

Or maybe it makes sense to bring back the whole getStateAs() discussion which can work for this as well as stuff like getting a Dimmer Item's ON/OFF state and the like.

@rkoshak rkoshak added the enhancement New feature or request label Jan 31, 2023
@florian-h05
Copy link
Contributor

I would propose to add both a numericState and a quantityState for convenience.
The getStateAs() method is still not as simple to use as having those two properties, but I guess still worth to discuss it.

Since I am currently spending some time on the library, I'll take over that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants