How to set state text..?

Hi,

I want to change the state text from “Aus” to “closed”…

grafik

type: entities
entities:

  • entity: cover.zentral_eg
    name: Jalousie EG
    secondary_info: last-changed
  • entity: cover.zentral_og
    name: Jalousie OG
    secondary_info: last-changed
  • entity: scene.lichtegaus
    icon: ‘mdi:lightbulb’
  • entity: scene.lichtogaus
    icon: ‘mdi:lightbulb’
  • entity: scene.couch
    icon: ‘mdi:sofa’
  • entity: binary_sensor.garagentorknx
    icon: ‘mdi:garage-variant’
    title: ZENTRAL
    show_header_toggle: false
    state_color: false

Thanks for your help

I can think of a couple of options here. The first is to create a second “dummy” sensor that uses a template to provide the state you want. For example, you could create a sensor template as follows:

- platform: template
  sensors:
    garage_door_status:
      friendly_name: Garage door status
      value_template: >
        {% if is_state('binary_sensor.garagentorknx','Aus') %} Closed
        {% else %}                                             Open
        {% endif %}

Then use sensor.garage_door_status as your entity.

The second option is to use custom:button-card. It’s very configurable and might seem a little intimidating at the outset. You can find information on that here: GitHub - custom-cards/button-card: :sparkle: Lovelace button-card for home assistant. Using this custom card gives you a ton of flexibility, but there is a somewhat steep learning curve. The payoff is that you can do about anything you want with it.

The easiest approach is probably the first suggestion - you can add a template and, as long as you’re running a recent version of HA, you can reload the templates without having to re-start HA (big help in being able to do that!).

Hope this help!

PSA: I suggest always formatting your yaml entries as described in the forum - it makes it a lot easier to read and figure out… You’ll get more help from folks, too - yaml is difficult enough to format, but it’s almost impossible to read if it’s not formatted properly (you do this by clicking the </> in the header.

2 Likes

Thank you!

Today, i want try to install the button-card!
i can’t find this card under “HACS-Frontend”

… so i had insert

resources:
  - url: /local/button-card.js
    type: module

to my configuration.yaml!
and uploaded the .js file in my “www” folder!

Get the following message in lovelace…

No card type found

  • type: ‘custom:button-card’
    entity: switch.ac
    icon: ‘mdi:air-conditioner’
    color: ‘rgb(28, 128, 199)’

all other cards, like entity-slider-row are working fine!

thank you for your help!

bg andy

Hi, @a.setzer - you may not have added everything you need in the configuration.yaml file. Here’s what I have (per the docs here: Dashboards and Views - Home Assistant (home-assistant.io)):

lovelace:
  mode: yaml
  resources: !include lovelace/resources.yaml

Instead of including a resources.yaml file, you can add it like this for your case:

lovelace:
  mode: yaml
  resources:
    - url: /local/button-card.js
      type: module

Alternatively, you can create a lovelace directory in the main directory, and then put a resources.yaml file in it that has this content, and then point to it like I did above using the !include statement:

#Resources include file for ui-lovelace.yaml
- type: module
  url: /local/button-card.js

Did you perchance restart HA after making the change to the config file? I think that needs to be done to reload the resources.

If none of this works, then can you post a little more of your complete lovelace section in your configuration.yaml file? We’ll get it figured out!

Complete configuration.yaml

don’t want to switch to mode:yaml

#########
#LOVELACE
######### 
lovelace:
  resources:
    - url: /local/xiaomi-vacuum-card.js?v=4.1.0
      type: module
    - url: /local/slider-entity-row.js
      type: module
    - url: /local/button-card.js
      type: module

Got it.

Okay, that seems all in order, and the fact that entity-slider-row works is encouraging.

Did you restart HA after adding button-card to the resources section?

If so, then lets take a closer look at how your used the button-card. Can you show a complete section of that? Is the error message include any additional information, or does it also show the button-card information?

Here’s a simple example of how I use it to create a title block:

  - badges: []
    cards:
      - cards:
          - type: 'custom:button-card'
            color_type: label-card
            color: 'rgb(44, 109, 214)'
            show_name: true
            show_label: true
            name: Light/TV Actions
        type: horizontal-stack   <----- EDIT: forgot to have this in there the first time (2021/01/23)

I switched my config around so it isn’t in yaml mode. I then attempted to add a custom button card to the page. I ended up with this:
image

So now I’m thinking that there’s something that keeps this particular custom card from working through the UI editor… Is there any way you can (temporarily) try it in yaml mode? I don’t know what else could be wrong at this point, as you’ve done everything else correctly from what I can tell… It seems you had the same type of error:
image

For what it’s worth, there are benefits to using yaml mode (using the include directive is a big one for me - it lets me break the file into several more compact ones), but I totally understand if you don’t want to go that route.

Forgot to mention - the this._configElement is a part of the custom card.

switch to mode: yaml doesn’t work too.
my other cards also work no longer in mode: yaml

I realized I forgot the closing type: statement for the cards: that contain things. I edited the post above to include it, and here it is again:

views:
  - title: Test Page
    icon: 'mdi:test-tube'
    badges: []
    cards:
      - cards:
          - type: 'custom:button-card'
            color_type: label-card
            color: 'rgb(44, 109, 214)'
            show_name: true
            show_label: true
            name: Light/TV Actions
        type: horizontal-stack

I picked the horizontal-stack type, but you can use any of the appropriate types here. This is at the top of my yaml file just under the views: line and it works. Sorry about forgetting the type line!

Here’s a screen shot of the above Test Page (which isn’t interesting at all, but shows the above works now):

@KSC Bit late to the party, but how would one use this with say a time? Like status open for 5minutes? (as per the gui for: 00:00:00 condition).