Help with script

Hello,
Yesterday I installed hass.io image on raspberry pi 4. I copied the files from my hassbian and everthing works better except one script. The script is controling AC with wemos D1 board. I have the codes of the remote controller of the AC. I used input_number and input_select in hassio. The script worked for me but now I don’t know why it’s not working. I have 3 automations that in every change in state calling the script.
It’s how I wrote the script not in the script editor of the hassio and hassbian:

'1587939407685':
  alias: AC Commands
  sequence:
  - service: mqtt.publish
    data:
      topic: cmnd/AC_LivingRoom/IRsend
      payload_template: {% if is_state('input_select.ac_switch','False') %} 0,8984,4500,644,564,640,564,644,1664,644,560,648,564,640,568,640,1664,644,560,648,1660,648,564,644,560,644,1672,640,560,644,560,648,564,640,564,644,564,644,560,644,560,648,564,640,560,648,1664,644,568,640,564,640,568,640,620,584,564,644,564,644,1660,644,564,644,1668,640,564,644,560,648,1660,648,564,640,19996,648,1664,644,564,644,568,640,564,644,564,640,560,648,564,640,564,644,564,640,564,644,568,640,560,644,568,640,568,640,564,640,568,640,624,580,564,644,564,644,564,640,568,640,568,640,564,644,564,640,564,644,564,640,568,640,564,644,1668,640,1664,644,1668,640,564,644 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 16 %} 0,8984,4500,616,592,616,592,612,1696,616,1692,612,596,612,592,640,1668,640,568,616,592,612,596,636,568,616,592,616,592,612,592,616,592,612,596,612,592,612,596,612,596,612,592,616,592,612,1696,616,1692,612,596,612,592,616,592,616,592,612,596,612,1696,612,592,616,1692,612,596,612,596,612,1696,612,592,616,20032,640,1668,640,568,612,592,616,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,592,616,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,596,612,592,616,592,612,596,612,592,616,592,616,592,612,1696,612,1696,612,596,612 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 17 %} 0,8984,4500,612,596,640,564,616,1692,616,1696,612,592,616,592,616,1692,640,568,616,1692,640,568,612,592,640,568,616,592,636,572,612,592,616,592,612,592,616,592,632,576,612,596,612,592,616,1692,640,1672,612,592,616,592,612,596,612,592,616,592,612,1696,612,596,612,1696,612,596,636,568,616,1692,612,596,616,20028,616,1696,612,592,616,592,612,592,616,592,616,592,612,596,636,568,616,592,612,592,616,592,616,588,644,564,616,592,612,596,612,604,604,592,616,592,612,592,616,592,612,592,640,568,616,592,612,592,616,592,616,592,640,576,604,592,616,1692,616,1696,612,1696,616,592,612 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 18 %} 0,9012,4560,580,564,644,564,640,1672,636,1728,580,572,636,628,576,1672,640,624,580,568,640,1668,644,568,636,564,644,576,628,568,640,568,640,624,580,568,640,568,636,568,640,572,636,564,640,1672,636,1672,636,568,640,568,640,624,580,568,640,624,584,1668,640,568,640,1668,640,568,636,628,580,1728,580,572,636,19996,644,1668,640,568,640,568,640,624,580,568,640,568,640,568,640,560,644,572,636,564,644,564,640,568,640,568,636,564,644,624,584,624,580,564,644,568,640,568,640,620,584,624,584,624,584,564,640,568,640,564,640,568,640,624,580,628,580,568,640,568,640,568,636,1668,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 19 %} 0,8948,4500,640,568,640,568,636,1672,640,1668,640,624,580,568,640,1672,636,568,640,1668,640,1672,636,564,644,568,636,568,640,568,640,568,640,564,640,568,640,568,636,572,640,620,584,564,640,1728,584,1668,640,568,636,568,640,568,636,568,644,624,580,1672,636,572,636,1668,640,568,640,568,636,1672,640,568,636,20064,580,1672,640,568,636,572,636,572,636,568,640,568,636,564,644,568,636,628,580,624,580,568,644,564,640,568,636,572,636,584,624,572,636,568,640,624,580,628,580,628,580,568,640,560,644,568,640,564,644,568,636,568,640,568,640,568,636,1672,636,568,640,568,640,1664,644 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 20 %} 0,9016,4560,580,568,640,572,636,1668,640,1668,640,568,636,628,580,1672,640,568,636,624,580,572,640,1728,580,624,580,568,640,564,644,568,636,628,580,568,640,624,580,628,580,568,640,568,636,1732,576,1676,632,568,640,572,636,572,632,572,636,576,632,1672,636,572,636,1668,640,572,632,568,640,1672,636,568,640,20008,640,1668,640,568,636,628,580,572,636,568,636,568,640,572,636,568,636,572,636,572,636,568,636,572,636,572,636,568,636,568,640,568,640,580,624,572,636,568,640,568,636,580,628,628,580,568,640,568,636,628,580,624,580,572,636,572,636,624,580,1728,584,568,640,1664,644 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 21 %} 0,8984,4504,640,564,640,572,636,1664,644,1728,584,568,636,572,636,1668,640,568,640,1668,636,568,640,1728,580,572,636,568,636,572,636,568,640,568,636,568,640,580,628,624,580,568,640,568,636,1728,580,1672,640,568,636,568,640,568,640,568,636,568,640,1672,636,572,636,1664,644,564,640,568,640,1728,580,568,640,19984,660,1668,640,568,636,628,580,568,640,624,584,568,636,572,636,568,640,568,640,568,636,568,640,568,636,572,636,624,584,564,640,572,636,568,640,560,644,576,632,568,636,568,640,568,640,564,640,572,636,568,640,564,644,564,640,564,644,1668,640,1668,640,624,584,1664,644 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 22 %}0,8984,4532,608,572,636,568,636,1672,636,1672,640,624,580,568,640,1672,636,564,644,564,640,1668,644,1728,576,568,644,564,640,568,640,568,636,572,636,624,580,628,580,568,640,572,632,568,640,1724,584,1672,636,568,640,624,580,568,640,568,640,564,640,1668,640,568,640,1728,580,564,644,564,644,1668,640,568,636,20000,644,1672,636,572,636,568,640,564,640,572,636,628,580,568,636,572,636,568,640,624,580,628,580,624,584,568,640,568,636,568,640,624,584,568,636,624,584,568,640,568,636,568,640,568,640,564,640,568,640,564,640,568,640,568,636,572,636,628,580,624,580,1672,640,1664,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 23 %} 0,8988,4496,648,568,636,624,580,1668,640,1728,580,568,640,568,640,1664,644,560,644,1668,640,1672,636,1668,644,568,636,568,640,568,640,568,636,572,636,568,636,572,640,560,644,568,640,620,584,1668,640,1672,636,568,640,568,636,568,640,572,636,568,636,1668,644,564,640,1668,640,568,640,564,640,1672,636,572,636,20008,640,1664,644,568,636,568,640,568,636,568,640,624,584,564,640,568,640,568,640,564,640,568,640,568,640,564,644,568,636,564,640,628,580,568,640,564,644,564,640,568,640,564,644,564,640,568,640,564,640,568,640,568,640,564,644,560,644,1672,636,568,640,1668,640,1668,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 24 %} 0,8988,4500,644,564,640,564,644,1664,644,1664,644,560,648,560,644,1664,648,620,584,564,644,564,640,564,644,1664,644,564,644,564,640,564,644,568,640,564,644,560,644,564,644,564,640,564,644,1660,644,1672,640,568,636,568,640,624,584,564,640,564,644,1668,640,564,644,1664,644,560,648,564,640,1664,644,564,644,19996,648,1668,640,560,644,568,640,560,644,564,644,564,644,620,588,624,580,568,640,568,640,564,640,568,640,564,644,564,640,564,644,564,644,560,644,564,644,564,644,560,644,564,644,568,640,564,640,564,644,568,640,564,640,568,640,560,644,572,636,1668,640,1664,648,1660,648 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 25 %} 0,8980,4560,580,564,640,628,580,1728,580,1728,580,568,640,628,576,1672,636,628,580,1684,624,568,640,568,640,1728,580,564,644,580,624,572,636,568,640,624,580,572,636,568,640,624,580,628,580,1728,580,1676,632,572,632,580,604,592,640,568,640,576,628,1672,636,568,640,1728,580,572,636,628,576,1676,636,568,636,20064,580,1672,640,568,636,572,632,576,632,576,604,596,636,572,636,568,640,572,632,568,640,628,580,568,636,572,636,568,640,572,632,628,552,600,636,564,644,568,636,572,636,624,580,628,580,568,640,568,640,564,640,572,636,568,636,572,636,1680,628,1676,632,1668,640,1668,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 26 %} 0,9012,4500,640,568,640,568,640,1664,644,1668,636,628,580,604,604,1668,640,568,640,624,580,1672,636,572,636,1728,580,568,640,568,636,568,640,568,640,568,636,572,636,564,640,572,636,568,636,1672,636,1672,640,568,636,568,640,624,580,572,636,564,644,1668,640,568,636,1672,640,568,644,560,640,1672,636,568,640,20004,636,1668,640,568,640,628,576,628,580,568,640,568,640,568,636,568,640,564,644,564,640,572,636,624,584,568,636,568,640,624,584,568,636,568,640,568,636,572,636,568,640,568,636,568,640,572,636,568,636,628,580,568,636,568,640,568,640,568,640,568,636,624,584,568,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 27 %} 0,8984,4504,636,568,640,624,580,1672,636,1672,636,572,636,568,640,1668,636,576,632,1668,640,1668,640,568,640,1668,640,568,640,568,636,564,644,568,640,568,636,568,640,572,632,572,636,572,636,1672,636,1672,636,628,576,572,636,572,636,564,640,572,640,1668,636,572,636,1668,640,572,636,568,636,1728,580,568,640,20040,604,1672,636,572,636,568,640,572,632,616,592,568,640,568,636,564,644,624,584,572,632,572,636,568,636,628,580,568,640,624,580,568,640,624,580,572,636,572,632,576,636,568,640,568,636,568,640,564,644,576,628,576,628,572,636,572,636,1672,636,568,640,568,636,572,636 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 28 %} 0,8984,4504,636,568,640,568,640,1672,636,1728,580,628,580,568,636,1676,632,572,636,572,636,568,640,1668,640,1668,640,628,576,572,636,568,640,572,636,584,620,568,640,568,640,568,636,572,636,1728,580,1728,580,624,584,576,628,568,640,572,636,568,640,1668,640,568,636,1672,640,568,640,568,636,1672,640,564,640,20012,632,1732,576,628,556,592,640,568,640,624,552,600,636,572,632,572,636,572,636,624,584,624,580,572,636,624,580,572,636,628,580,572,632,572,636,572,636,568,640,576,628,576,632,572,636,564,640,564,644,568,640,564,640,568,640,568,640,568,636,1668,644,564,640,628,576 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 29 %} 0,9012,4500,640,568,640,568,612,1696,640,1668,612,596,612,592,616,1692,612,596,640,1668,640,576,604,1696,636,1668,644,568,636,568,612,596,612,592,616,592,624,584,612,592,640,568,640,564,616,1692,640,1672,640,564,644,564,612,604,604,592,640,568,612,1696,640,568,640,1668,640,568,612,600,608,1692,640,576,608,20024,616,1696,640,568,612,592,640,568,640,568,640,572,608,592,612,604,604,604,600,596,612,592,640,572,636,568,636,576,632,568,612,608,600,596,636,568,640,564,640,568,640,568,640,572,608,600,604,592,640,568,616,592,612,596,612,596,636,1680,604,1756,552,592,616,592,612 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 30 %} 0,8980,4504,640,564,616,604,628,1672,612,1696,612,592,616,592,612,1696,640,628,556,588,620,1692,612,1696,616,1700,608,592,612,592,624,584,640,568,612,592,640,568,612,600,632,576,632,568,612,1696,612,1696,612,596,640,564,616,592,616,592,628,588,604,1696,612,600,632,1672,612,592,640,568,616,1692,612,596,636,20004,616,1696,612,656,552,592,640,568,636,568,640,568,612,596,612,592,616,600,608,592,612,592,616,592,612,596,612,604,604,592,640,564,616,592,640,576,608,600,604,592,640,568,616,592,612,592,616,592,612,604,608,596,608,600,604,596,640,564,640,576,604,1696,616,592,640
 {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 16 %} 0,9008,4504,612,1696,612,592,616,592,612,1696,616,592,612,592,616,1692,616,592,616,592,616,592,612,592,616,592,640,568,612,592,616,592,616,592,612,592,612,596,612,596,612,592,616,592,616,1692,616,1696,612,592,616,592,612,592,616,592,612,596,612,1696,612,592,616,1692,616,592,612,592,616,1692,620,592,612,20028,616,1696,612,592,616,592,612,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,596,612,592,612,596,612,592,612,596,612,596,612,592,616,592,612,592,616,592,612,596,612,596,612,592,612,596,612,592,616,592,612,1696,612,1696,616,592,612,596,612 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 17 %} 0,8924,4496,640,1676,632,576,608,596,636,1680,628,572,632,568,640,1668,640,576,632,1672,608,592,640,568,640,580,600,592,640,628,552,604,632,564,640,568,640,576,628,572,612,592,640,564,620,1688,632,1676,640,568,640,572,636,564,640,568,612,600,608,1692,616,600,608,1700,608,592,640,564,640,1668,624,596,628,20004,612,1696,616,592,612,592,616,592,616,592,636,568,616,592,616,592,612,592,616,592,616,592,612,592,640,568,616,592,640,572,608,592,616,592,612,604,604,592,640,568,612,592,640,568,616,592,612,592,616,592,612,592,640,568,616,588,616,592,616,592,640,1668,616,588,616 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 18 %}0,8984,4504,636,1668,640,568,640,564,640,1668,644,564,640,624,584,1664,644,568,640,624,580,1668,640,568,640,568,640,564,640,568,640,568,640,564,640,568,640,568,640,568,636,568,640,568,640,1664,644,1672,636,568,640,568,636,572,636,568,640,568,640,1668,640,564,640,1728,580,572,636,568,640,1668,640,568,640,20004,640,1668,640,568,640,564,640,564,648,560,644,568,640,564,644,620,584,564,644,624,580,568,640,564,644,624,580,568,640,568,640,568,640,564,644,620,584,568,640,564,644,564,640,564,644,568,640,568,636,628,580,568,640,560,648,564,640,1664,644,564,644,1664,644,564,644 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 19 %} 0,8984,4504,636,1728,580,572,636,568,636,1728,580,628,560,592,636,1728,580,568,640,1668,640,1672,636,568,640,568,636,568,640,568,636,564,644,624,580,572,636,568,640,576,600,600,636,564,644,1668,640,1728,580,568,636,572,636,568,636,628,580,628,580,1728,580,568,640,1668,640,568,636,568,640,1728,580,568,640,20060,580,1732,580,568,636,572,636,568,640,568,636,572,636,572,632,572,636,568,640,568,640,572,632,628,580,568,640,568,636,568,640,568,636,572,636,568,640,568,636,572,636,568,640,624,580,572,636,564,644,568,636,568,640,572,632,628,580,572,636,1668,640,1676,632,568,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 20 %} 0,8984,4496,644,1664,648,560,644,560,648,1664,644,560,644,564,644,1664,644,560,648,560,644,564,644,1660,648,564,644,560,644,564,644,568,640,560,644,564,644,560,648,564,640,564,644,564,640,1664,648,1664,640,564,644,568,640,564,640,568,640,564,640,1668,644,560,644,1664,644,564,644,564,640,1664,644,624,584,20000,644,1664,644,564,644,568,640,564,640,564,644,564,644,560,644,568,640,560,648,564,640,568,640,564,644,564,640,624,584,564,644,560,644,568,640,564,640,624,584,564,644,560,648,564,640,564,644,564,640,568,640,564,644,564,640,568,640,1664,644,1664,644,1668,640,564,644 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 21 %} 0,8924,4500,640,1668,640,572,632,572,636,1672,636,568,640,576,632,1664,644,568,640,1672,636,568,640,1668,640,564,644,564,640,564,644,624,580,568,640,568,640,572,632,568,640,564,640,568,640,1664,644,1668,640,564,644,568,636,572,636,568,640,624,580,1672,636,624,584,1668,640,564,644,564,644,1664,644,564,640,20000,644,1668,640,568,640,564,644,560,644,564,644,564,644,568,636,564,644,564,640,568,640,568,640,568,636,568,640,624,580,572,636,564,644,564,640,564,644,624,584,564,640,568,640,564,644,564,648,560,640,624,580,568,640,568,640,568,636,568,640,568,636,568,640,1728,584 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 22 %} 0,8988,4500,644,1664,644,564,644,564,644,1664,644,564,640,564,644,1668,640,564,644,564,640,1668,644,1668,640,564,644,560,644,564,648,556,648,564,640,564,644,564,644,564,640,564,644,560,648,1660,648,1660,648,564,644,564,644,560,644,560,648,564,644,1664,644,568,636,1668,644,564,640,564,644,1668,640,564,644,19996,648,1664,644,560,648,564,640,564,644,564,644,560,648,560,644,560,648,564,640,564,644,560,648,560,648,560,644,568,640,564,640,564,644,560,648,564,640,560,648,564,640,568,640,564,644,564,644,560,648,560,644,564,648,556,644,564,644,1668,640,568,640,564,640,1664,648 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 23 %} 0,8984,4496,644,1664,648,564,640,564,644,1664,644,564,644,564,644,1664,644,564,644,1720,588,1664,644,1664,644,564,640,564,644,564,644,560,648,568,636,568,640,564,644,564,644,564,640,564,644,1664,644,1664,644,564,644,560,644,564,644,564,640,564,644,1664,644,564,644,1660,648,564,644,564,640,1668,644,564,640,20000,648,1668,640,564,644,620,588,620,584,564,644,564,644,560,644,568,640,564,644,564,644,560,644,564,644,560,648,560,644,564,644,564,644,564,640,564,644,564,644,560,648,560,644,568,640,564,640,568,640,564,644,564,644,560,644,560,648,564,644,1660,644,568,640,1668,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 24 %} 0,8980,4500,644,1668,640,568,636,568,640,1672,636,568,640,568,640,1668,640,568,640,560,648,564,640,568,636,1668,644,564,640,624,584,572,636,568,640,568,636,568,640,572,636,560,644,564,644,1664,644,1672,636,572,636,568,640,564,640,568,640,568,640,1668,640,568,640,1668,640,564,644,568,636,1664,644,568,640,20000,644,1672,640,624,580,624,584,564,644,564,644,560,644,624,584,564,640,572,636,568,636,568,640,568,640,568,640,564,640,568,640,564,644,568,640,568,636,568,640,568,636,628,580,568,640,568,636,568,640,568,640,564,644,564,640,624,584,1668,640,1668,640,572,636,1728,584 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 25 %} 0,9004,4500,640,1672,640,564,640,568,640,1672,636,568,640,568,636,1668,640,568,640,1668,640,568,640,568,640,1724,580,628,580,564,644,564,640,564,644,568,636,568,640,564,644,624,580,568,640,1668,640,1668,640,568,640,568,636,572,636,568,640,568,640,1668,640,564,644,1664,644,564,640,568,640,1668,640,564,644,20000,644,1672,636,568,640,564,640,572,636,624,584,568,640,564,640,624,584,568,636,628,580,568,640,568,636,628,580,568,640,624,580,572,636,568,640,568,640,568,636,568,640,568,636,568,640,568,640,568,636,568,640,572,636,624,584,568,636,568,640,568,640,1668,640,1668,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 26 %} 0,8992,4496,644,1668,640,624,584,560,648,1660,648,620,584,624,584,1668,640,564,644,560,648,1660,648,560,644,1664,644,564,644,560,648,560,644,564,644,564,644,560,648,560,644,564,644,560,644,1664,644,1668,644,564,640,624,584,564,644,560,644,564,644,1664,644,564,644,1664,644,560,648,568,640,1664,644,564,644,20000,644,1660,648,620,588,564,644,560,644,560,648,560,648,564,640,568,640,564,644,564,640,564,644,560,648,560,644,568,640,564,644,564,640,564,644,564,640,564,644,564,644,560,644,564,644,568,636,564,644,564,644,564,644,564,640,568,640,1664,644,564,644,1664,644,1668,640 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 27 %} 0,9008,4500,644,1668,640,568,636,568,640,1672,636,564,644,624,584,1728,580,624,580,1672,640,1664,640,568,640,1668,640,568,640,628,576,572,640,564,640,588,644,568,640,580,628,564,640,568,640,1672,636,1668,640,564,644,568,636,572,636,624,580,568,640,1676,632,568,640,1672,636,568,640,564,640,1672,640,624,580,20004,644,1664,644,568,640,568,636,568,640,568,636,572,636,624,584,568,640,624,580,580,628,568,640,564,644,564,640,568,640,580,624,572,636,568,640,564,640,568,640,568,640,572,636,560,644,568,640,564,644,624,580,568,640,568,636,568,644,568,636,1668,640,1672,640,1668,636
 {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 28 %} 0,8992,4496,644,1664,644,564,644,564,640,1664,644,568,640,564,640,1664,648,564,644,560,644,564,644,1664,644,1668,640,568,640,564,644,568,640,568,636,568,640,564,640,568,640,564,644,564,644,1668,640,1668,640,564,644,560,644,568,640,568,636,568,644,1664,644,564,640,1668,640,564,644,564,640,1672,636,564,644,20000,648,1664,644,564,640,564,644,564,644,568,636,568,640,564,644,564,644,564,640,564,644,564,644,564,640,564,644,568,636,568,640,564,644,560,648,560,644,564,644,564,644,564,640,568,640,560,648,564,640,568,640,564,644,560,644,568,640,1668,640,1664,644,1672,636,1668,644 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 29 %} 0,8984,4500,640,1724,584,568,640,568,636,1668,640,572,636,568,640,1668,640,568,640,1668,640,568,636,1672,636,1668,644,568,640,580,628,624,580,580,608,592,636,624,580,568,640,624,584,624,584,1724,580,1728,580,628,580,568,640,572,636,564,644,564,644,1668,636,568,640,1724,584,624,580,568,640,1672,640,568,636,20004,640,1728,580,576,632,568,640,624,584,564,640,572,636,568,640,568,640,564,640,568,640,572,632,568,640,572,636,564,640,568,640,568,640,568,640,564,640,564,644,568,636,572,636,568,640,568,640,572,632,628,580,568,640,568,636,568,640,568,640,568,640,568,640,568,636 
{% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 30 %} 0,9008,4500,640,1672,640,564,640,568,640,1668,640,564,644,564,644,1664,644,564,640,572,636,1668,640,1668,640,1724,584,568,640,564,644,564,640,568,640,564,644,560,648,620,584,564,644,576,632,1668,636,1672,640,568,640,560,644,564,644,564,644,564,644,1668,636,568,640,1668,640,564,644,624,584,1664,644,564,644,20000,644,1668,640,564,644,564,640,624,584,564,644,568,636,568,640,564,644,560,648,564,640,568,640,560,648,564,644,560,644,564,644,564,640,624,584,564,644,564,640,568,640,564,644,560,648,560,644,564,644,564,640,580,628,564,644,564,640,1668,644,564,640,564,644,560,648 
{% endif %}

