Open sheminasalam opened 1 year ago
Is it possible to change color according to numeric state
card-mod. Go to card-mod community thread for info.
to round a state attribute value
Only if it is supported by the inserted row.
Conventional rows (https://www.home-assistant.io/dashboards/entities/) do NOT support rounding (or any other math operations).
Try to put a custom:template-entity-row
inside (which allows using template for a displayed state). But in this case there is no need to use secondaryinfo-entity-row
.
Thanks for the input. I tried the following
- type: entities
entities:
- entity: binary_sensor.front_door
state_color: true
type: custom:secondaryinfo-entity-row
secondary_info: 'Battery: [[ binary_sensor.front_door.attributes.battery ]]'
card_mod:
style: |
:host {
color: {% if state_attr('binary_sensor.front_door', 'battery')| float >= 3.1 %} green
{% elif state_attr('binary_sensor.front_door', 'battery')| float > 3.1 and state_attr('binary_sensor.front_door', 'battery')| float <= 2.8 %} yellow
{% elif state_attr('binary_sensor.front_door', 'battery')| float < 2.8 %} red
{% endif %}
}
This changes the color of the state and the primary row. It doesnot have an affect on secondary row. How can this be modified to change secondary row.
Go to card-mod community thread for info. 1st post -> link at the bottom -> styles for Entities
Is it possible to change color according to numeric state like in the case of a battery voltage? If above 3.2 volt green, between 2.9 and 3.2 yellow. Below 2.9 red.
Also will it be possible to round a state attribute value in this card?