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

improve "duration" sensor #73

Open
ChristophCaina opened this issue Feb 11, 2025 · 8 comments
Open

improve "duration" sensor #73

ChristophCaina opened this issue Feb 11, 2025 · 8 comments

Comments

@ChristophCaina
Copy link
Contributor

With home-assistant/frontend#23017 and home-assistant/frontend#23025 HomeAssistant did some improvements on the Sensors that are using "duration" as value of measurement.

You can now define the default measurement of a duration sensor (days, hours, min, seconds, etc.)

These changes are not reflected by the Integration OilFox.

OilFox Sensor:
Image

Other Duration Sensors:
Image

@chises
Copy link
Owner

chises commented Feb 12, 2025

Thank you for this hint. I will check this and provide a new version in the next days :)

@chises
Copy link
Owner

chises commented Feb 18, 2025

Got it fixed, going to release a new version tomorrow.

@chises
Copy link
Owner

chises commented Feb 19, 2025

should be fixed/added in v.1.2.4

@ChristophCaina
Copy link
Contributor Author

thanks, I will give it a test

@ChristophCaina
Copy link
Contributor Author

Hi,
Thanks - the unit itself is now available, but converting it into other formats (hours, min, etc.) does not work.

@chises
Copy link
Owner

chises commented Feb 19, 2025

Okay. Can you tell me/provide a screenshot and show how to convert a other entity? That would be great :)

@ChristophCaina
Copy link
Contributor Author

Hi,
Basically with providing the information about the UnitOfMeasurement and the correct deviceClass,
HA has a builtIn Feature to convert the unit between different Units of the same Type.

In the case of duration, you would have the option to change the unit of measurements to other time formats:

Image

For Power, you can select different Power Units

Image

And the same applies for Energy, and so on (would also apply for the usagecounter of this integration)

Image

I think, this is acheived by using "native_unit_of_measurement" instead of "unit_of_measurement", as well as "native_value" - and probably "suggested_unit_of_measurement"
https://developers.home-assistant.io/docs/core/entity/sensor/

@chises
Copy link
Owner

chises commented Mar 11, 2025

Got it fixed with your link https://developers.home-assistant.io/docs/core/entity/sensor/
But if I change the unit for usageCounterQuantity or energyConsumption these the decimal values are broken. I am working on this befor releasing a new version.

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

No branches or pull requests

2 participants