i’m working on a card that is pulling in data using lovelace_gen and populating a button card.
this particular card is below
{% if light["entity"].split('.')[1] == 'family_room_dimmers' %}
- type: custom:button-card
name: Dimmers
template: room_dimmer
entity: {{ light["entity"] }}
custom_fields:
slider:
card:
type: custom:slider-entity-row
full_row: true
hide_state: false
hide_when_off: false
entity: {{ light["entity"] }}
i have a number of different entities ending in _dimmers that are essentially light groups, and would like to ‘automate’ my card here to catch, if any light[“entity”] ends in _dimmers, not just “family_room_dimmers” to use this template above so i don’t have to duplicate this config a bunch of times using individual if statements because of my poor coding knowledge.
is there something equivalent to the endsWith() javascript method that can be used?
something like
{% if light["entity"].split('.')[1].endsWith('dimmers') %}