Following this example I would think that I am almost there.
However I get this error when executing the automation. the scripts that run the shell command work perfectly separately and scripts too.
Errors:
Cam Patrols: Error executing script. Error for call_service at pos 1: Template rendered invalid entity IDs: - script.ptz_slider_add - script.cptz_2
Logger: homeassistant.components.automation.cam_patrols
Source: helpers/script.py:1324
Integration: Automation (documentation, issues)
First occurred: 2:43:37 AM (3 occurrences)
Last logged: 12:23:42 PM
Cam Patrols: Error executing script. Error for call_service at pos 1: Template rendered invalid entity IDs: - script.ptz_slider_add - script.cptz_2
Cam Patrols: Error executing script. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data['entity_id']
Error while executing automation automation.cam_patrols: Template rendered invalid entity IDs: - script.ptz_slider_add - script.cptz_2
Logger: homeassistant.components.automation.cam_patrols
Source: components/automation/__init__.py:504
Integration: Automation (documentation, issues)
First occurred: 2:43:37 AM (3 occurrences)
Last logged: 12:23:42 PM
Error while executing automation automation.cam_patrols: Template rendered invalid entity IDs: - script.ptz_slider_add - script.cptz_2
Error while executing automation automation.cam_patrols: not a valid value for dictionary value @ data['entity_id']
Scripts: ptz1 , ptz2, ptz3 etc
scripts (works ok)
Execute shell ssh and move the camera
alias: cptz_1
sequence:
- service: shell_command.pos_1
mode: single
Input slider +1
alias: ptz_Slider_add
sequence:
- condition: numeric_state
entity_id: input_number.ptz_1
below: '4'
above: '0'
- service: input_number.increment
target:
entity_id: input_number.ptz_1
mode: single
Reset Slider to 1 if reach 4
alias: ptz_Slider_zero
sequence:
- condition: numeric_state
entity_id: input_number.ptz_1
above: '3.0'
below: '5.0'
- service: input_number.set_value
target:
entity_id: input_number.ptz_1
data:
value: 1
mode: single
my configuration.yaml (works ok)
shell_command:
pos_1: 'ssh -o UserKnownHostsFile=/config/.ssh/known_hosts [email protected] -i /config/.ssh/id_rsa ''onvif-ptz goto-preset --baseUrl=http://192.168.88.43 -u=admin -p=XXXXX --preset=1'''
Automation:
alias: Cam Patrols
description: ''
trigger: []
action:
- service: script.turn_on
data_template:
entity_id: |
{% if is_state('input_number.ptz_1', '1.0') %}
script.ptz_slider_add
script.cptz_2
{% elif is_state('input_number.ptz_1','2.0') %}
script.ptz_slider_add
script.cptz_3
{% elif is_state('input_number.ptz_1', '3.0') %}}
script.ptz_slider_add
script.cptz_4
{% elif is_state('input_number.ptz_1', '4.0') %}}
script.cptz_1
script.ptz_Slider_zero
{% endif %}
mode: single