That’s the error I get when checking config:


Error loading /config/configuration.yaml: while scanning for the next token
found character '%' that cannot start any token
  in "/config/scripts.yaml", line 26, column 26

I checked the tasmota config and everything works good directly from the interface of the board.

It’s not the % at the end of this line is it?

Yes it’s % at the end of the line. It’s shouldn’t be % at the end of the line?

Formatting…

'1587939407685':
  alias: AC Commands
  sequence:
  - service: mqtt.publish
    data:
      topic: cmnd/AC_LivingRoom/IRsend
      payload_template: >
        {% if is_state('input_select.ac_switch','False') %} 0,8984,4500,644,564,640,564,644,1664,644,560,648,564,640,568,640,1664,644,560,648,1660,648,564,644,560,644,1672,640,560,644,560,648,564,640,564,644,564,644,560,644,560,648,564,640,560,648,1664,644,568,640,564,640,568,640,620,584,564,644,564,644,1660,644,564,644,1668,640,564,644,560,648,1660,648,564,640,19996,648,1664,644,564,644,568,640,564,644,564,640,560,648,564,640,564,644,564,640,564,644,568,640,560,644,568,640,568,640,564,640,568,640,624,580,564,644,564,644,564,640,568,640,568,640,564,644,564,640,564,644,564,640,568,640,564,644,1668,640,1664,644,1668,640,564,644 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 16 %} 0,8984,4500,616,592,616,592,612,1696,616,1692,612,596,612,592,640,1668,640,568,616,592,612,596,636,568,616,592,616,592,612,592,616,592,612,596,612,592,612,596,612,596,612,592,616,592,612,1696,616,1692,612,596,612,592,616,592,616,592,612,596,612,1696,612,592,616,1692,612,596,612,596,612,1696,612,592,616,20032,640,1668,640,568,612,592,616,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,592,616,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,596,612,592,616,592,612,596,612,592,616,592,616,592,612,1696,612,1696,612,596,612 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 17 %} 0,8984,4500,612,596,640,564,616,1692,616,1696,612,592,616,592,616,1692,640,568,616,1692,640,568,612,592,640,568,616,592,636,572,612,592,616,592,612,592,616,592,632,576,612,596,612,592,616,1692,640,1672,612,592,616,592,612,596,612,592,616,592,612,1696,612,596,612,1696,612,596,636,568,616,1692,612,596,616,20028,616,1696,612,592,616,592,612,592,616,592,616,592,612,596,636,568,616,592,612,592,616,592,616,588,644,564,616,592,612,596,612,604,604,592,616,592,612,592,616,592,612,592,640,568,616,592,612,592,616,592,616,592,640,576,604,592,616,1692,616,1696,612,1696,616,592,612 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 18 %} 0,9012,4560,580,564,644,564,640,1672,636,1728,580,572,636,628,576,1672,640,624,580,568,640,1668,644,568,636,564,644,576,628,568,640,568,640,624,580,568,640,568,636,568,640,572,636,564,640,1672,636,1672,636,568,640,568,640,624,580,568,640,624,584,1668,640,568,640,1668,640,568,636,628,580,1728,580,572,636,19996,644,1668,640,568,640,568,640,624,580,568,640,568,640,568,640,560,644,572,636,564,644,564,640,568,640,568,636,564,644,624,584,624,580,564,644,568,640,568,640,620,584,624,584,624,584,564,640,568,640,564,640,568,640,624,580,628,580,568,640,568,640,568,636,1668,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 19 %} 0,8948,4500,640,568,640,568,636,1672,640,1668,640,624,580,568,640,1672,636,568,640,1668,640,1672,636,564,644,568,636,568,640,568,640,568,640,564,640,568,640,568,636,572,640,620,584,564,640,1728,584,1668,640,568,636,568,640,568,636,568,644,624,580,1672,636,572,636,1668,640,568,640,568,636,1672,640,568,636,20064,580,1672,640,568,636,572,636,572,636,568,640,568,636,564,644,568,636,628,580,624,580,568,644,564,640,568,636,572,636,584,624,572,636,568,640,624,580,628,580,628,580,568,640,560,644,568,640,564,644,568,636,568,640,568,640,568,636,1672,636,568,640,568,640,1664,644 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 20 %} 0,9016,4560,580,568,640,572,636,1668,640,1668,640,568,636,628,580,1672,640,568,636,624,580,572,640,1728,580,624,580,568,640,564,644,568,636,628,580,568,640,624,580,628,580,568,640,568,636,1732,576,1676,632,568,640,572,636,572,632,572,636,576,632,1672,636,572,636,1668,640,572,632,568,640,1672,636,568,640,20008,640,1668,640,568,636,628,580,572,636,568,636,568,640,572,636,568,636,572,636,572,636,568,636,572,636,572,636,568,636,568,640,568,640,580,624,572,636,568,640,568,636,580,628,628,580,568,640,568,636,628,580,624,580,572,636,572,636,624,580,1728,584,568,640,1664,644 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 21 %} 0,8984,4504,640,564,640,572,636,1664,644,1728,584,568,636,572,636,1668,640,568,640,1668,636,568,640,1728,580,572,636,568,636,572,636,568,640,568,636,568,640,580,628,624,580,568,640,568,636,1728,580,1672,640,568,636,568,640,568,640,568,636,568,640,1672,636,572,636,1664,644,564,640,568,640,1728,580,568,640,19984,660,1668,640,568,636,628,580,568,640,624,584,568,636,572,636,568,640,568,640,568,636,568,640,568,636,572,636,624,584,564,640,572,636,568,640,560,644,576,632,568,636,568,640,568,640,564,640,572,636,568,640,564,644,564,640,564,644,1668,640,1668,640,624,584,1664,644 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 22 %} 0,8984,4532,608,572,636,568,636,1672,636,1672,640,624,580,568,640,1672,636,564,644,564,640,1668,644,1728,576,568,644,564,640,568,640,568,636,572,636,624,580,628,580,568,640,572,632,568,640,1724,584,1672,636,568,640,624,580,568,640,568,640,564,640,1668,640,568,640,1728,580,564,644,564,644,1668,640,568,636,20000,644,1672,636,572,636,568,640,564,640,572,636,628,580,568,636,572,636,568,640,624,580,628,580,624,584,568,640,568,636,568,640,624,584,568,636,624,584,568,640,568,636,568,640,568,640,564,640,568,640,564,640,568,640,568,636,572,636,628,580,624,580,1672,640,1664,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 23 %} 0,8988,4496,648,568,636,624,580,1668,640,1728,580,568,640,568,640,1664,644,560,644,1668,640,1672,636,1668,644,568,636,568,640,568,640,568,636,572,636,568,636,572,640,560,644,568,640,620,584,1668,640,1672,636,568,640,568,636,568,640,572,636,568,636,1668,644,564,640,1668,640,568,640,564,640,1672,636,572,636,20008,640,1664,644,568,636,568,640,568,636,568,640,624,584,564,640,568,640,568,640,564,640,568,640,568,640,564,644,568,636,564,640,628,580,568,640,564,644,564,640,568,640,564,644,564,640,568,640,564,640,568,640,568,640,564,644,560,644,1672,636,568,640,1668,640,1668,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 24 %} 0,8988,4500,644,564,640,564,644,1664,644,1664,644,560,648,560,644,1664,648,620,584,564,644,564,640,564,644,1664,644,564,644,564,640,564,644,568,640,564,644,560,644,564,644,564,640,564,644,1660,644,1672,640,568,636,568,640,624,584,564,640,564,644,1668,640,564,644,1664,644,560,648,564,640,1664,644,564,644,19996,648,1668,640,560,644,568,640,560,644,564,644,564,644,620,588,624,580,568,640,568,640,564,640,568,640,564,644,564,640,564,644,564,644,560,644,564,644,564,644,560,644,564,644,568,640,564,640,564,644,568,640,564,640,568,640,560,644,572,636,1668,640,1664,648,1660,648 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 25 %} 0,8980,4560,580,564,640,628,580,1728,580,1728,580,568,640,628,576,1672,636,628,580,1684,624,568,640,568,640,1728,580,564,644,580,624,572,636,568,640,624,580,572,636,568,640,624,580,628,580,1728,580,1676,632,572,632,580,604,592,640,568,640,576,628,1672,636,568,640,1728,580,572,636,628,576,1676,636,568,636,20064,580,1672,640,568,636,572,632,576,632,576,604,596,636,572,636,568,640,572,632,568,640,628,580,568,636,572,636,568,640,572,632,628,552,600,636,564,644,568,636,572,636,624,580,628,580,568,640,568,640,564,640,572,636,568,636,572,636,1680,628,1676,632,1668,640,1668,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 26 %} 0,9012,4500,640,568,640,568,640,1664,644,1668,636,628,580,604,604,1668,640,568,640,624,580,1672,636,572,636,1728,580,568,640,568,636,568,640,568,640,568,636,572,636,564,640,572,636,568,636,1672,636,1672,640,568,636,568,640,624,580,572,636,564,644,1668,640,568,636,1672,640,568,644,560,640,1672,636,568,640,20004,636,1668,640,568,640,628,576,628,580,568,640,568,640,568,636,568,640,564,644,564,640,572,636,624,584,568,636,568,640,624,584,568,636,568,640,568,636,572,636,568,640,568,636,568,640,572,636,568,636,628,580,568,636,568,640,568,640,568,640,568,636,624,584,568,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 27 %} 0,8984,4504,636,568,640,624,580,1672,636,1672,636,572,636,568,640,1668,636,576,632,1668,640,1668,640,568,640,1668,640,568,640,568,636,564,644,568,640,568,636,568,640,572,632,572,636,572,636,1672,636,1672,636,628,576,572,636,572,636,564,640,572,640,1668,636,572,636,1668,640,572,636,568,636,1728,580,568,640,20040,604,1672,636,572,636,568,640,572,632,616,592,568,640,568,636,564,644,624,584,572,632,572,636,568,636,628,580,568,640,624,580,568,640,624,580,572,636,572,632,576,636,568,640,568,636,568,640,564,644,576,628,576,628,572,636,572,636,1672,636,568,640,568,636,572,636 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 28 %} 0,8984,4504,636,568,640,568,640,1672,636,1728,580,628,580,568,636,1676,632,572,636,572,636,568,640,1668,640,1668,640,628,576,572,636,568,640,572,636,584,620,568,640,568,640,568,636,572,636,1728,580,1728,580,624,584,576,628,568,640,572,636,568,640,1668,640,568,636,1672,640,568,640,568,636,1672,640,564,640,20012,632,1732,576,628,556,592,640,568,640,624,552,600,636,572,632,572,636,572,636,624,584,624,580,572,636,624,580,572,636,628,580,572,632,572,636,572,636,568,640,576,628,576,632,572,636,564,640,564,644,568,640,564,640,568,640,568,640,568,636,1668,644,564,640,628,576 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 29 %} 0,9012,4500,640,568,640,568,612,1696,640,1668,612,596,612,592,616,1692,612,596,640,1668,640,576,604,1696,636,1668,644,568,636,568,612,596,612,592,616,592,624,584,612,592,640,568,640,564,616,1692,640,1672,640,564,644,564,612,604,604,592,640,568,612,1696,640,568,640,1668,640,568,612,600,608,1692,640,576,608,20024,616,1696,640,568,612,592,640,568,640,568,640,572,608,592,612,604,604,604,600,596,612,592,640,572,636,568,636,576,632,568,612,608,600,596,636,568,640,564,640,568,640,568,640,572,608,600,604,592,640,568,616,592,612,596,612,596,636,1680,604,1756,552,592,616,592,612 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Heat') and states('input_number.ac_temperature')|int == 30 %} 0,8980,4504,640,564,616,604,628,1672,612,1696,612,592,616,592,612,1696,640,628,556,588,620,1692,612,1696,616,1700,608,592,612,592,624,584,640,568,612,592,640,568,612,600,632,576,632,568,612,1696,612,1696,612,596,640,564,616,592,616,592,628,588,604,1696,612,600,632,1672,612,592,640,568,616,1692,612,596,636,20004,616,1696,612,656,552,592,640,568,636,568,640,568,612,596,612,592,616,600,608,592,612,592,616,592,612,596,612,604,604,592,640,564,616,592,640,576,608,600,604,592,640,568,616,592,612,592,616,592,612,604,608,596,608,600,604,596,640,564,640,576,604,1696,616,592,640
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 16 %} 0,9008,4504,612,1696,612,592,616,592,612,1696,616,592,612,592,616,1692,616,592,616,592,616,592,612,592,616,592,640,568,612,592,616,592,616,592,612,592,612,596,612,596,612,592,616,592,616,1692,616,1696,612,592,616,592,612,592,616,592,612,596,612,1696,612,592,616,1692,616,592,612,592,616,1692,620,592,612,20028,616,1696,612,592,616,592,612,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,596,612,592,612,596,612,592,612,596,612,596,612,592,616,592,612,592,616,592,612,596,612,596,612,592,612,596,612,592,616,592,612,1696,612,1696,616,592,612,596,612 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 17 %} 0,8924,4496,640,1676,632,576,608,596,636,1680,628,572,632,568,640,1668,640,576,632,1672,608,592,640,568,640,580,600,592,640,628,552,604,632,564,640,568,640,576,628,572,612,592,640,564,620,1688,632,1676,640,568,640,572,636,564,640,568,612,600,608,1692,616,600,608,1700,608,592,640,564,640,1668,624,596,628,20004,612,1696,616,592,612,592,616,592,616,592,636,568,616,592,616,592,612,592,616,592,616,592,612,592,640,568,616,592,640,572,608,592,616,592,612,604,604,592,640,568,612,592,640,568,616,592,612,592,616,592,612,592,640,568,616,588,616,592,616,592,640,1668,616,588,616 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 18 %} 0,8984,4504,636,1668,640,568,640,564,640,1668,644,564,640,624,584,1664,644,568,640,624,580,1668,640,568,640,568,640,564,640,568,640,568,640,564,640,568,640,568,640,568,636,568,640,568,640,1664,644,1672,636,568,640,568,636,572,636,568,640,568,640,1668,640,564,640,1728,580,572,636,568,640,1668,640,568,640,20004,640,1668,640,568,640,564,640,564,648,560,644,568,640,564,644,620,584,564,644,624,580,568,640,564,644,624,580,568,640,568,640,568,640,564,644,620,584,568,640,564,644,564,640,564,644,568,640,568,636,628,580,568,640,560,648,564,640,1664,644,564,644,1664,644,564,644 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 19 %} 0,8984,4504,636,1728,580,572,636,568,636,1728,580,628,560,592,636,1728,580,568,640,1668,640,1672,636,568,640,568,636,568,640,568,636,564,644,624,580,572,636,568,640,576,600,600,636,564,644,1668,640,1728,580,568,636,572,636,568,636,628,580,628,580,1728,580,568,640,1668,640,568,636,568,640,1728,580,568,640,20060,580,1732,580,568,636,572,636,568,640,568,636,572,636,572,632,572,636,568,640,568,640,572,632,628,580,568,640,568,636,568,640,568,636,572,636,568,640,568,636,572,636,568,640,624,580,572,636,564,644,568,636,568,640,572,632,628,580,572,636,1668,640,1676,632,568,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 20 %} 0,8984,4496,644,1664,648,560,644,560,648,1664,644,560,644,564,644,1664,644,560,648,560,644,564,644,1660,648,564,644,560,644,564,644,568,640,560,644,564,644,560,648,564,640,564,644,564,640,1664,648,1664,640,564,644,568,640,564,640,568,640,564,640,1668,644,560,644,1664,644,564,644,564,640,1664,644,624,584,20000,644,1664,644,564,644,568,640,564,640,564,644,564,644,560,644,568,640,560,648,564,640,568,640,564,644,564,640,624,584,564,644,560,644,568,640,564,640,624,584,564,644,560,648,564,640,564,644,564,640,568,640,564,644,564,640,568,640,1664,644,1664,644,1668,640,564,644 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 21 %} 0,8924,4500,640,1668,640,572,632,572,636,1672,636,568,640,576,632,1664,644,568,640,1672,636,568,640,1668,640,564,644,564,640,564,644,624,580,568,640,568,640,572,632,568,640,564,640,568,640,1664,644,1668,640,564,644,568,636,572,636,568,640,624,580,1672,636,624,584,1668,640,564,644,564,644,1664,644,564,640,20000,644,1668,640,568,640,564,644,560,644,564,644,564,644,568,636,564,644,564,640,568,640,568,640,568,636,568,640,624,580,572,636,564,644,564,640,564,644,624,584,564,640,568,640,564,644,564,648,560,640,624,580,568,640,568,640,568,636,568,640,568,636,568,640,1728,584 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 22 %} 0,8988,4500,644,1664,644,564,644,564,644,1664,644,564,640,564,644,1668,640,564,644,564,640,1668,644,1668,640,564,644,560,644,564,648,556,648,564,640,564,644,564,644,564,640,564,644,560,648,1660,648,1660,648,564,644,564,644,560,644,560,648,564,644,1664,644,568,636,1668,644,564,640,564,644,1668,640,564,644,19996,648,1664,644,560,648,564,640,564,644,564,644,560,648,560,644,560,648,564,640,564,644,560,648,560,648,560,644,568,640,564,640,564,644,560,648,564,640,560,648,564,640,568,640,564,644,564,644,560,648,560,644,564,648,556,644,564,644,1668,640,568,640,564,640,1664,648 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 23 %} 0,8984,4496,644,1664,648,564,640,564,644,1664,644,564,644,564,644,1664,644,564,644,1720,588,1664,644,1664,644,564,640,564,644,564,644,560,648,568,636,568,640,564,644,564,644,564,640,564,644,1664,644,1664,644,564,644,560,644,564,644,564,640,564,644,1664,644,564,644,1660,648,564,644,564,640,1668,644,564,640,20000,648,1668,640,564,644,620,588,620,584,564,644,564,644,560,644,568,640,564,644,564,644,560,644,564,644,560,648,560,644,564,644,564,644,564,640,564,644,564,644,560,648,560,644,568,640,564,640,568,640,564,644,564,644,560,644,560,648,564,644,1660,644,568,640,1668,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 24 %} 0,8980,4500,644,1668,640,568,636,568,640,1672,636,568,640,568,640,1668,640,568,640,560,648,564,640,568,636,1668,644,564,640,624,584,572,636,568,640,568,636,568,640,572,636,560,644,564,644,1664,644,1672,636,572,636,568,640,564,640,568,640,568,640,1668,640,568,640,1668,640,564,644,568,636,1664,644,568,640,20000,644,1672,640,624,580,624,584,564,644,564,644,560,644,624,584,564,640,572,636,568,636,568,640,568,640,568,640,564,640,568,640,564,644,568,640,568,636,568,640,568,636,628,580,568,640,568,636,568,640,568,640,564,644,564,640,624,584,1668,640,1668,640,572,636,1728,584 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 25 %} 0,9004,4500,640,1672,640,564,640,568,640,1672,636,568,640,568,636,1668,640,568,640,1668,640,568,640,568,640,1724,580,628,580,564,644,564,640,564,644,568,636,568,640,564,644,624,580,568,640,1668,640,1668,640,568,640,568,636,572,636,568,640,568,640,1668,640,564,644,1664,644,564,640,568,640,1668,640,564,644,20000,644,1672,636,568,640,564,640,572,636,624,584,568,640,564,640,624,584,568,636,628,580,568,640,568,636,628,580,568,640,624,580,572,636,568,640,568,640,568,636,568,640,568,636,568,640,568,640,568,636,568,640,572,636,624,584,568,636,568,640,568,640,1668,640,1668,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 26 %} 0,8992,4496,644,1668,640,624,584,560,648,1660,648,620,584,624,584,1668,640,564,644,560,648,1660,648,560,644,1664,644,564,644,560,648,560,644,564,644,564,644,560,648,560,644,564,644,560,644,1664,644,1668,644,564,640,624,584,564,644,560,644,564,644,1664,644,564,644,1664,644,560,648,568,640,1664,644,564,644,20000,644,1660,648,620,588,564,644,560,644,560,648,560,648,564,640,568,640,564,644,564,640,564,644,560,648,560,644,568,640,564,644,564,640,564,644,564,640,564,644,564,644,560,644,564,644,568,636,564,644,564,644,564,644,564,640,568,640,1664,644,564,644,1664,644,1668,640 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 27 %} 0,9008,4500,644,1668,640,568,636,568,640,1672,636,564,644,624,584,1728,580,624,580,1672,640,1664,640,568,640,1668,640,568,640,628,576,572,640,564,640,588,644,568,640,580,628,564,640,568,640,1672,636,1668,640,564,644,568,636,572,636,624,580,568,640,1676,632,568,640,1672,636,568,640,564,640,1672,640,624,580,20004,644,1664,644,568,640,568,636,568,640,568,636,572,636,624,584,568,640,624,580,580,628,568,640,564,644,564,640,568,640,580,624,572,636,568,640,564,640,568,640,568,640,572,636,560,644,568,640,564,644,624,580,568,640,568,636,568,644,568,636,1668,640,1672,640,1668,636
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 28 %} 0,8992,4496,644,1664,644,564,644,564,640,1664,644,568,640,564,640,1664,648,564,644,560,644,564,644,1664,644,1668,640,568,640,564,644,568,640,568,636,568,640,564,640,568,640,564,644,564,644,1668,640,1668,640,564,644,560,644,568,640,568,636,568,644,1664,644,564,640,1668,640,564,644,564,640,1672,636,564,644,20000,648,1664,644,564,640,564,644,564,644,568,636,568,640,564,644,564,644,564,640,564,644,564,644,564,640,564,644,568,636,568,640,564,644,560,648,560,644,564,644,564,644,564,640,568,640,560,648,564,640,568,640,564,644,560,644,568,640,1668,640,1664,644,1672,636,1668,644 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 29 %} 0,8984,4500,640,1724,584,568,640,568,636,1668,640,572,636,568,640,1668,640,568,640,1668,640,568,636,1672,636,1668,644,568,640,580,628,624,580,580,608,592,636,624,580,568,640,624,584,624,584,1724,580,1728,580,628,580,568,640,572,636,564,644,564,644,1668,636,568,640,1724,584,624,580,568,640,1672,640,568,636,20004,640,1728,580,576,632,568,640,624,584,564,640,572,636,568,640,568,640,564,640,568,640,572,632,568,640,572,636,564,640,568,640,568,640,568,640,564,640,564,644,568,636,572,636,568,640,568,640,572,632,628,580,568,640,568,636,568,640,568,640,568,640,568,640,568,636 
        {% elif is_state('input_select.ac_switch','True') and is_state('input_select.ac_mode','Cool') and states('input_number.ac_temperature')|int == 30 %} 0,9008,4500,640,1672,640,564,640,568,640,1668,640,564,644,564,644,1664,644,564,640,572,636,1668,640,1668,640,1724,584,568,640,564,644,564,640,568,640,564,644,560,648,620,584,564,644,576,632,1668,636,1672,640,568,640,560,644,564,644,564,644,564,644,1668,636,568,640,1668,640,564,644,624,584,1664,644,564,644,20000,644,1668,640,564,644,564,640,624,584,564,644,568,636,568,640,564,644,560,648,564,640,568,640,560,648,564,644,560,644,564,644,564,640,624,584,564,644,564,640,568,640,564,644,560,648,560,644,564,644,564,640,580,628,564,644,564,640,1668,644,564,640,564,644,560,648 
        {% endif %}

I searched for the antonym of ‘streamlined’ and it led me this topic’s template.

4 Likes

Thank you! It’s working. I have a question about another script:

'1587857380730':
  alias: Open covers after rain
  sequence:
  - service: automation.trigger
    data_template:
      entity_id: "{% if (is_state('sun.sun','above_horizon')) and (states('sensor.time')\
        \ < \"14:00\") and (is_state('weather.byt','sunny') or is_state('weather.byt','cloudy')\
        \ or is_state('weather.byt','partlycloudy')) %}\n      automation.ptykht_trysym_bbvqr\n\
        {% elif (states('sensor.time') >= \"14:00\") and (is_state('sun.sun','above_horizon'))\
        \ and (is_state('weather.byt','sunny') or is_state('weather.byt','cloudy')\
        \ or is_state('weather.byt','partlycloudy')) %}\n      automation.close_covers_in_the_noon\n\
        {% elif (is_state('sun.sun','below_horizon')) and (states('sensor.time') <\
        \ \"23:00\") and (is_state('weather.byt','sunny') or is_state('weather.byt','cloudy')\
        \ or is_state('weather.byt','partlycloudy')) %}\n      automation.open_covers_afternoon\n\
        {% elif ((states('sensor.time') >= \"23:00\" and states('sensor.time') <=\
        \ \"23:59\") or (states('sensor.time') >= \"00:00\")) and (is_state('sun.sun','below_horizon'))\
        \ and (is_state('weather.byt','sunny') or is_state('weather.byt','cloudy')\
        \ or is_state('weather.byt','partlycloudy')) %}\n      automation.close_covers_in_the_night\n\
        {% endif %}

