How to diagnose "The service homeassistant.turn_on cannot be called without a target"

In the log I see different:

2024-01-07 14:54:09.884 ERROR (MainThread) [homeassistant.components.homeassistant] The service homeassistant.turn_on cannot be called without a target
2024-01-07 14:54:36.143 ERROR (MainThread) [homeassistant.components.homeassistant] The service homeassistant.turn_off cannot be called without a target
2024-01-07 15:21:27.968 ERROR (MainThread) [homeassistant.components.homeassistant] The service homeassistant.turn_off cannot be called without a target

but I cannot understand what they are related to.
Is there any way to diagnose?
Which is the service that gives an error?

Thank you
M

Search your automations and scripts for: “homeassistant.turn”.

You have forgotten to supply an entity_id in at least two places where you have used these services. Or if using templates the templates are not resolving correctly to an entity_id for these services.

It tells you in the error:

Thank you!

In my automations.yaml there is no homeassistant.turn
I have all switch.turn_

in my blueprint I have:

action:
- service: homeassistant.turn_{{ trigger.to_state.state }}
  target:
    entity_id: '{{ expand(switches) | selectattr("entity_id", "!=", trigger.entity_id)
      | map(attribute="entity_id") | list }}'

I have it in 4 blueprints…

is there a way to see which one is faulty?

I’ve added this in the scripts in the action part:

- service: notify.autolog
  data:
    title: "link_multiple_switches_timer_timeout"
    message: '{{ expand(switches) | selectattr("entity_id", "!=", trigger.entity_id)
      | map(attribute="entity_id") | list }}'

hoping it will log them :slight_smile:

If you manually triggered that automation blueprint it would cause those errors.

Manually triggering an automation skips the triggers and thus there would be no trigger variables for that template.