steinis
(stein)
September 27, 2023, 6:12pm
1
How can i pass a variable to a script from blueprint?
This is mye action from blueprint:
sequence:
- service: script.turn_on
target:
entity_id: !input script
data:
action: Auto
This is what I see in log:
service: script.turn_on
target:
entity_id:
- service: script.201_gangnede_lys
data: {}
data:
action: Auto```
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
September 27, 2023, 6:26pm
2
I do this a lot. Read thru this blueprint helper file and you will see several examples where I explain how to add accessories to this BP.
(128 possible actions!!) Aqara works with T1 Pro and older cubes. This Blueprint uses a ZHA built sensor to sort out the 38(+54) commands available from the Xiaomi Magic Cube. This gives you the ability to trigger actions using the remote. NOTICE: Using this Blueprint and example scripts, this cube *can* be triggered over a hundred ways, but only 38(+54) of them are unique...
## 📑 Changelog
* **2023-08-07**: Updates for Home Assistant 2023.8
* * Selector syntax change
* * Condition Selector addition (where applicable)
* * MQTT Discovery name changes (where applicable)
* * Clean-up code formatting
* **2023-03-01**: Add Author Tag. Bump HA required Version to 2023-3-0
* **2023-01-19**: Add instructions for new cube version ```Cube T1 Pro``` Action mode setup in Docs.
* * Add note that Drop is no longer available if using the ```Cube T1 Pro``` cube version.
* **2022-12-12**: Add Update Method Note, minor code change.
* * Name of Blueprint may have changed meaing you have to re-download with a new link.
* * If name changed, it is similar. Variables have not changed.
* **2022-11-30**: 🎉📦🔋 First Version
<base target="_blank">
## 🔧 * Hardware Versions
This file has been truncated. show original
steinis
(stein)
September 27, 2023, 8:25pm
3
do you mean like this?
sequence:
- service: !input script
data:
action: Auto
This is giving me the same error
steinis
(stein)
September 28, 2023, 5:28am
6
Your are referring to a code that has a script that is given. I need that script to be an input. This is the problem, it seems that when I use an input for the script it adds a second data.
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
September 28, 2023, 9:35am
7
I have always done this in an action selector with the data being in templates but the name of the script known.
You cannot put !inputs in as part of !input fields. HA has no idea how to map the substitutions at that point and syntax fails.
You could do something like this:
I played around with this because curious. Apparently the code segment you plug in does have to render. and as I suspected !inputs cannot go in the default because they will not render. So you can do this…
tap_1:
name: Single click on Button 1 action
default:
- service: climate.set_temperature
target:
entity_id: climate.entity
data_template:
temperature: "{{ states('input_number.heating_deadzone') | float + states('input_num…
steinis
(stein)
September 29, 2023, 4:38pm
8
Thanks for help, but I can’t get this to work:P
- service: script.turn_on
data_template:
action: "auto"
target:
entity_id: !input script
- service: script.turn_on
data:
action: "auto"
target:
entity_id: !input script
These service calls dont trigger det script right, and I can’t see why?
This is the output:
Is there any other way to make this work?