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

Hello,

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

binary_sensor.athom_presence_sensor_9ce78e_occupancy
sensor.athom_presence_sensor_9ce78e_light_sensor

Then i have an REST service that is working good:

service: rest_command.change_bri
data:
  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?

Anyway:

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

Thanks that worked!