Savjee/button-text-card

Add show_condition (opposite of hide_condition)

emeyedeejay opened this issue · 1 comments

Hi there

A feature request, please: As you have for hide_condition, could you add a show_condition.

This would make it much easier to show buttons if something happens.

e.g. a door open/closed pair of buttons. With hide_condition, you need to hide the button for the state opposite of the button's state.

Am I making any sense??!

I understand your point of view.
However, I'm not going to implement this. It would conflict with hide_condition.
I suggest using the ! operator to flip the hide_condition.

Eg: you want a card to be shown when door is open:

hide_condition: |
  [[[
    const active_players = Object.entries(states).filter(e => e[0].indexOf('media_player.')===0 && e[1].state === 'playing');
    return entity.state === "off";
  ]]]

Or:

hide_condition: |
  [[[
    const active_players = Object.entries(states).filter(e => e[0].indexOf('media_player.')===0 && e[1].state === 'playing');
    return entity.state !== "on";
  ]]]