Hi there,
I have a number of lights and I want them all to use the same template. Is there a way that I can apply this on a more global level instead of applying it to each one individually?
Here is the code I’m referring to. Any input would be appreciated.
type: 'custom:config-template-card'
variables:
front_porch_light_state: 'states[''switch.front_porch_light''].state'
back_porch_lights_state: 'states[''switch.back_porch_lights''].state'
garage_lights_state: 'states[''switch.garage_lights''].state'
bocce_lights_north_state: 'states[''switch.bocce_lights_north''].state'
bocce_lights_south_state: 'states[''switch.bocce_lights_south''].state'
entities:
- entity: switch.front_porch_light
- entity: switch.back_porch_lights
- entity: switch.garage_lights
- entity: switch.bocce_lights_north
- entity: switch.bocce_lights_south
card:
type: entities
title: Lighting
state_color: true
show_header_toggle: true
entities:
- entity: switch.front_porch_light
icon: >-
${front_porch_light_state === 'off' ? 'mdi:lightbulb-outline' :
'mdi:lightbulb-on'}
- entity: switch.back_porch_lights
icon: >-
${back_porch_lights_state === 'off' ? 'mdi:lightbulb-outline' :
'mdi:lightbulb-on'}
- entity: switch.garage_lights
icon: >-
${garage_lights_state === 'off' ? 'mdi:lightbulb-outline' :
'mdi:lightbulb-on'}
- entity: switch.bocce_lights_north
icon: >-
${bocce_lights_north_state === 'off' ? 'mdi:lightbulb-outline' :
'mdi:lightbulb-on'}
- entity: switch.bocce_lights_south
icon: >-
${bocce_lights_south_state === 'off' ? 'mdi:lightbulb-outline' :
'mdi:lightbulb-on'}