Only 6 entities found when adding a label to an Automation (Script)?

Hi,
Please be gentle with me - still very much learning my way around HA…
I’m using Alarmo with some motion sensors and have built an automation (script) which toggles house lights on and off every couple of seconds.
I have added a label “Light” to all lights (about 20) but when I build an action and add the “Light” label as a target only 6 Entities are added…
Is this an in-built limit?
Otherwise, any thoughts as to what I am doing wrong please?
The YAML is:

action: light.turn_on
metadata: {}
data: {}
target:
  label_id: light

If I expand the label items it shows:

action: light.turn_on
metadata: {}
data: {}
target:
  entity_id:
    - light.bedside_light_2_msl450_main_channel
    - light.bedside_light_1_msl450_main_channel
    - light.bathroom_switch
    - light.foyer_switch_1
    - light.bedroom_2_switch
    - light.ensuite_switch_1

Regards, Dave

Copy-paste the following template into the Template Editor. Does it report 6 or 20 entities?

{{ label_entities('Light') }}

Thanks for the reply! More than 6 :slight_smile:

['switch.hallway_switch_2', 'switch.hallway_switch_3', 'switch.living_room_switch_1', 'switch.living_room_switch_2', 'switch.living_room_switch_3', 'switch.living_room_switch_4', 'switch.short_hallway_switch_1', 'switch.front_door_switch_2', 'switch.patio_switch_1', 'switch.washroom_switch_1', 'switch.pantry_switch_1', 'switch.foyer_switch_1', 'switch.hallway_middle_switch_1', 'switch.bathroom_switch', 'switch.toilet_switch_1', 'switch.bedroom_2_switch', 'switch.bedroom3_switch_2', 'switch.laundry_switch_1', 'switch.laundry_switch_2', 'switch.ensuite_switch_1', 'switch.walkin_switch_1', 'switch.garagelight1_switch_1', 'switch.garage_3_light_switch_1', 'light.bedside_light_2_msl450_main_channel', 'light.bedside_light_1_msl450_main_channel', 'light.bathroom_switch', 'light.foyer_switch_1', 'light.bedroom_2_switch', 'light.ensuite_switch_1']

Six light entities and all of the rest are switch entities.

You can’t use light.turn_on to turn on switch entities. Use the homeassistant.turn_on action because it works with light and switch entities.

2 Likes

Thank you!
Really appreciate your help!
(That worked perfectly, btw!)
Cheers, Dave

1 Like

You’re welcome!

Before you go, please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which indicates to others that the topic has been solved. This helps other users find answers to similar questions.

1 Like