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

Use UnitOfDataRate #90

Closed
tetienne opened this issue Jan 10, 2023 · 16 comments
Closed

Use UnitOfDataRate #90

tetienne opened this issue Jan 10, 2023 · 16 comments
Labels
enhancement New feature or request

Comments

@tetienne
Copy link
Contributor

Hi, thank you for your component. The number of information retrieved is great!

I have one remark related to the rate unit. Currently, it looks like MB/ps, which is weird. It should be MB/s or MBps. So I dig in the source of this repository, and I noticed that UnitOfDataRate is not used or even UnitOfInformation.

It would be great if you used these constants so this component will behave more others one.

@SaswatPadhi
Copy link

+1.

MB/ps is kinda confusing. "ps" = pico second?
As @tetienne mentioned, shouldn't it be MBps or MB/s?

@elad-bar
Copy link
Owner

released new version with fix for it, v2.0.25, pls check and let me know if works for you

thanks

@SaswatPadhi
Copy link

SaswatPadhi commented Feb 23, 2023

Thanks for looking into this.

I have "MB" as the unit (was set to MBytes previously), but I see tx/rx rates in several millions. I think the reported values are in bytes.

@elad-bar
Copy link
Owner

checking

@elad-bar
Copy link
Owner

found it and released new version with fix for it, v2.0.26

thanks

@tetienne
Copy link
Contributor Author

@elad-bar Why copy my PR instead of merging it? I also still don’t see any usage of the units declared by HA as said in my first comment.

@elad-bar
Copy link
Owner

sorry for that, because I changed the code and done major code refactor which messed up your PR (which I saw yesterday after doing the refactor), i though I sent a message after doing the code refactoring and once noticed earlier today the the message was not sent in the PR, I manually update it according to your files and added credit as you deserve :)

again, thanks! and sorry for the mess

@tetienne
Copy link
Contributor Author

Thx for the explanation and to have sync my PR with your refactor 👌

@SaswatPadhi
Copy link

found it and released new version with fix for it, v2.0.26

thanks! works as expected now.
just a minor note - the example data in "Call Service" section still uses "Bytes" but accepts B/KB/MB

@tetienne
Copy link
Contributor Author

tetienne commented Mar 1, 2023

@elad-bar About my first comment, and the reason of this ticket. Can you use the official units of measurement in your integration. I gave you the linked in the same comment. Doing this, and adding a device class for each sensor will allow your integration to expose unit conversion and so you will be able to remove all the logic around this. For instance, with Synology you can see

image

@elad-bar
Copy link
Owner

elad-bar commented Mar 1, 2023

B, KB and MB which are used are part of the official unit of measurement - the fact whether I state them manually or using the enum doesn't matter,
device class on the other hande, will represent that you are talking about (data or traffic) and you will get the functionality of changing the unit of measurement as part of the default functionality, when I developed that integration support was not available so now that it is available, I will release (in the upcoming weekend hopefully) remove the configuration and define the proper device class so that functionality will be also available for the integration.

hope it covers the need

@elad-bar elad-bar added the enhancement New feature or request label Mar 1, 2023
@tetienne
Copy link
Contributor Author

tetienne commented Mar 1, 2023

It will covers my need indeed. Thx.

About the enum or constant vs your own hardcoded values will just help to be always in sync with HA. But I agree, the UI for the end user will be the same.

FYI, I wanted to contribute to your integration to do it myself. But the arch apply here does not look like the other components I usually work on (overkiz, and toshiba for instance).

@elad-bar
Copy link
Owner

elad-bar commented Mar 1, 2023

Thanks for the feature request and attempt to refactor it,
I created the component with boilerplate that assist me maintaining all my integrations with almost full separation between core home assistant code and pure logic of component,
Already made the change, need to test it before releasing new version

@elad-bar
Copy link
Owner

elad-bar commented Mar 2, 2023

please check release v2.0.27

thanks

@tetienne
Copy link
Contributor Author

tetienne commented Mar 2, 2023

@elad-bar That’s perfect! Much more user friendly and in the HA philosophy.

@elad-bar
Copy link
Owner

elad-bar commented Mar 2, 2023

thanks for suggesting it and sharing that feature, was not aware of it

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

No branches or pull requests

3 participants