I think the result file must be js.
You are supposed to compile your changed project into one js file.
Hi all
how is it possible to show last-updated
as secondary:
in a template-entity-row card ?
Iâve tried like this, but it doesnât work
type: custom:template-entity-row
icon: mdi:car
name: "Waze route is {{state_attr('sensor.work','route')}}"
state: "{{states('sensor.work')}} min"
secondary: "{{ relative_time( states[config.entity].last_updated) }}"
Any suggestion?
Thanks
Hi all,
Iâm just trying to populate image:
with an attribute value, but it fails:
type: entities
entities:
- type: custom:template-entity-row
entity: sensor.billigste_stasjon
image: {{ state_attr('sensor.billigste_stasjon', 'pictureurl') }}
title: Drivstoffpriser
If I type the pictureurl manually, it works just fine:
I have tried all possible combinations of single and double quotes without any luck.
Is it possible to customize the card image using template-entity-row
at all??
Try your template in Dev tools â Template first. Your template is wrong.
Thanks @Ildar_Gabdullin for your reply.
It was just a typo. Iâve tried so many things - I got somewhat carried away.
Iâve corrected the typo now, but it still doesnât work. However, in Dev tools Template, it works ok:
Try this:
image: â{{ ... }}â
instead
image: {{ ... }}
Indeed - that works. Thank you so much
I am trying to use the âactiveâ option to have the icon color change. But the icon color never changes. Even if I add âactive: trueâ or âactive: falseâ, makes no difference in icon color. Any ideas?
- entity: number.pool_flow_sensor
type: custom:template-entity-row
state: |
{% if states.number.pool_flow_sensor.state == '1' %}
On
{% elif states.number.pool_flow_sensor.state == '0' %}
Off
{% endif %}
active: "{{ is_state('number.pool_flow_sensor', '1') }}"
name: Flow Sensor
icon: mdi:waves-arrow-right
you have 2 quotes at the end of the active: line- should only be 1.
Thanks, 35e, for looking it over. That was just a typo of mine when copying it here.
But I did find the issue! I had to remove the âentity: number.pool_flow_sensorâ line. Having the number entity listed caused the icon color not to change. Once I deleted that line, it is working fine!
- type: custom:template-entity-row
state: |
{% if states.number.pool_flow_sensor.state == '1' %}
On
{% elif states.number.pool_flow_sensor.state == '0' %}
Off
{% endif %}
active: '{{ states.number.pool_flow_sensor.state == ''1'' }}'
name: Flow Sensor
icon: mdi:waves-arrow-right
EDIT: after more testing, I have found that number entities are all impacted by this issue. Sensor entities work just fine. The downside of not being able to include the entity definition is that history cannot be access by clicking on the icon.
@thomasloven, is this by design? Is there a way that number entities can be allowed?
Have you done it? I have a similar problem.
No, I havenât found a solution yet
secondary: >
{% if states[config.entity] is not none %}
{{relative_time(states[config.entity].last_changed)}} ago
{% else %} Not yet detected
{% endif %}
last_updated works the same, should work.
If not, check your logs
When using this card without a âstateâ, the value displayed does not carry the display unit or observe the specified precision. See image attached.
Is there a way to format how the value is displayed? An option is to template the value to access the sensor state and format it inside the template, but it would require a lot of copy/paste to each row of the card, so I think Iâm missing a trick.
This is why the card is called âTEMPLATE-entity-rowâ.
You need to define a template for a state - which may include unit and desired accuracy.
Got it.
Is there any variable accessible to the template (on the state
field) that holds the value of the entity, so to avoid explicitily typing out the name of the entity again on each row ?
Described in docs.
Check about âconfig.entityâ.
In my use case, I am using it to override the name
, but would like to inherit the value, so as not to have to reinvent how to format it. (Formatting time-related stuff is a little bit more painful than just adding a ÂșC unit or something like that.)
Any way to access what the âdefaultâ display format would have been?
Either do not use âtemplate-entity-rowâ or perform a proper rounding in a template (+ add a unit).
Also, you may consider another custom card - secondaryinfo-entity-row - which allows to define secondary-info in a template.
Or you may use a standard entity row + card-mod (go to card-mod thread â 1st post â link a the bottom â using âafterâ & âbeforeâ)
is something like this possible with this integration?
type: custom:template-entity-row
icon: mdi:calendar
name: Schulferien
state: >
{% set x = state_attr('sensor.ics_1', 'start') %}
{% set days = state_attr('sensor.ics_1', 'days') %}
{% set day_long_g = ("Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag") %}
{% set day_short_g = ("Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa.", "So.") %}
{% set month_g = ("Januar","Februar","MĂ€rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember") %}
{{ day_long_g[x.weekday()]}}, {{ x.day }}.{{ x.month }}.{{x.year}} - {{ days | map(attribute='start') | list | join(', ') }} ({{ state_attr('sensor.ics_1', 'remaining' ) }})