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

Make the number of decimal digits contextual #45

Closed
Ndrinta opened this issue May 13, 2022 · 7 comments · Fixed by #52
Closed

Make the number of decimal digits contextual #45

Ndrinta opened this issue May 13, 2022 · 7 comments · Fixed by #52
Labels

Comments

@Ndrinta
Copy link

Ndrinta commented May 13, 2022

Hi, first of all, great job @ulic75!

Second of all, I've noticed that the setting for kw_decimal is used also when the figure is below the watt_threshold and simple Watts are displayed.
I'd be great if we could have a similar parameter when in the 'below-threshold' region, too. Maybe, simply w_decimal.

A further upgrade would be to be able to specify the unit of measure (I'd kinda like to have at least the option to use it to display energy (kWh/Wh) instead of instantaneous power). I know this would be a 'different use' for this card, but flexibility is always a plus IMHO).

@Ndrinta
Copy link
Author

Ndrinta commented May 13, 2022

Oh, correction. Actually no, kw_decimal is not used in the 'below-threshold' region.

  private displayValue = (value: number) =>
    value >= this._config!.watt_threshold
      ? `${round(value / 1000, this._config!.kw_decimals)} kW`
      : `${round(value, 1)} W`;

It always rounds it up to the first decimal. I haven't noticed it because I also have kw_decimal set equal to 1.
Anyways, same issue, not customizable so no good.
Looks like a super easy fix, I'll make a pull request tomorrow; but only if there isn't friction by anyone, of course. :)

@ulic75
Copy link
Owner

ulic75 commented May 13, 2022

Comments are editable 😄 My entities only supply kW up to 3 decimals, so I guess I assumed whole watts would be small enough. Your system actually provides measurements smaller than a single watt?

As for the second part of your original issue, I don't think that is likely to happen as that is what the official Energy Distribution card does.

@Ndrinta
Copy link
Author

Ndrinta commented May 13, 2022

I don't like to see edited on my comments. Just regular OCD.

I have enough resolution to monitor decimals of Watts, I don't wanna see them on the card, though.

Yep, but not as a card in the regular Lovelace (anyways, secondary).

@ulic75
Copy link
Owner

ulic75 commented May 13, 2022

https://www.home-assistant.io/dashboards/energy/ They aren't available via the card picker, but you can use them on any dashboard you'd like. I've made my own custom dashboard that includes many of these, plus power-flow-card. Granted they have almost zero customizability.

@Ndrinta
Copy link
Author

Ndrinta commented May 14, 2022

I completely missed this, the more you know...

ulic75 added a commit that referenced this issue May 18, 2022
* feat: watt decimals can be configured via `w_decimals` option

closes #45

* update readme
github-actions bot pushed a commit that referenced this issue May 18, 2022
## [2.4.0](v2.3.0...v2.4.0) (2022-05-18)

### Features

