#Displaying different state text for an input_boolean

1 messages · Page 1 of 1 (latest)

swift wave
#

I have an boolean helper which, when "on" prevents my garage lights from being turned off.
I have succeeded at exposing this on my dashboard in various ways: badge, button, mushroom-card-<entity, button,light>. All of these show the current state as off/on.
I would like something on my dashboard which toggles the helper between on/off on tap but displays "engaged"/"off" instead of on/off.
I've searched and asked claude + chatgpt but haven't come up with a working solution.
Does anyone here have a solution for me? .

final fog
# swift wave I have an boolean helper which, when "on" prevents my garage lights from being t...

You mentioned mushroom so I suspect you have it installed.
you could use a mushroom template card with something like this.

type: custom:mushroom-template-card
primary: Demo
icon: mdi:mushroom
features_position: bottom
entity: input_boolean.testbool
tap_action:
  action: toggle
secondary: |-
  {% if states('input_boolean.testbool') == 'on' %}
  Engaged
  {% else %}
  Off
  {% endif %}
color: |-
  {% if states('input_boolean.testbool') == 'on' %}
  Yellow
  {% endif %}

swap out the references to input_boolean.testbool to your helper and adjust other customisation as you like.

stiff shoal
#

The custom:button-card is another great option for making cards "do what you want." Here's two examples that function exactly the same.

type: custom:button-card
entity: input_boolean.tester
name: "[[[ return (entity.state == 'on') ? 'Engaged' : 'Off' ]]]"
styles:
  icon:
    - color: "[[[ return (entity.state == 'on') ? 'yellow' : 'red' ]]]"
type: custom:button-card
entity: input_boolean.tester
state:
  - value: "on"
    name: Engaged
    styles:
      icon:
        - color: yellow
  - value: "off"
    name: Off
    styles:
      icon:
        - color: red