Skip to content
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

Condition Template is not working #58

Open
Kilowatt-W opened this issue Feb 12, 2025 · 3 comments
Open

Condition Template is not working #58

Kilowatt-W opened this issue Feb 12, 2025 · 3 comments

Comments

@Kilowatt-W
Copy link

Kilowatt-W commented Feb 12, 2025

Hello,

thank you for this cool custom addon :-)

When I try to use a Custom Template thats not working.

- entity_id: sensor.anniversary*
state: < 25
options:
type: custom:secondaryinfo-entity-row
secondary_info: '[[ if({entity}.attributes.years_at_anniversary != "undefined", {entity}.attributes.years_at_anniversary, ""]] Years"'

In my case I would like to get rid of Years too, but the template is not rendered because of errors

If template is working I would like to try the following 👍

- entity_id: sensor.anniversary*
state: < 25
options:
type: custom:secondaryinfo-entity-row
secondary_info: '[[ if({entity}.attributes.years_at_anniversary != "undefined", {entity}.attributes.years_at_anniversary && "Years", ""]]"'

It would be nice to be able to add some text to a entitiys attribute.

Greetings

Kilowatt

@ildar170975
Copy link

ildar170975 commented Feb 12, 2025

What is this?

state: < 25

It is not described in Docs as smth supported.
As well as this:

 entity_id: sensor.anniversary*

You are definitely trying to use a code from some other custom card like auto-entities to demonstrate your issue.

Anyway, the template itself has issues:

  1. No closing bracket.
  2. No whitespace in the end of a template.
  3. Also, I do not think you can use {entity} several times in a template... Could be a bug though.

@Kilowatt-W
Copy link
Author

Hello,

yes you are right, the rest is from auto_entities and its working so far.

I think the problem is as you mentioned, that {entity} cannot be used several times.

The closing Brackets are in the second row because of wordwrap :-) So far it is working

Maybe this can be fixed in future ?

Greetings

Kilowatt

@ildar170975
Copy link

this can be fixed in future ?

What exactly do you mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants