[SOLVED] Send helpers' status via MQTT

I am trying to control my air conditioner using home assistant and a NodeMCU ESP8266 board. To do this, every time I change the state of an input_bolean, I send a MQTT message that the ESP8266 receives. Upon receiving the topic and the specified payload, I send the IR message simulating the original remote control. At this point, I am able to turn the AC on and off, as well as control the fan. To send the MQTT messages, I use helpers and automations like the following:

To send the IR message, I am using a library located in github (GitHub - crankyoldgit/IRremoteESP8266: Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/). The format used by my remote control is like this:

Protocol : DAIKIN216
Code : 0x11DA2700C50000D711DA27004200005411DA27000039320050000006600000C00000F3 (280 Bits)
Mesg Desc.: Power: On, Mode: 3 (Cool), Temp: 25C, Fan: 3 (Medium), Powerful: Off, Quiet: Off, Sensor: Off, Mould: Off, Comfort: Off, Swing(H): Off, Swing(V): Off, Clock: 00:00, Day: 0 (UNKNOWN), On Timer: Off, Off Timer: Off, Weekly Timer: On

This means that I have to transmit everything in each message. For example, if I want to program the AC to turn off in 30 minutes, I must also send whether it was on or not or the temperature, among others.

For this, the solution that I think could work is to send the status of the rest of the helpers. For example, if I change the state of the input_bolean to turn on or off the AC, send the state of the rest of the helpers that control the AC. Is there any way to do this?

I am able to send the status of the helper changing value, but I cannot send the value of other dashboard helpers.

alias: AC_fan
description: ""
  - platform: state
      - input_select.ac_fan
    to: "1"
condition: []
  - service: mqtt.publish
      qos: "0"
      retain: false
      topic: AC/fan
      payload_template: "fan: {{trigger.to_state.state}}"
mode: single

For a start, having a null “to” in your trigger will trigger on any state change:

  - platform: state
      - input_select.ac_fan

Then you just have to add the same sort of trigger for all the other helpers.

In your mqtt message use the state of all the helpers rather than the trigger variable:

payload_template: "Power: {{states('(input_boolean.power')|title}}, Mode: {{ states('input_select.mode') }} etc...."

Thanks a lot!