* add new `dashboard_link` option (see readme) ([#46](#46)) ([e979053](e979053))
* support grid<>battery flow ([#53](#53)) ([cf4b7b9](cf4b7b9))
* watt decimals can be configured via w_decimals option ([#52](#52)) ([c15a375](c15a375)), closes [#45](#45)
@ulic75
Copy link
Owner

ulic75 commented May 18, 2022

🎉 This issue has been resolved in version 2.4.0 🎉

The release is available on GitHub release

@ulic75
Copy link
Owner

ulic75 commented May 18, 2022

I'm not sure why you closed your PRs. Anyhow, I've included the option. Thanks again for your contribution.

github-actions bot pushed a commit to timbrueggenthies/power-flow-card that referenced this issue Sep 8, 2022
## 1.0.0 (2022-09-08)

### ⚠ BREAKING CHANGES

* card name

card type will need to be changed from `custom:power-distribution-card` to `custom:power-flow-card`

### Features

* add new `dashboard_link` option (see readme) ([ulic75#46](https://github.com/timbrueggenthies/power-flow-card/issues/46)) ([e979053](e979053))
* add new `inverted_entities` option (see readme) ([ulic75#43](https://github.com/timbrueggenthies/power-flow-card/issues/43)) ([53200bb](53200bb))
* add new option `kw_decimals` ([ulic75#32](https://github.com/timbrueggenthies/power-flow-card/issues/32)) ([a2af9d0](a2af9d0))
* **flow:** add optional rate configuration ([ulic75#5](https://github.com/timbrueggenthies/power-flow-card/issues/5)) ([f258f49](f258f49))
* initial release ([ulic75#2](https://github.com/timbrueggenthies/power-flow-card/issues/2)) ([93e9da1](93e9da1))
* log unavailable/misconfigured entities to browser console ([ulic75#61](https://github.com/timbrueggenthies/power-flow-card/issues/61)) ([f32576a](f32576a))
* make power-flow-card available from the ui picker ([ulic75#38](https://github.com/timbrueggenthies/power-flow-card/issues/38)) ([fa16d3d](fa16d3d))
* off grid support ([ulic75#63](https://github.com/timbrueggenthies/power-flow-card/issues/63)) ([7676356](7676356))
* support grid<>battery flow ([ulic75#53](https://github.com/timbrueggenthies/power-flow-card/issues/53)) ([cf4b7b9](cf4b7b9))
* support split consumption/production entities ([ulic75#12](https://github.com/timbrueggenthies/power-flow-card/issues/12)) ([da78757](da78757)), closes [ulic75#8](https://github.com/timbrueggenthies/power-flow-card/issues/8)
* support watts and kilowats ([ulic75#18](https://github.com/timbrueggenthies/power-flow-card/issues/18)) ([9596eeb](9596eeb))
* watt decimals can be configured via w_decimals option ([ulic75#52](https://github.com/timbrueggenthies/power-flow-card/issues/52)) ([c15a375](c15a375)), closes [ulic75#45](https://github.com/timbrueggenthies/power-flow-card/issues/45)

### Bug Fixes

* always show solar value for consistency ([ulic75#9](https://github.com/timbrueggenthies/power-flow-card/issues/9)) ([adf4d15](adf4d15))
* debounce error logging ([ulic75#62](https://github.com/timbrueggenthies/power-flow-card/issues/62)) ([de73d05](de73d05))
* detection of grid return ([ulic75#13](https://github.com/timbrueggenthies/power-flow-card/issues/13)) ([adeee30](adeee30))
* display issue without battery_charge entity ([ulic75#11](https://github.com/timbrueggenthies/power-flow-card/issues/11)) ([79f84ca](79f84ca))
* prevent negative solar state ([ulic75#25](https://github.com/timbrueggenthies/power-flow-card/issues/25)) ([162376b](162376b)), closes [ulic75#23](https://github.com/timbrueggenthies/power-flow-card/issues/23)
* rename card to power-distribution-card ([6678525](6678525))
* round watts to 1 decimal place ([ulic75#22](https://github.com/timbrueggenthies/power-flow-card/issues/22)) ([2606dbd](2606dbd))
* smooth out flow dots on safari based guis ([ulic75#85](https://github.com/timbrueggenthies/power-flow-card/issues/85)) ([3ce9ebf](3ce9ebf)), closes [ulic75#82](https://github.com/timbrueggenthies/power-flow-card/issues/82)

### Miscellaneous Chores

* rename to power-flow-card ([ulic75#17](https://github.com/timbrueggenthies/power-flow-card/issues/17)) ([bb26ad7](bb26ad7)), closes [ulic75#15](https://github.com/timbrueggenthies/power-flow-card/issues/15)
flyrmyr pushed a commit to flyrmyr/system-flow-card that referenced this issue Feb 17, 2023
## [2.4.0](ulic75/power-flow-card@v2.3.0...v2.4.0) (2022-05-18)

### Features

* add new `dashboard_link` option (see readme) ([#46](ulic75/power-flow-card#46)) ([e979053](ulic75/power-flow-card@e979053))
* support grid<>battery flow ([#53](ulic75/power-flow-card#53)) ([cf4b7b9](ulic75/power-flow-card@cf4b7b9))
* watt decimals can be configured via w_decimals option ([#52](ulic75/power-flow-card#52)) ([c15a375](ulic75/power-flow-card@c15a375)), closes [#45](ulic75/power-flow-card#45)
github-actions bot pushed a commit to dbartokthomas/power-flow-card that referenced this issue Mar 15, 2023
## 1.0.0 (2023-03-15)

### ⚠ BREAKING CHANGES

* card name

card type will need to be changed from `custom:power-distribution-card` to `custom:power-flow-card`

### Features

* add new `dashboard_link` option (see readme) ([ulic75#46](https://github.com/japanfred/power-flow-card/issues/46)) ([e979053](e979053))
* add new `inverted_entities` option (see readme) ([ulic75#43](https://github.com/japanfred/power-flow-card/issues/43)) ([53200bb](53200bb))
* add new option `kw_decimals` ([ulic75#32](https://github.com/japanfred/power-flow-card/issues/32)) ([a2af9d0](a2af9d0))
* add support for display of gas and water ([ulic75#110](https://github.com/japanfred/power-flow-card/issues/110)) ([270b3e6](270b3e6))
* **flow:** add optional rate configuration ([ulic75#5](https://github.com/japanfred/power-flow-card/issues/5)) ([f258f49](f258f49))
* initial release ([ulic75#2](https://github.com/japanfred/power-flow-card/issues/2)) ([93e9da1](93e9da1))
* log unavailable/misconfigured entities to browser console ([ulic75#61](https://github.com/japanfred/power-flow-card/issues/61)) ([f32576a](f32576a))
* make power-flow-card available from the ui picker ([ulic75#38](https://github.com/japanfred/power-flow-card/issues/38)) ([fa16d3d](fa16d3d))
* off grid support ([ulic75#63](https://github.com/japanfred/power-flow-card/issues/63)) ([7676356](7676356))
* support grid<>battery flow ([ulic75#53](https://github.com/japanfred/power-flow-card/issues/53)) ([cf4b7b9](cf4b7b9))
* support split consumption/production entities ([ulic75#12](https://github.com/japanfred/power-flow-card/issues/12)) ([da78757](da78757)), closes [ulic75#8](https://github.com/japanfred/power-flow-card/issues/8)
* support watts and kilowats ([ulic75#18](https://github.com/japanfred/power-flow-card/issues/18)) ([9596eeb](9596eeb))
* watt decimals can be configured via w_decimals option ([ulic75#52](https://github.com/japanfred/power-flow-card/issues/52)) ([c15a375](c15a375)), closes [ulic75#45](https://github.com/japanfred/power-flow-card/issues/45)

### Bug Fixes

* always show solar value for consistency ([ulic75#9](https://github.com/japanfred/power-flow-card/issues/9)) ([adf4d15](adf4d15))
* debounce error logging ([ulic75#62](https://github.com/japanfred/power-flow-card/issues/62)) ([de73d05](de73d05))
* detection of grid return ([ulic75#13](https://github.com/japanfred/power-flow-card/issues/13)) ([adeee30](adeee30))
* display issue without battery_charge entity ([ulic75#11](https://github.com/japanfred/power-flow-card/issues/11)) ([79f84ca](79f84ca))
* **entity:** allowed for background again ([ulic75#116](https://github.com/japanfred/power-flow-card/issues/116)) ([84335be](84335be))
* prevent negative solar state ([ulic75#25](https://github.com/japanfred/power-flow-card/issues/25)) ([162376b](162376b)), closes [ulic75#23](https://github.com/japanfred/power-flow-card/issues/23)
* rename card to power-distribution-card ([6678525](6678525))
* round watts to 1 decimal place ([ulic75#22](https://github.com/japanfred/power-flow-card/issues/22)) ([2606dbd](2606dbd))
* smooth out flow dots on safari based guis ([ulic75#85](https://github.com/japanfred/power-flow-card/issues/85)) ([3ce9ebf](3ce9ebf)), closes [ulic75#82](https://github.com/japanfred/power-flow-card/issues/82)
* **solar:** text color to match energy-distribution-card ([ulic75#111](https://github.com/japanfred/power-flow-card/issues/111)) ([efab88f](efab88f))

### Miscellaneous Chores

* rename to power-flow-card ([ulic75#17](https://github.com/japanfred/power-flow-card/issues/17)) ([bb26ad7](bb26ad7)), closes [ulic75#15](https://github.com/japanfred/power-flow-card/issues/15)
github-actions bot pushed a commit to DBT85/DBT85PFC that referenced this issue Mar 15, 2023
## 1.0.0 (2023-03-15)

### ⚠ BREAKING CHANGES

* card name

card type will need to be changed from `custom:power-distribution-card` to `custom:power-flow-card`

### Features

* add new `dashboard_link` option (see readme) ([ulic75#46](https://github.com/DBT85/DBT85PFC/issues/46)) ([e979053](e979053))
* add new `inverted_entities` option (see readme) ([ulic75#43](https://github.com/DBT85/DBT85PFC/issues/43)) ([53200bb](53200bb))
* add new option `kw_decimals` ([ulic75#32](https://github.com/DBT85/DBT85PFC/issues/32)) ([a2af9d0](a2af9d0))
* add support for display of gas and water ([ulic75#110](https://github.com/DBT85/DBT85PFC/issues/110)) ([270b3e6](270b3e6))
* **flow:** add optional rate configuration ([ulic75#5](https://github.com/DBT85/DBT85PFC/issues/5)) ([f258f49](f258f49))
* initial release ([ulic75#2](https://github.com/DBT85/DBT85PFC/issues/2)) ([93e9da1](93e9da1))
* log unavailable/misconfigured entities to browser console ([ulic75#61](https://github.com/DBT85/DBT85PFC/issues/61)) ([f32576a](f32576a))
* make power-flow-card available from the ui picker ([ulic75#38](https://github.com/DBT85/DBT85PFC/issues/38)) ([fa16d3d](fa16d3d))
* off grid support ([ulic75#63](https://github.com/DBT85/DBT85PFC/issues/63)) ([7676356](7676356))
* support grid<>battery flow ([ulic75#53](https://github.com/DBT85/DBT85PFC/issues/53)) ([cf4b7b9](cf4b7b9))
* support split consumption/production entities ([ulic75#12](https://github.com/DBT85/DBT85PFC/issues/12)) ([da78757](da78757)), closes [ulic75#8](https://github.com/DBT85/DBT85PFC/issues/8)
* support watts and kilowats ([ulic75#18](https://github.com/DBT85/DBT85PFC/issues/18)) ([9596eeb](9596eeb))
* watt decimals can be configured via w_decimals option ([ulic75#52](https://github.com/DBT85/DBT85PFC/issues/52)) ([c15a375](c15a375)), closes [ulic75#45](https://github.com/DBT85/DBT85PFC/issues/45)

### Bug Fixes

* always show solar value for consistency ([ulic75#9](https://github.com/DBT85/DBT85PFC/issues/9)) ([adf4d15](adf4d15))
* debounce error logging ([ulic75#62](https://github.com/DBT85/DBT85PFC/issues/62)) ([de73d05](de73d05))
* detection of grid return ([ulic75#13](https://github.com/DBT85/DBT85PFC/issues/13)) ([adeee30](adeee30))
* display issue without battery_charge entity ([ulic75#11](https://github.com/DBT85/DBT85PFC/issues/11)) ([79f84ca](79f84ca))
* **entity:** allowed for background again ([ulic75#116](https://github.com/DBT85/DBT85PFC/issues/116)) ([84335be](84335be))
* prevent negative solar state ([ulic75#25](https://github.com/DBT85/DBT85PFC/issues/25)) ([162376b](162376b)), closes [ulic75#23](https://github.com/DBT85/DBT85PFC/issues/23)
* rename card to power-distribution-card ([6678525](6678525))
* round watts to 1 decimal place ([ulic75#22](https://github.com/DBT85/DBT85PFC/issues/22)) ([2606dbd](2606dbd))
* smooth out flow dots on safari based guis ([ulic75#85](https://github.com/DBT85/DBT85PFC/issues/85)) ([3ce9ebf](3ce9ebf)), closes [ulic75#82](https://github.com/DBT85/DBT85PFC/issues/82)
* **solar:** text color to match energy-distribution-card ([ulic75#111](https://github.com/DBT85/DBT85PFC/issues/111)) ([efab88f](efab88f))

### Miscellaneous Chores

* rename to power-flow-card ([ulic75#17](https://github.com/DBT85/DBT85PFC/issues/17)) ([bb26ad7](bb26ad7)), closes [ulic75#15](https://github.com/DBT85/DBT85PFC/issues/15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants