Hi all,
I’m having problems constructing a templated entity_id from the friendly name of a sprinkler switch to pass as a field variable to a script that turns on a quick irrigation run.
Here’s the script. As you can see there are two fields, zone and duration, which are required for the service call to the sprinkler switch.
alias: Start Quick Run
description: ""
fields:
zone:
name: Zone
description: Zone to run
required: true
example: switch.back_east_fence
duration:
name: Duration
description: Minutes to run
required: true
example: 10
sequence:
- if:
- condition: state
entity_id: input_boolean.rachio_pause
state: "on"
then:
- service: rachio.resume_watering
data: {}
else:
- service: rachio.start_watering
data:
duration: "{{duration}}"
target:
entity_id: "{{zone}}"
Here’s the tap action section of the Mushroom Template card.
tap_action:
action: call-service
service: script.quick_run
data:
zone: '{{''switch.'' + states(''input_select.irrigation_zone'') | slugify}}'
duration: '{{ states(''input_number.quick_run_minutes'') | int }}'
Here’s the template in developer tools showing the expected output:
However, when called from the Mushroom Template card, I get the following error message: “Failed to call service script/quick_run. Template rendered invalid entity IDs: {{‘switch.’ + states(‘input_select.irrigation_zone’) | slugify}}”.
I’ve also tried this in the Mushroom card without luck. The editor sets the quotes or lack of.
zone: switch.{{states(‘input_select.irrigation_zone’) | slugify}}
I don’t want to use a selector in the script because it is used across several watering functions that aren’t all garden irrigation.
Any help appreciated.
