I have more or less the same question.
My automation is starting a script, and passing some variables:
- service: script.turn_on
target:
entity_id:
- script.google_location
data:
variables:
worksheet: 'GLocPerson'
devicetracker: 'device_tracker.life360_familymember1'
person: 'person.person1'
sensor: 'sensor.life360_member_adres'
My script (that isn’t working because I don’t know exactly how to use the variables correctly):
google_location:
sequence:
- service: google_sheets.append_sheet
data:
config_entry: cx5xax2xbb75dfxb19c51fbo
worksheet: "{{ worksheet }}"
data:
address: "{{ state_attr('}}{{ devicetracker }}{{','address') }}"
last_seen: "{{ state_attr('}}{{ devicetracker }}{{','last_seen') }}"
latitude: "{{ state_attr('}}{{ devicetracker }}{{','latitude') }}"
longitude: "{{ state_attr('}}{{ devicetracker }}{{','longitude') }}"
gps_accuracy: "{{ state_attr('}}{{ devicetracker }}{{','gps_accuracy') }}"
zone: "{{ states('}}{{ person }}{{') }}"
address2: "{{ states('}}{{ sensor }}{{') }}"
place: "{{ state_attr('}}{{ devicetracker }}{{','place') }}"
speed: "{{ state_attr('}}{{ devicetracker }}{{','speed') | round(0) }}"
mode: queued
I also tried it like this:
address: "{{ state_attr('{{ devicetracker }}','address') }}"
What i’m I doing wrong ?