I am using Browser_mod to create custom popups for my lights. Specifically I’m trying to figure out if I can create a template to use on multiple entities.
I have switches that turn on/off lights with an integrated led inside. I have 2 entities that manage this led: one that turns the led on/off when the light is on and one that turns the led on/off when the light is off. So I would like to create a popup to replace the classic more-info, with these two entities.
The light entities are called switch.bedroom_light, switch.bathroom_light, etc. The leds name are switch.bedroom_light_led_if_on, switch.bedroom_light_led_in dark, switch.bathroom_light_led_if_on, etc… The first part of the name are the same of the main entity
Instead of writing for each switch the code for each popup, I would like to create a template that retrieves the entity_id of the button I’m pressing. Is this possible?
This is the popup code:
type: custom:popup-card
entity: switch.bedroom_light
title: impostazioni
size: normal
card:
type: entities
entities:
- entity: switch.bedroom_light_led_in_dark
name: Led luce spenta
icon: mdi:led-off
tap_action:
action: none
hold_action:
action: none
- entity: switch.bedroom_light_led_if_on
name: Led luce accesa
icon: mdi:led-on
tap_action:
action: none
hold_action:
action: none
This is the code of the switch button:
show_name: true
show_icon: true
type: button
tap_action:
action: more-info
entity: switch.bedroom_light
Everithing work fine if I set manually in the popup the entities_id. But I want to shorten my code passing the entity set in the button when it’s pressed