Send value from sensor to SMS

Hello everybody.
I recently connected a sim800l to the server. For an additional channel of notification of important events, such as, for example, triggering of a smoke sensor or a water leakage sensor. everything works well.
Now I want to be able to request the status of the sensor via SMS. That is, I send the text message “Temperature” to my server number and expect a message with the temperature from the temperature sensor in response.
At the moment, the server understands the request but does not send data to me.
The whole problem is that I do not understand how to correctly insert the sensor readings into the message text.

- id: '1619615107625'
  alias: sms_msg_temp
  description: ''
  trigger:
  - platform: event
    event_type: sms.incoming_sms
    event_data:
      text: Temperature
  condition: []
  action:
  - service: notify.sms_person1
    data:
      message: binary_sensor.0x158d00042adad4_moisture
  mode: single

If you want to report the state value of binary_sensor.0x158d00042adad4_moisture then you can do it like this:

      message: "{{ states('binary_sensor.0x158d00042adad4_moisture') }}"

What I have suggested is documented here:

1 Like

Excellent!