This script should activate automations according to the hour and open covers after rainy weather. the only problem I have is after 00:00 o’clock in the night that the script doesn’t activate the right automation. it activate automation.open_covers_afternoon instead of automation.close_covers_in_the_night. but before 00:00 o’clock it activate automation.close_covers_in_the_night which is ok.
What Can I do? I want that between 23:00 o’clock and until the sun is shining in the morning, the script will activate this automation.close_covers_in_the_night.

I offer you this streamlined version.

'1587939407685':
  alias: AC Commands
  sequence:
  - service: mqtt.publish
    data:
      topic: cmnd/AC_LivingRoom/IRsend
      payload_template: >
        {% set heat = {
           0: '0,8984,4500,644,564,640,564,644,1664,644,560,648,564,640,568,640,1664,644,560,648,1660,648,564,644,560,644,1672,640,560,644,560,648,564,640,564,644,564,644,560,644,560,648,564,640,560,648,1664,644,568,640,564,640,568,640,620,584,564,644,564,644,1660,644,564,644,1668,640,564,644,560,648,1660,648,564,640,19996,648,1664,644,564,644,568,640,564,644,564,640,560,648,564,640,564,644,564,640,564,644,568,640,560,644,568,640,568,640,564,640,568,640,624,580,564,644,564,644,564,640,568,640,568,640,564,644,564,640,564,644,564,640,568,640,564,644,1668,640,1664,644,1668,640,564,644',
          16: '0,8984,4500,616,592,616,592,612,1696,616,1692,612,596,612,592,640,1668,640,568,616,592,612,596,636,568,616,592,616,592,612,592,616,592,612,596,612,592,612,596,612,596,612,592,616,592,612,1696,616,1692,612,596,612,592,616,592,616,592,612,596,612,1696,612,592,616,1692,612,596,612,596,612,1696,612,592,616,20032,640,1668,640,568,612,592,616,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,592,616,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,596,612,592,616,592,612,596,612,592,616,592,616,592,612,1696,612,1696,612,596,612',
          17: '0,8984,4500,612,596,640,564,616,1692,616,1696,612,592,616,592,616,1692,640,568,616,1692,640,568,612,592,640,568,616,592,636,572,612,592,616,592,612,592,616,592,632,576,612,596,612,592,616,1692,640,1672,612,592,616,592,612,596,612,592,616,592,612,1696,612,596,612,1696,612,596,636,568,616,1692,612,596,616,20028,616,1696,612,592,616,592,612,592,616,592,616,592,612,596,636,568,616,592,612,592,616,592,616,588,644,564,616,592,612,596,612,604,604,592,616,592,612,592,616,592,612,592,640,568,616,592,612,592,616,592,616,592,640,576,604,592,616,1692,616,1696,612,1696,616,592,612',
          18: '0,9012,4560,580,564,644,564,640,1672,636,1728,580,572,636,628,576,1672,640,624,580,568,640,1668,644,568,636,564,644,576,628,568,640,568,640,624,580,568,640,568,636,568,640,572,636,564,640,1672,636,1672,636,568,640,568,640,624,580,568,640,624,584,1668,640,568,640,1668,640,568,636,628,580,1728,580,572,636,19996,644,1668,640,568,640,568,640,624,580,568,640,568,640,568,640,560,644,572,636,564,644,564,640,568,640,568,636,564,644,624,584,624,580,564,644,568,640,568,640,620,584,624,584,624,584,564,640,568,640,564,640,568,640,624,580,628,580,568,640,568,640,568,636,1668,640',
          19: '0,8948,4500,640,568,640,568,636,1672,640,1668,640,624,580,568,640,1672,636,568,640,1668,640,1672,636,564,644,568,636,568,640,568,640,568,640,564,640,568,640,568,636,572,640,620,584,564,640,1728,584,1668,640,568,636,568,640,568,636,568,644,624,580,1672,636,572,636,1668,640,568,640,568,636,1672,640,568,636,20064,580,1672,640,568,636,572,636,572,636,568,640,568,636,564,644,568,636,628,580,624,580,568,644,564,640,568,636,572,636,584,624,572,636,568,640,624,580,628,580,628,580,568,640,560,644,568,640,564,644,568,636,568,640,568,640,568,636,1672,636,568,640,568,640,1664,644',
          20: '0,9016,4560,580,568,640,572,636,1668,640,1668,640,568,636,628,580,1672,640,568,636,624,580,572,640,1728,580,624,580,568,640,564,644,568,636,628,580,568,640,624,580,628,580,568,640,568,636,1732,576,1676,632,568,640,572,636,572,632,572,636,576,632,1672,636,572,636,1668,640,572,632,568,640,1672,636,568,640,20008,640,1668,640,568,636,628,580,572,636,568,636,568,640,572,636,568,636,572,636,572,636,568,636,572,636,572,636,568,636,568,640,568,640,580,624,572,636,568,640,568,636,580,628,628,580,568,640,568,636,628,580,624,580,572,636,572,636,624,580,1728,584,568,640,1664,644',
          21: '0,8984,4504,640,564,640,572,636,1664,644,1728,584,568,636,572,636,1668,640,568,640,1668,636,568,640,1728,580,572,636,568,636,572,636,568,640,568,636,568,640,580,628,624,580,568,640,568,636,1728,580,1672,640,568,636,568,640,568,640,568,636,568,640,1672,636,572,636,1664,644,564,640,568,640,1728,580,568,640,19984,660,1668,640,568,636,628,580,568,640,624,584,568,636,572,636,568,640,568,640,568,636,568,640,568,636,572,636,624,584,564,640,572,636,568,640,560,644,576,632,568,636,568,640,568,640,564,640,572,636,568,640,564,644,564,640,564,644,1668,640,1668,640,624,584,1664,644',
          22: '0,8984,4532,608,572,636,568,636,1672,636,1672,640,624,580,568,640,1672,636,564,644,564,640,1668,644,1728,576,568,644,564,640,568,640,568,636,572,636,624,580,628,580,568,640,572,632,568,640,1724,584,1672,636,568,640,624,580,568,640,568,640,564,640,1668,640,568,640,1728,580,564,644,564,644,1668,640,568,636,20000,644,1672,636,572,636,568,640,564,640,572,636,628,580,568,636,572,636,568,640,624,580,628,580,624,584,568,640,568,636,568,640,624,584,568,636,624,584,568,640,568,636,568,640,568,640,564,640,568,640,564,640,568,640,568,636,572,636,628,580,624,580,1672,640,1664,640',
          23: '0,8988,4496,648,568,636,624,580,1668,640,1728,580,568,640,568,640,1664,644,560,644,1668,640,1672,636,1668,644,568,636,568,640,568,640,568,636,572,636,568,636,572,640,560,644,568,640,620,584,1668,640,1672,636,568,640,568,636,568,640,572,636,568,636,1668,644,564,640,1668,640,568,640,564,640,1672,636,572,636,20008,640,1664,644,568,636,568,640,568,636,568,640,624,584,564,640,568,640,568,640,564,640,568,640,568,640,564,644,568,636,564,640,628,580,568,640,564,644,564,640,568,640,564,644,564,640,568,640,564,640,568,640,568,640,564,644,560,644,1672,636,568,640,1668,640,1668,640',
          24: '0,8988,4500,644,564,640,564,644,1664,644,1664,644,560,648,560,644,1664,648,620,584,564,644,564,640,564,644,1664,644,564,644,564,640,564,644,568,640,564,644,560,644,564,644,564,640,564,644,1660,644,1672,640,568,636,568,640,624,584,564,640,564,644,1668,640,564,644,1664,644,560,648,564,640,1664,644,564,644,19996,648,1668,640,560,644,568,640,560,644,564,644,564,644,620,588,624,580,568,640,568,640,564,640,568,640,564,644,564,640,564,644,564,644,560,644,564,644,564,644,560,644,564,644,568,640,564,640,564,644,568,640,564,640,568,640,560,644,572,636,1668,640,1664,648,1660,648',
          25: '0,8980,4560,580,564,640,628,580,1728,580,1728,580,568,640,628,576,1672,636,628,580,1684,624,568,640,568,640,1728,580,564,644,580,624,572,636,568,640,624,580,572,636,568,640,624,580,628,580,1728,580,1676,632,572,632,580,604,592,640,568,640,576,628,1672,636,568,640,1728,580,572,636,628,576,1676,636,568,636,20064,580,1672,640,568,636,572,632,576,632,576,604,596,636,572,636,568,640,572,632,568,640,628,580,568,636,572,636,568,640,572,632,628,552,600,636,564,644,568,636,572,636,624,580,628,580,568,640,568,640,564,640,572,636,568,636,572,636,1680,628,1676,632,1668,640,1668,640',
          26: '0,9012,4500,640,568,640,568,640,1664,644,1668,636,628,580,604,604,1668,640,568,640,624,580,1672,636,572,636,1728,580,568,640,568,636,568,640,568,640,568,636,572,636,564,640,572,636,568,636,1672,636,1672,640,568,636,568,640,624,580,572,636,564,644,1668,640,568,636,1672,640,568,644,560,640,1672,636,568,640,20004,636,1668,640,568,640,628,576,628,580,568,640,568,640,568,636,568,640,564,644,564,640,572,636,624,584,568,636,568,640,624,584,568,636,568,640,568,636,572,636,568,640,568,636,568,640,572,636,568,636,628,580,568,636,568,640,568,640,568,640,568,636,624,584,568,640',
          27: '0,8984,4504,636,568,640,624,580,1672,636,1672,636,572,636,568,640,1668,636,576,632,1668,640,1668,640,568,640,1668,640,568,640,568,636,564,644,568,640,568,636,568,640,572,632,572,636,572,636,1672,636,1672,636,628,576,572,636,572,636,564,640,572,640,1668,636,572,636,1668,640,572,636,568,636,1728,580,568,640,20040,604,1672,636,572,636,568,640,572,632,616,592,568,640,568,636,564,644,624,584,572,632,572,636,568,636,628,580,568,640,624,580,568,640,624,580,572,636,572,632,576,636,568,640,568,636,568,640,564,644,576,628,576,628,572,636,572,636,1672,636,568,640,568,636,572,636',
          28: '0,8984,4504,636,568,640,568,640,1672,636,1728,580,628,580,568,636,1676,632,572,636,572,636,568,640,1668,640,1668,640,628,576,572,636,568,640,572,636,584,620,568,640,568,640,568,636,572,636,1728,580,1728,580,624,584,576,628,568,640,572,636,568,640,1668,640,568,636,1672,640,568,640,568,636,1672,640,564,640,20012,632,1732,576,628,556,592,640,568,640,624,552,600,636,572,632,572,636,572,636,624,584,624,580,572,636,624,580,572,636,628,580,572,632,572,636,572,636,568,640,576,628,576,632,572,636,564,640,564,644,568,640,564,640,568,640,568,640,568,636,1668,644,564,640,628,576',
          29: '0,9012,4500,640,568,640,568,612,1696,640,1668,612,596,612,592,616,1692,612,596,640,1668,640,576,604,1696,636,1668,644,568,636,568,612,596,612,592,616,592,624,584,612,592,640,568,640,564,616,1692,640,1672,640,564,644,564,612,604,604,592,640,568,612,1696,640,568,640,1668,640,568,612,600,608,1692,640,576,608,20024,616,1696,640,568,612,592,640,568,640,568,640,572,608,592,612,604,604,604,600,596,612,592,640,572,636,568,636,576,632,568,612,608,600,596,636,568,640,564,640,568,640,568,640,572,608,600,604,592,640,568,616,592,612,596,612,596,636,1680,604,1756,552,592,616,592,612',
          30: '0,8980,4504,640,564,616,604,628,1672,612,1696,612,592,616,592,612,1696,640,628,556,588,620,1692,612,1696,616,1700,608,592,612,592,624,584,640,568,612,592,640,568,612,600,632,576,632,568,612,1696,612,1696,612,596,640,564,616,592,616,592,628,588,604,1696,612,600,632,1672,612,592,640,568,616,1692,612,596,636,20004,616,1696,612,656,552,592,640,568,636,568,640,568,612,596,612,592,616,600,608,592,612,592,616,592,612,596,612,604,604,592,640,564,616,592,640,576,608,600,604,592,640,568,616,592,612,592,616,592,612,604,608,596,608,600,604,596,640,564,640,576,604,1696,616,592,640'
          } %}
        {% set cool = {
          16: '0,9008,4504,612,1696,612,592,616,592,612,1696,616,592,612,592,616,1692,616,592,616,592,616,592,612,592,616,592,640,568,612,592,616,592,616,592,612,592,612,596,612,596,612,592,616,592,616,1692,616,1696,612,592,616,592,612,592,616,592,612,596,612,1696,612,592,616,1692,616,592,612,592,616,1692,620,592,612,20028,616,1696,612,592,616,592,612,592,616,592,612,596,612,592,616,592,616,592,612,592,616,592,612,596,612,596,612,592,612,596,612,592,612,596,612,596,612,592,616,592,612,592,616,592,612,596,612,596,612,592,612,596,612,592,616,592,612,1696,612,1696,616,592,612,596,612',
          17: '0,8924,4496,640,1676,632,576,608,596,636,1680,628,572,632,568,640,1668,640,576,632,1672,608,592,640,568,640,580,600,592,640,628,552,604,632,564,640,568,640,576,628,572,612,592,640,564,620,1688,632,1676,640,568,640,572,636,564,640,568,612,600,608,1692,616,600,608,1700,608,592,640,564,640,1668,624,596,628,20004,612,1696,616,592,612,592,616,592,616,592,636,568,616,592,616,592,612,592,616,592,616,592,612,592,640,568,616,592,640,572,608,592,616,592,612,604,604,592,640,568,612,592,640,568,616,592,612,592,616,592,612,592,640,568,616,588,616,592,616,592,640,1668,616,588,616',
          18: '0,8984,4504,636,1668,640,568,640,564,640,1668,644,564,640,624,584,1664,644,568,640,624,580,1668,640,568,640,568,640,564,640,568,640,568,640,564,640,568,640,568,640,568,636,568,640,568,640,1664,644,1672,636,568,640,568,636,572,636,568,640,568,640,1668,640,564,640,1728,580,572,636,568,640,1668,640,568,640,20004,640,1668,640,568,640,564,640,564,648,560,644,568,640,564,644,620,584,564,644,624,580,568,640,564,644,624,580,568,640,568,640,568,640,564,644,620,584,568,640,564,644,564,640,564,644,568,640,568,636,628,580,568,640,560,648,564,640,1664,644,564,644,1664,644,564,644',
          19: '0,8984,4504,636,1728,580,572,636,568,636,1728,580,628,560,592,636,1728,580,568,640,1668,640,1672,636,568,640,568,636,568,640,568,636,564,644,624,580,572,636,568,640,576,600,600,636,564,644,1668,640,1728,580,568,636,572,636,568,636,628,580,628,580,1728,580,568,640,1668,640,568,636,568,640,1728,580,568,640,20060,580,1732,580,568,636,572,636,568,640,568,636,572,636,572,632,572,636,568,640,568,640,572,632,628,580,568,640,568,636,568,640,568,636,572,636,568,640,568,636,572,636,568,640,624,580,572,636,564,644,568,636,568,640,572,632,628,580,572,636,1668,640,1676,632,568,640',
          20: '0,8984,4496,644,1664,648,560,644,560,648,1664,644,560,644,564,644,1664,644,560,648,560,644,564,644,1660,648,564,644,560,644,564,644,568,640,560,644,564,644,560,648,564,640,564,644,564,640,1664,648,1664,640,564,644,568,640,564,640,568,640,564,640,1668,644,560,644,1664,644,564,644,564,640,1664,644,624,584,20000,644,1664,644,564,644,568,640,564,640,564,644,564,644,560,644,568,640,560,648,564,640,568,640,564,644,564,640,624,584,564,644,560,644,568,640,564,640,624,584,564,644,560,648,564,640,564,644,564,640,568,640,564,644,564,640,568,640,1664,644,1664,644,1668,640,564,644',
          21: '0,8924,4500,640,1668,640,572,632,572,636,1672,636,568,640,576,632,1664,644,568,640,1672,636,568,640,1668,640,564,644,564,640,564,644,624,580,568,640,568,640,572,632,568,640,564,640,568,640,1664,644,1668,640,564,644,568,636,572,636,568,640,624,580,1672,636,624,584,1668,640,564,644,564,644,1664,644,564,640,20000,644,1668,640,568,640,564,644,560,644,564,644,564,644,568,636,564,644,564,640,568,640,568,640,568,636,568,640,624,580,572,636,564,644,564,640,564,644,624,584,564,640,568,640,564,644,564,648,560,640,624,580,568,640,568,640,568,636,568,640,568,636,568,640,1728,584',
          22: '0,8988,4500,644,1664,644,564,644,564,644,1664,644,564,640,564,644,1668,640,564,644,564,640,1668,644,1668,640,564,644,560,644,564,648,556,648,564,640,564,644,564,644,564,640,564,644,560,648,1660,648,1660,648,564,644,564,644,560,644,560,648,564,644,1664,644,568,636,1668,644,564,640,564,644,1668,640,564,644,19996,648,1664,644,560,648,564,640,564,644,564,644,560,648,560,644,560,648,564,640,564,644,560,648,560,648,560,644,568,640,564,640,564,644,560,648,564,640,560,648,564,640,568,640,564,644,564,644,560,648,560,644,564,648,556,644,564,644,1668,640,568,640,564,640,1664,648',
          23: '0,8984,4496,644,1664,648,564,640,564,644,1664,644,564,644,564,644,1664,644,564,644,1720,588,1664,644,1664,644,564,640,564,644,564,644,560,648,568,636,568,640,564,644,564,644,564,640,564,644,1664,644,1664,644,564,644,560,644,564,644,564,640,564,644,1664,644,564,644,1660,648,564,644,564,640,1668,644,564,640,20000,648,1668,640,564,644,620,588,620,584,564,644,564,644,560,644,568,640,564,644,564,644,560,644,564,644,560,648,560,644,564,644,564,644,564,640,564,644,564,644,560,648,560,644,568,640,564,640,568,640,564,644,564,644,560,644,560,648,564,644,1660,644,568,640,1668,640',
          24: '0,8980,4500,644,1668,640,568,636,568,640,1672,636,568,640,568,640,1668,640,568,640,560,648,564,640,568,636,1668,644,564,640,624,584,572,636,568,640,568,636,568,640,572,636,560,644,564,644,1664,644,1672,636,572,636,568,640,564,640,568,640,568,640,1668,640,568,640,1668,640,564,644,568,636,1664,644,568,640,20000,644,1672,640,624,580,624,584,564,644,564,644,560,644,624,584,564,640,572,636,568,636,568,640,568,640,568,640,564,640,568,640,564,644,568,640,568,636,568,640,568,636,628,580,568,640,568,636,568,640,568,640,564,644,564,640,624,584,1668,640,1668,640,572,636,1728,584',
          25: '0,9004,4500,640,1672,640,564,640,568,640,1672,636,568,640,568,636,1668,640,568,640,1668,640,568,640,568,640,1724,580,628,580,564,644,564,640,564,644,568,636,568,640,564,644,624,580,568,640,1668,640,1668,640,568,640,568,636,572,636,568,640,568,640,1668,640,564,644,1664,644,564,640,568,640,1668,640,564,644,20000,644,1672,636,568,640,564,640,572,636,624,584,568,640,564,640,624,584,568,636,628,580,568,640,568,636,628,580,568,640,624,580,572,636,568,640,568,640,568,636,568,640,568,636,568,640,568,640,568,636,568,640,572,636,624,584,568,636,568,640,568,640,1668,640,1668,640',
          26: '0,8992,4496,644,1668,640,624,584,560,648,1660,648,620,584,624,584,1668,640,564,644,560,648,1660,648,560,644,1664,644,564,644,560,648,560,644,564,644,564,644,560,648,560,644,564,644,560,644,1664,644,1668,644,564,640,624,584,564,644,560,644,564,644,1664,644,564,644,1664,644,560,648,568,640,1664,644,564,644,20000,644,1660,648,620,588,564,644,560,644,560,648,560,648,564,640,568,640,564,644,564,640,564,644,560,648,560,644,568,640,564,644,564,640,564,644,564,640,564,644,564,644,560,644,564,644,568,636,564,644,564,644,564,644,564,640,568,640,1664,644,564,644,1664,644,1668,640',
          27: '0,9008,4500,644,1668,640,568,636,568,640,1672,636,564,644,624,584,1728,580,624,580,1672,640,1664,640,568,640,1668,640,568,640,628,576,572,640,564,640,588,644,568,640,580,628,564,640,568,640,1672,636,1668,640,564,644,568,636,572,636,624,580,568,640,1676,632,568,640,1672,636,568,640,564,640,1672,640,624,580,20004,644,1664,644,568,640,568,636,568,640,568,636,572,636,624,584,568,640,624,580,580,628,568,640,564,644,564,640,568,640,580,624,572,636,568,640,564,640,568,640,568,640,572,636,560,644,568,640,564,644,624,580,568,640,568,636,568,644,568,636,1668,640,1672,640,1668,636',
          28: '0,8992,4496,644,1664,644,564,644,564,640,1664,644,568,640,564,640,1664,648,564,644,560,644,564,644,1664,644,1668,640,568,640,564,644,568,640,568,636,568,640,564,640,568,640,564,644,564,644,1668,640,1668,640,564,644,560,644,568,640,568,636,568,644,1664,644,564,640,1668,640,564,644,564,640,1672,636,564,644,20000,648,1664,644,564,640,564,644,564,644,568,636,568,640,564,644,564,644,564,640,564,644,564,644,564,640,564,644,568,636,568,640,564,644,560,648,560,644,564,644,564,644,564,640,568,640,560,648,564,640,568,640,564,644,560,644,568,640,1668,640,1664,644,1672,636,1668,644',
          29: '0,8984,4500,640,1724,584,568,640,568,636,1668,640,572,636,568,640,1668,640,568,640,1668,640,568,636,1672,636,1668,644,568,640,580,628,624,580,580,608,592,636,624,580,568,640,624,584,624,584,1724,580,1728,580,628,580,568,640,572,636,564,644,564,644,1668,636,568,640,1724,584,624,580,568,640,1672,640,568,636,20004,640,1728,580,576,632,568,640,624,584,564,640,572,636,568,640,568,640,564,640,568,640,572,632,568,640,572,636,564,640,568,640,568,640,568,640,564,640,564,644,568,636,572,636,568,640,568,640,572,632,628,580,568,640,568,636,568,640,568,640,568,640,568,640,568,636',
          30: '0,9008,4500,640,1672,640,564,640,568,640,1668,640,564,644,564,644,1664,644,564,640,572,636,1668,640,1668,640,1724,584,568,640,564,644,564,640,568,640,564,644,560,648,620,584,564,644,576,632,1668,636,1672,640,568,640,560,644,564,644,564,644,564,644,1668,636,568,640,1668,640,564,644,624,584,1664,644,564,644,20000,644,1668,640,564,644,564,640,624,584,564,644,568,636,568,640,564,644,560,648,564,640,568,640,560,648,564,644,560,644,564,644,564,640,624,584,564,644,564,640,568,640,564,644,560,648,560,644,564,644,564,640,580,628,564,644,564,640,1668,644,564,640,564,644,560,648'
          } %}
        {% set t = states('input_number.ac_temperature') | int %}
        {% if is_state('input_select.ac_switch','False') %}
           {{ heat[0] }}
        {% elif is_state('input_select.ac_mode','Heat') %}
           {{ heat[t] if t in heat.keys() else 'error' }} 
        {% else %}
           {{ cool[t] if t in cool.keys() else 'error' }} 
        {% endif %}

