Why can't it be done with the switch?

I use the Advanced Custom Motion Sensor blueprint to automate the IKEA VALLHORN sensor. Since the light source it controls is connected to a switch, I created a helper to change device type. Blueprint does not allow the switch entity to be selected.
I edited the domain for a light target. In the blueprint, I replaced light with switch. I could now select switch as the target. Automation was not reporting errors. In TRACES, switching on and off the switch seemingly worked without error. Only that the switch was not responding. Why is this happening? What else would I need to change in the blueprint? The optimal solution would be to add support for two domains:

    light_target:
      name: Light
      selector:
        target:
          entity:
            domain: 
            - light
            - switch

Did you change line 203 and 204 too ?

          - service: light.turn_on
            target: !input light_target

Better way than changing the blueprint might be to change the switch to light

afbeelding

I didn’t have to. It’s already like that in the blueprint.
I created helper and it works. The point is that I want to know the nature of the issue. Why is it so?

Yes, and service

service: light.turn_on

does not work if the target is a switch, then you need

service: switch.turn_on

I wonder why you don’t use

service: homeassistant.turn_on

in such cases.

I did not write the blueprint, I was just trying to explain why the switch did not work.

Why? I didn’t know it was possible. The creator of the blueprint apparently didn’t know either :slight_smile:
I changed it as you suggested. Both switch and light can be selected now. Only that the switch turns on, but doesn’t turn off. When I add a light (in parallel to switch), it is switched on and off as expected. Why so?
Anyway, thanks for the tip.

Perhaps there is (didn’t have a look at the blueprint) a specific turn_off, which has to be replaced by the generic homeassistant.turn_off as well.

OK. I’ll see and change it as well. Thanks for another tip.