The working script uses devices with device syntax.
The blueprint has all entities which have a completely different syntax, but you tried to copy the syntax over.
Doesn’t work like that.
Different syntax.
Also your logic was if the switch goes off, the light turns on and there was a single condition.
Because of the single condition, or because there was a choose statement at all, an automation Blieprint was better suited.
It’s not an absolute rule, but scripts shine when you give them 1 thing to do and make most of the decisions elsewhere. Not a hard rule, but a good one.
blueprint:
name: switch light patch
description: Turn on a light when switch is turned off.
domain: automation
author: amitja
input:
switch_trigger_id:
name: Switch for light
description: Switch which is connected to Down light
selector:
entity:
filter:
domain: switch
light_trigger_id:
name: down light
description: Down light
selector:
target:
entity:
- domain: light
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input switch_trigger_id
from: "on"
to: "off"
action:
- alias: "Turn on the light"
service: light.turn_on
target: !input light_trigger_id
Thanks for your time and reply, I am trying to call this script from light card as a call service.
Present layout- Zigbee RGB Light bulbs connected to zigbee wall switch.
Logic require:-
When user want to switch ON light bulb from HA - script need to check if wall switch (which is connected to that light bulb) is OFF or ON, if OFF need to switch ON wall switch first than Switch on light bulb or if wall Switch is already ON than just Switch on light Bulb.
if user want to switch OFF light bulb from HA - Script need to Switch off light bulb first than wall Switch.
That’s a different question from the script you started with.
You first step needs to be to create a script that does what you want to do. There isn’t enough logic in that which you presented to get there. Once you have a working script you may not need a script blueprint, but if you feel you still do, convert the script to a blueprint.
I suggest using entities with states and state triggers, but that could work if you are into remembering 32 character hex numbers. I personally find that unusable.
However the script blueprint sequence should look almost exactly like that if it is working. The inputs should be device selectors and the bottom be the value of the inputs.
I’m not used to the goofy device selector syntax, but that is the idea.