This version makes two assumptions:

  • input_select.ac_switch has only two options: True, False.
  • input_select.ac_mode has only two options: Heat, Cool.
1 Like

Thank you ! Can you explain what its this:

 {% elif is_state('input_select.ac_mode','Heat') %}
           {{ heat[t] if t in heat.keys() else 'error' }} 

I mean what is the heat[t] line? It’s like an array that saves the temperature?

1 Like

heat and cool arrays have been created and then the temperature ‘t’ is used as the ‘key’ - so you can leverage it to easily reference the correct payload.

Really a slick / clean solution that @123 crafted

That’s because there’s a flaw in the template’s logic. When the sun is below the horizon, the first test it performs is to check if the time is less than 23:00. If it is, it executes automation.open_covers_afternoon.

I’ve simplified your template just enough so you can see the logic error:

        {% elif states('sensor.time') < "23:00" %}
          automation.open_covers_afternoon
        {% elif ((states('sensor.time') >= "23:00" and states('sensor.time') <= "23:59") or (states('sensor.time') >= "00:00")) %}
          automation.close_covers_in_the_night
        {% endif %}

So if it’s 00:05, that’s less than 23:00 and it runs open_covers_afternoon.

The final elif is evaluated only if the time is between 23:00 and 23:59 and that 1-hour window is the only time when it will execute automation.close_covers_in_the_night. The final elif also has an OR statement but it will never be checked because the previous elif already handles all times between 00:00 and 23:00.

