Open hiagocosta opened 3 months ago
this is the full coding of this card:
secondary_info
option, it is secondary
.sorry, this is de the code of the card at all, still not picking the template
type: entities
entities:
- entity: sensor.ble_battery_sensor_sala
name: Term么metro Sala
- entity: sensor.ble_battery_sensor_escritorio
name: Term么metro Escrit贸rio
- entity: sensor.ble_battery_sensor_quarto
name: Term么metro Quarto
- entity: sensor.ble_battery_sensor_externo
name: Term么metro Externo
- entity: sensor.ble_battery_sensor_banheiro
name: Term么metro Banheiro
- entity: sensor.ble_battery_sensor_cozinha
name: Term么metro Cozinha
- type: custom:template-entity-row
entity: sensor.fire_tablet_battery
secondary: >-
{{% if is_state('binary_sensor.fire_tablet_plugged_in' , 'on') %}}
Carregando {{% endif %}}
- entity: sensor.mi_9_battery_level
name: Xiaomi Mi9
secondary_info: last-changed
- entity: sensor.watch_6_battery_level
name: Galaxy Watch 6
secondary_info: last-updated
title: N铆vel de Bateria
theme: Mushroom Shadow
state_color: true
Because templates are wrong.
{{% ... %}}
must be
{% ... %}
now it works, thansk for help!! by the way, this is shows as integer, how can I add in percentage?
@hiagocosta I think it is the same bug as described here: https://github.com/thomasloven/lovelace-template-entity-row/issues/62
Use state template, something like this:
state: '{{ state("sensor.fire_tablet_battery") }} %'
I think it is the same bug as described here
That issue https://github.com/thomasloven/lovelace-template-entity-row/issues/62 is not a bug - OP created it because he expected smth which is not supported. And did not close the issue after receiving explanations. Also, that issue https://github.com/thomasloven/lovelace-template-entity-row/issues/62 is not related to the current issue - here it is about wrong use of jinja. I wonder why both issues are still open.
@ildar170975 I was only replying about the last question of OP because I had a similar issue with missing units:
type: entities
entities:
- entity: sensor.x_cloud_days_until_expiration
- entity: sensor.x_cloud_days_until_expiration
type: custom:template-entity-row
the default
row shows the unit when the [template-entity-row](custom:template-entity-row)
is missing it.
I suggested using a template for the state as I'm doing: https://community.home-assistant.io/t/auto-entities-customize-displayed-name-and-use-attribute-as-secondary-info/700415/1
about the last question of OP because I had a similar issue with missing units
I see, thanks for clarifications. UoM is not showing as it is not a part of a state. It has to be added manually in a template.
UoM is not showing as it is not a part of a state. It has to be added manually in a template.
Exactly 馃憤
for UOM, you can use:
{{states[config.entity].state_with_unit}}
or
{{ states(config.entity, with_unit=True) }}
@hiagocosta if all of the above answers your config trouble, please close, so Thomas needs to check only valid/open issues? thx!
Are there any plans to implement last-changed information?
@ganjakyp-hub Have you read what was written above? There is nothing to implement.
Maybe I didn鈥檛 understand something, but I tried different methods and they don鈥檛 work:
secondary: last-changed
does not work in a template-entity-row config, as that is an option for regular entities rows/cards.
in the template-entity-row, secondary:
simply indicates the position in the row where your template will show its result.
as it accepts any template, it's up to you what you want to show there. The template can use config.entity, if you use that in the main config. However, you can have it show anything you like, as long as the template you are using produces a result
cut it short:
all options in template-entity-row require (well, accept) a template. ofc you can set an icon directly.... or a name.
It seems I solved the issue using a third party component https://github.com/TheFes/relative-time-plus
secondary: >- {% from 'relative_time_plus.jinja' import relative_time_plus %} {{ relative_time_plus(states[config.entity].last_changed, 1, language='ru') }} 薪邪蟹邪写
Unfortunately this component incorrectly inflects words in Russian :( Is it possible to add a regular secondary_info?
that relative-time-plus only formats, and has nothing to do with the options for template-entity-row itself. As I said above, you can use any template you want, to reach the result you need.
if it results in Russian, maybe your system language is in Russian? that is not incorrect, that is as expected then. You can probably set a language flag in that template, but then you need to check with that component. Again, not to do with template-entity-row
btw, maybe you are aware, but you can do this in a filter template:
- type: custom:auto-entities
card:
type: entities
state_color: true
filter:
template: >
[{% for entity_id in label_entities('speler_tracker') %}
{{ {'entity': entity_id,
'secondary_info': 'last-changed'} }},
{% endfor %}]
or
filter:
template: >
[{% for s in label_entities('speler_tracker') %}
{{ {'entity': s,
'secondary_info': 'last-changed'} }},
{% endfor %}]
for that matter (just to illustrate the variable entity_id in the first template is a mere string of choice.)
That is, it is impossible to add support for regular secondary_info?
that relative-time-plus only formats, and has nothing to do with the options for template-entity-row itself. As I said above, you can use any template you want, to reach the result you need.
if it results in Russian, maybe your system language is in Russian? that is not incorrect, that is as expected then. You can probably set a language flag in that template, but then you need to check with that component. Again, not to do with template-entity-row
btw, maybe you are aware, but you can do this in a filter template:
- type: custom:auto-entities card: type: entities state_color: true filter: template: > [{% for entity_id in label_entities('speler_tracker') %} {{ {'entity': entity_id, 'secondary_info': 'last-changed'} }}, {% endfor %}]
or
filter: template: > [{% for s in label_entities('speler_tracker') %} {{ {'entity': s, 'secondary_info': 'last-changed'} }}, {% endfor %}]
for that matter (just to illustrate the variable entity_id in the first template is a mere string of choice.)
It doesn't work, something wrong?
type: custom:template-entity-row
entity: binary_sensor.192_168_10_210
icon: mdi:television-classic
name: TCL
state: >-
{% if is_state('binary_sensor.192_168_10_210', 'on')%} {% else %} {%
endif %}
filter:
template: >
[{% for s in label_entities('binary_sensor.192_168_10_210') %}
{{ {'entity': s, 'secondary_info': 'last-changed'} }},
{% endfor %}]
It doesn't work, something wrong?
well, almost everything is wrong there yes...
your state template is not correct, missing the 'else' value
secondly, your are using a auto-entities filter template inside the template-entity-row config.....
besides, you are using this
label_entities('binary_sensor.192_168_10_210')
which seems incorrect. do you have binary_sensor.192_168_10_210
set as a label??
let me suggest you hop over to the Community where we can help you out with all of this. This repo place is for 'issues' really, as in bugs, or feature request.
not for config assistance
@hiagocosta please close as there is no more issue?
Maybe it's possible to add this as a feature request?
add what?
its not really clear what you want, and besides that, before making a FR, please try and figure out your errors, because you clearly are mixing various things up.
as said, this is not the place for that.
hi, i'm trying to implement the templantes on a row for my Fire Tablet, that will inform it's currently situation, if is charging or not, but I think that my logics is good enough...
I miss a bit