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.

Show both name and state text in a button?

See original GitHub issue

Is it possible to show both name and state text (of either the button’s entity, or ideally the state of a different entity) as part of a button? I’m trying to create a button representing an outlet that displays its name above an icon which shows the outlet state via colour and toggles the outlet’s switch when clicked, as well as show the outlet’s power usage (captured in the state of a template sensor exposing an attribute of the outlet) underneath the icon.

I have only been able to use the state_text map to show static text on the button, but this text replaces the name, and also this mechanism isn’t ideal for numeric sensors that don’t have a limited set of discrete values that one can create a map for.

I can almost do this with a glance card button and a custom tap_action to implement the toggle, except I can’t get the icon colour to reflect the state because the button’s underlying entity needs to be the power usage sensor in order to show the power usage underneath the icon. So I was hoping maybe to be able to implement it through this plugin.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
jcwilloxcommented, Aug 22, 2020

I agree and both templating and an actual separate state field will be in the next update, whenever that is.

2reactions
jcwilloxcommented, Feb 15, 2021

This has been fixed in release 0.5.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

change button text and state by click and show list in react ...
At the top, I have three buttons, watched and not watched , which one I clicked on. Show me the list of the...
Read more >
Changing button text multiple times
Hi - I'm trying to get the text on a button to change to something different more than once. So for example, the...
Read more >
<input type="button"> - HTML: HyperText Markup Language
Button with a value​​ An <input type="button"> elements' value attribute contains a string that is used as the button's label.
Read more >
Toggle Button Text On Off in ReactJS State | React JS Tutorial
ReactJS allows toggling state easily to manipulate frontend elements of your choice. This video covers how can you change text inside a ...
Read more >
HTML button tag
Inside a <button> element you can put text (and tags like <i> , <b> , <strong> , <br> , <img> , etc.). That...
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