Thank you ! So how I can write the final elif that it will activate automation.close_covers_in_the_night after from 00:00 o’clock until sun is shining?

It’s a dictionary (python dict). It is composed of key-value pairs. In this example, the keys are the numbers and the values are the animals:

{ 1: 'bat', 5: 'cat', 9: 'rat' }

This template will produce cat:

{% set x =  { 1: 'bat', 5: 'cat', 9: 'rat' } %}
{{ x[5] }}

In this example, the keys are the colors and the values are the numbers
This template will produce 50:

{% set y =  { 'red': 150, 'blue': 100, 'green': 50 } %}
{{ y['green'] }}

OK, you want to close the covers between 00:00 and sunrise. What is supposed to happen between sunset and 00:00?

Between sunset and 23:00 it suppose to activate the automation automation.open_covers_afternoon.
after 23:00 until the sunrise it suppose to activate the automation automation.close_covers_in_the_night

You’ve confirmed what I suspected you wanted to do but that’s not what your template is doing.

  • Let’s say the current time is 00:15.
  • Obviously the sun is below the horizon (I’m assuming you don’t live above the arctic circle).
  • 00:15 is less than 23:00.

That means the first test will cause the covers to open:

        {% elif states('sensor.time') < "23:00" %}
          automation.open_covers_afternoon

