@SteveDinn wrote:
I’ve written a small wrapper script that calls decode-config.py that backs up a TASMOTA device’s configuration. I’d like to be able to call it from a
shell_command
while passing a few parameters to it to target a specific device.When I call this:
shell_command: tasmota_backup: '/srv/hass/bin/python "/home/hass/config/python_scripts/tasmota_backup.py" "{{ ip_address }}" "{{ mac_address }}" "{{ friendly_name }}" "{{ tasmota_username }}" "{{ tasmota_password }}"'
like this
- service: shell_command.tasmota_backup data_template: ip_address: > {%- set device_name = trigger.topic.split('/')[1] -%} {{ state_attr('sensor.tasmota_' + (device_name | lower), 'ip_address') }} mac_address: > {%- set device_name = trigger.topic.split('/')[1] -%} {{ state_attr('sensor.tasmota_' + (device_name | lower), 'mac_address') }} friendly_name: > {%- set device_name = trigger.topic.split('/')[1] -%} {{ state_attr('sensor.tasmota_' + (device_name | lower), 'friendly_name') }} tasmota_username: !secret tasmota_username tasmota_password: !secret tasmota_password
I can see in the debug log that all the parameters are passed exactly as they are in the
shell_command
. I.e., the templates are not interpreted. The documentation says this:I think I’m doing it right, but it seems to not work as intended.
Posts: 1
Participants: 1