Trying to pass variables to a script using a template in Lovelace.
Script fires, but no data passed as evidenced by the persistent notification.
Not sure what I’m doing wrong, have tried several variations on this theme…
Probably something obvious and stupid!
(n.b. I haven’t implemented the time aspect yet, need to get this working first)
Lovelace:
entities:
- entity: input_select.all_cameras
icon: 'mdi:numeric-1-box'
name: Which Camera?
- entity: script.camera_off_and_on_again
name: Turn Off
action_name: Turn Off
tap_action:
action: call-service
service: script.camera_off_and_on_again
service_data_template:
camera_id: |
{% if states('input_select.all_cameras') == "Front" %}
camera.aarlo_front
{% elif states('input_select.all_cameras') == "Back" %}
camera.aarlo_back
{% endif %}
show_header_toggle: false
title: Camera Mode
type: entities
Script:
# this is a script to turn a camera off and back on a specified time later
camera_off_and_on_again:
alias: Turn Camera off and back on again later
sequence:
- service: persistent_notification.create
data_template:
message: "Cam Off On {{camera_id}}"
title: Cam Off On
notification_id: 1234