How to use a sensor value for an automation action that is NOT the trigger


I have a athom_presence_sensor_9ce78e, containing among others those two entities:


Then i have an REST service that is working good:

service: rest_command.change_bri
  brightness: 255
  occupancy: 1
  lighting: 255
  message: "some message"

I then have successfully connected those so that the REST Service is called when the athom_presence_sensor_9ce78e_occupancy changes its state.

But now I want to also include the value of the athom_presence_sensor_9ce78e_light_sensor in the REST call. How can I do that? What I tried so far is:

  message: {{sensor.athom_presence_sensor_9ce78e_light_sensor}}
  message: {{sensor.athom_presence_sensor_9ce78e_light_sensor}}.state
  message: {{sensor.athom_presence_sensor_9ce78e_light_sensor.state}}
  message: athom_presence_sensor_9ce78e_light_sensor
  message: sensor.athom_presence_sensor_9ce78e_light_sensor
  message: sensor.athom_presence_sensor_9ce78e_light_sensor.state

but non of them gives me the value. just the text or “[object]”.

Can anyone point me in the direction of the right syntax?
I did not found a solution anywhere in the docs.
Thank you.

Not sure how your topic title relates to the question?


message: "{{ states('sensor.athom_presence_sensor_9ce78e_light_sensor') }}"

Thanks that worked!