Analog value from HA to LOGO 8.4 via MQTT

Hello,

I’m new to HA and I’m trying to understand things.
I want to connect HA with my automation in Siemens LOGO via MQTT.
Sending values or binary states from LOGO to HA is not a problem to control the digital inputs of LOGO from HA I can also handle - there is a lot described here.
Sending a value to LOGO, I can also handle, but I don’t know how to send a value to LOGO from a specific entity ID when LOGO has a strictly defined format for the message to be received.
In my example, 852 is the value I am sending .
And I would like to replace that with the value of the entity ID: sensor.aqara_t1_2 , which is obviously variable.

alias: TEST
description: ""
triggers:
  - seconds: /5
    trigger: time_pattern
actions:
  - data:
      topic: LOGO_SUB
      qos: "0"
      payload: '{"state":{"NAI1":{"value":[852]}}}'
    action: mqtt.publish
mode: single

I’d be grateful for any thoughts on how this could be done.

Thanks