Hey,
I’m trying to make a script that calls a service which needs an integer value Id as extra data field.
Now if I trigger the following script it works:
script:
landroid_start:
alias: Landroid Start
sequence:
service: landroid_cloud.start
data:
id: 12345
Next I want to template the Id value but I can’t get it to work because with every attempt I try to template the value, I pass the correct value but it arrives at the service as a Python String type instead of a Python Integer value… ?
I tried the following examples:
landroid_start:
alias: Landroid Start
sequence:
service: landroid_cloud.start
data_template:
id: "{{ state_attr('sensor.landroid_vanachter_status','id') }}"
landroid_start:
alias: Landroid Start
sequence:
service: landroid_cloud.start
data_template:
id: "{{ state_attr('sensor.landroid_vanachter_status','id') | int }}"
landroid_start:
alias: Landroid Start
sequence:
service: landroid_cloud.start
data_template:
id: "{{ state_attr('sensor.landroid_vanachter_status','id') | int + 0}}"
Is there a way to make the templated value to be passed as a Python Integer value instead of a String?
The service compares the id to a integer and ends up refusing to match the id: “12345” == 12345