Your test will have to be more sophisticated than just “is the current time less than 23:00”. You want the template to:

  • open the covers between sunset and 23:00
  • close them between 23:00 and sunrise

Try creating that template and I’ll help you if you get stuck.

Between sunset and 23:00:

{% elif (is_state('sun.sun','below_horizon')) and (states('sensor.time') <\
        \ \"23:00\") and (is_state('weather.byt','sunny') or is_state('weather.byt','cloudy')\
        \ or is_state('weather.byt','partlycloudy')) %}\n      automation.open_covers_afternoon\n\

it’s working.
My problem is that I don’t know how to write from 23:00 to sunset. how I use the sun.sun above_horizon entity between hours? Can I write something like this:

{% elif ((is_state('sun.sun','below_horizon')) and (states('sensor.time') >= 23:00)) %}

No, that’s precisely the flawed portion of logic that allows for any time between 00:00 and 22:29. So if the time is after midnight, it will open the covers.

As for this:

{% elif ((is_state('sun.sun','below_horizon')) and (states('sensor.time') >= 23:00)) %}

it only works for times between 23:01 and 23:59 (and not for times between midnight and sunrise).

So how can I fix it?

Here’s the streamlined version:

'1587857380730':
  alias: Open covers after rain
  sequence:
  - service: automation.trigger
    data_template:
      entity_id: >
        {% if (is_state('weather.byt','sunny') or is_state('weather.byt','cloudy') or is_state('weather.byt','partlycloudy')) %}
          {% if (is_state('sun.sun','above_horizon')) %}
            {{ 'automation.ptykht_trysym_bbvqr' if states('sensor.time') < '14:00' else 'automation.close_covers_in_the_noon' }}
          {% else %}
            {% set sunset = as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom('%H:%M') %}
            {{ 'automation.open_covers_afternoon' if sunset < states('sensor.time') < '23:00' else 'automation.close_covers_in_the_night' }}
          {% endif %}
        {% endif %}

It works like this:

  • If the weather conditions are appropriate (sunny/cloudy/partlycloudy), check if the sun is above or below the horizon.
  • If it’s above, run ptykht_trysym_bbvqr if the current time is less than 14:00 otherwise run close_covers_in_the_noon.
  • If it’s below, first get the time of sunset. Then run open_covers_afternoon if the current time is between sunset and 23:00 otherwise run close_covers_in_the_night.

NOTE
The sun integration provides the time of the next sunset (next_setting) which may be a minute or two different from today’s sunset. However, that little difference isn’t important for this application.

Thank you very much!!