question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot concat string with entity state

See original GitHub issue

Hi,

I am trying to display either an entity state following by a string or nothing depending on another entity state. I am using this template :

[[ if(binary_sensor.monitoring_ha_updater.state == "on", sensor.monitoring_potential_breaking_changes.state "changes" ,"") ]]

On lovelace side it displays “undefined” as a result instead of “0 changes”. I tried using +,++, . to concat them without success.

Thanks for helping.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
guillaumelamirandcommented, Jan 8, 2020

If you’re not using card-tools for your own plugin, I suggest you instead raise this issue with the maintainer of the plugin you are using.

As the question was regarding the support of templating which you offer with your lib and not the plugin, I thought you were the best person to help me.

In the meantime, I used the following as workarround :

 [[ if(binary_sensor.monitoring_ha_updater.state == "on",
          sensor.monitoring_potential_breaking_changes.state, "") ]] [[
          if(binary_sensor.monitoring_ha_updater.state == "on", "changement(s)
          bloquant(s)", "") ]] 
0reactions
thomaslovencommented, Jan 8, 2020

The better alternative is to use jinja2 templating, which is also supported by card-tools.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I query against a concatenated field?
Below is some example code where I am searching for searchString as a concatenation of firstname and lastname database strings.
Read more >
Translate string.Join and string.Concat · Issue #2981
It's currently making me denormalize my database design because I can't concat strings inside group by.
Read more >
String.Concat Method (System)
Concatenates the string representations of four specified objects and any objects specified in an optional variable length parameter list.
Read more >
Creating dynamic entities names, getting string instead of ...
The siteId is delivered in the payload and can be etxracted (trigger.payload_json.siteId). Then I want to dynamicaly create the object. Problem
Read more >
Common Hibernate Exceptions
expectMessage("Unknown entity: java.lang.String"); Session session = sessionFactory.getCurrentSession(); NativeQuery<String> query = session ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found