Intene scrip help

Hello,
I have this intent script which replies to a snips request.
Hey snips, turn on bed lights

TurnOnLights:
    speech:
        type: plain
        text: 'Turning on {{ LightLocation }} lights'
    action:
      - service_template: light.turn_on
        data_template:
            entity_id: >
                {% if site_id == 'master_bedroom' %}
                    {% if LightLocation == 'bed' %}
                        light.zipato_bulb_2_level
                    {% else %}
                        light.fantem_oomi_unknown_type_0003_id_0062_level
                    {% endif %}
                {% else %}
                    switch.aeon_labs_zw096_smart_switch_6_switch
                {% endif %}

I managed to control only one entity_id, but i have 2 lights and don’t know how to change the script to turn on both lights.

Did you try separating the entity_ids with a comma?

If this doesn’t work, just create a group containing all the lights you want and then turn on the group instead of the individual entities.

Can you please sow me the syntax on my example?

Add a group containing the lights you want to control in the configuration.yaml like this:

group:
  bedroom_lights:
  name: Bedroom Lights
  entities:
    - light.light_bulb_1
    - light.light_bulb_2
    - etc.

And then in your intent script change ‘light.zipato_bulb_2_level’ or whichever one you want to replace with two bulbs to ‘group.bedroom_lights’.

Take a look at the documentation for groups if you didn’t do this already.

This way i can also trigger an automation?
automation.bedroom_lights

No, this doesn’t make any sense for me. Did you read the link I provided?
No offense, but based on your questions, it feels like you didn’t read any documentation at all.

In your intent script, where exactly do you want to turn on multiple lights and what are the entity ids of these lights?

I did read it and a lot more - the group part works perfect.
I also asked on a different matter if i can trigger an automation by voice.

I’m sorry, seems like I totally misunderstood your question :slight_smile:

Yes, you can also start automations from inside a script, but obviously not with the service ‘light.turn_on’ but with the service ‘automation.turn_on’ or ‘homeassistant.turn_on’.

That’s fine.
You are very helpful.
It is quite hard for non programmers.

I agree it’s hard in the beginning.I’m also not a programmer :wink:
The only advice I can give, don’t give up too quickly! :slightly_smiling_face: