P6Dave
(Dave Forrester)
February 25, 2023, 2:48pm
1
Hi folks.
Looking for some help with icons not showing in my entities card. I have an entities card with 8 entities, 3 of which are generated by custom:template-entity-row entries. Icons show okay for the standard entities, but they no longer show for the template-entity-rows.
They were okay when the entities card was first added a couple of months ago…and I’m sorry that I wasn’t more vigilant in watching when this happened so I’m not able to say what version of HA it worked on. Anyway, it’s not working now.
Sorry to be posting such a newbie basic question as I consider myself reasonably competent in such matters. This has, however, stumped me.
This is the code for the card
entities:
- entity: sensor.solar_accounting_cost_rate
name: Import Peak Rate
- entity: sensor.solar_accounting_compensation_rate
name: Export Rate
- type: custom:template-entity-row
icon: mdi:plus
name: Import Costs
state: >-
£{{ ((states('sensor.solar_imported_power_daily') | float(0)) *
(states('sensor.solar_accounting_cost_rate') | float(0))) | round(2)}}
- type: custom:template-entity-row
name: Export Compensation
icon: mdi:minus
state: >-
£{{ -((states('sensor.solar_exported_power_daily') | float(0)) *
(states('sensor.solar_accounting_compensation_rate') | float(0))) |
round(2)}}
- entity: sensor.solar_accounting_total_daily
icon: mdi:equal
name: Electricity Bill
- type: custom:template-entity-row
icon: mdi:piggy-bank
name: Cost Saving
state: >-
£{{ -(((states('sensor.solar_panel_to_house_daily') | float(0)) +
(states('sensor.solar_battery_out_daily') | float(0))) *
(states('sensor.solar_accounting_cost_rate') | float(0)) * 3.33) |
round(2)}}
- entity: sensor.solar_accounting_total_weekly
icon: mdi:equal
name: Electricity Bill Weekly
- entity: sensor.solar_accounting_total_monthly
icon: mdi:equal
name: Electricity Bill Monthly
- entity: sensor.solar_accounting_total_yearly
icon: mdi:equal
name: Electricity Bill Yearly
- entity: sensor.solar_imported_power_daily_cost
- entity: sensor.solar_exported_power_daily_compensation
show_header_toggle: false
state_color: true
title: Financials
This is how the card looks.
Thanks
1 Like
pedolsky
(Pedolsky)
February 25, 2023, 3:18pm
2
opened 01:40AM - 03 Feb 23 UTC
I have noticed that after upgrading to 2023.2.x icons are not being displayed or… formatted as before.
```yaml
type: entities
entities:
- type: custom:template-entity-row
icon: mdi:weather-windy
name: "Beaufort scale: {{ states('sensor.beaufort') }}"
state: "{{ state_attr('sensor.beaufort','description') }}"
card_mod:
style: |
:host {
--paper-item-icon-color:
{%- set beaufort = states('sensor.beaufort') | float -%}
{%- if beaufort >= 9 -%} rgb(244, 67, 54)
{%- elif beaufort >= 7 -%} #C68C71
{%- elif beaufort >= 5 -%} #F2AA19
{%- elif beaufort >= 3 -%} #E4C23D
{%- elif beaufort >= 1 -%} #57C6EA
{%- else -%} #5BC04D
{%- endif -%}
;
}
- type: custom:template-entity-row
icon: mdi:sun-thermometer-outline
entity: sensor.heatindex
name: "Heat Index: {{ states('sensor.heatindex') }}"
state: "{{ state_attr('sensor.heatindex','description') }}"
card_mod:
style:
template-entity-row$: |
state-badge {
color:
{%- set heatindex = states('sensor.heatindex') | float -%}
{%- if heatindex >= 54 -%} rgb(244, 67, 54)
{%- elif heatindex >= 41 -%} #C68C71
{%- elif heatindex >= 32 -%} #F2AA19
{%- elif heatindex >= 26 -%} #E4C23D
{%- else -%} #5BC04D
{%- endif -%}
;
}
- type: custom:template-entity-row
name: Estimate
icon: mdi:currency-usd
state: |
{{
"${:.2f}".format(
(states('sensor.daily_grid_consumption')|float(none) * states('input_number.grid_tariff')|float) +
states('input_number.power_daily_charge')|float/100 -
(states('sensor.pv_eday')|float(none) * states('input_number.solar_feedin_tariff')|float)
)
}}
card_mod:
style:
state-badge$: |
ha-state-icon{
color:
{%- set amt = (states('sensor.daily_grid_consumption')|float(none) * states('input_number.grid_tariff')|float) +
states('input_number.power_daily_charge')|float/100 -
(states('sensor.pv_eday')|float(none) * states('input_number.solar_feedin_tariff')|float) -%}
{%- if amt > 0 -%} #CD5C5C
{%- else -%} #3CB371
{%- endif -%}
!important;
}
.: |
.state {
font-weight: 500;
font-size: 13pt;
color:
{%- set amt = (states('sensor.daily_grid_consumption')|float(none) * states('input_number.grid_tariff')|float) +
states('input_number.power_daily_charge')|float/100 -
(states('sensor.pv_eday')|float(none) * states('input_number.solar_feedin_tariff')|float) -%}
{%- if amt > 0 -%} #CD5C5C
{%- else -%} #3CB371
{%- endif -%}
!important;
}
```
This is how it looks.
![image](https://user-images.githubusercontent.com/54566217/216490812-783f2bfa-675a-4285-8666-ed9a6b9d81b7.png)
Workaround: Icons not being displayed or formatted after upgrading to 2023.2.x · Issue #100 · thomasloven/lovelace-template-entity-row · GitHub
1 Like
P6Dave
(Dave Forrester)
February 25, 2023, 4:42pm
3
Okay, so I followed the instructions in the workaround to the letter and I still have no icons.
Any other suggestions or should I just create the entities I need in templates in the main code and add those entities to my card?
actually, ignore what I just said as all my icons have come back!
Thanks @pedolsky
1 Like