-
Notifications
You must be signed in to change notification settings - Fork 60
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
Request: decimal place configuration #142
Comments
Yes one up for this! |
That would be nice. It would save having duplicate template sensors. |
I figured out something that works for me - rounding the APF xxxx Entities to the nearest 100 Watts. In the card, the entity is then shown as an integer when it is watts, and to 1 decimal place when it is kilowatts (and maintains the trimming of the trailing zero, like the grid entity shown below). You could similarly round to 10 Watts or 1000 Watts for different levels of decimal precision. Would still be handy to do it via the config, but this also works. |
@melvanderwal I hope you're still watching this thread. Could you please do me a huge favor and copy and paste all your template sensors related to tesla-style-solar-power-card as I think something must have changed in Home Assistant or the Integration to make your example not correct anymore. When I use your example above, all my AFP values show as 0. It looks like your suggested code is presuming that my tesla powerwall Entities are in Watts. They are actually in Kilowatts for me. Below are my template sensors: - name: APF Grid Entity
device_class: power
state_class: measurement
unit_of_measurement: W
state: "{{ ((0 - states('sensor.powerwall_site_power')|float * 1000) / 100)|round(0) * 100 }}"
- name: APF House Entity
device_class: power
state_class: measurement
unit_of_measurement: W
state: "{{ (states('sensor.powerwall_load_power')|float * 1000 / 100)|round(0) * 100 }}"
- name: APF Generation Entity
device_class: power
state_class: measurement
unit_of_measurement: W
state: "{{ (states('sensor.powerwall_solar_power')|float * 1000 / 100)|round(0) * 100 }}"
- name: APF Battery Entity
device_class: power
state_class: measurement
unit_of_measurement: W
state: "{{ ((0 - states('sensor.powerwall_battery_power')|float * 1000) / 100)|round(0) * 100 }}"
- name: APF Grid Import
device_class: power
state_class: measurement
unit_of_measurement: W
state: >
{% if states('sensor.apf_grid_entity')|int(default=0) < 0 %}
{{ states('sensor.apf_grid_entity')|int(default=0)|abs }}
{% else %}
0
{% endif %} |
It would be nice to be able to round kW text to a selected number of decimal places within the icon bubbles. This would mitigate overlap with the bubble perimeter and would increase readability. Could be universal, or perhaps per-device would let people choose more detail for specific devices when it is logical. For myself, I don't need to see more than 1 decimal. I do like the auto-display where it drops trailing zeroes from the number - perhaps a max number of digits following the decimal point would be an option?
Thanks very much for this card - I've been able to clean up so much clutter from gauges and glance cards into a clean, intuitive UX. It was simple to adjust the Power Wall sample code to a Goodwe inverter.
The text was updated successfully, but these errors were encountered: