Display an icon on OLED screen depending on the status of a sensor light

So I created two templates to transform my light.ecl_baie_led_haut for example into binary_sensor

- platform: template
  sensors:
    led_baie_haut:
      friendly_name: "LED Baie Haut Binary Sensor"
      value_template: "{{ is_state('light.ecl_baie_led_haut', 'on') }}"

- platform: template
  sensors:
    led_baie_bas:
      friendly_name: "LED Baie Bas Binary Sensor"
      value_template: "{{ is_state('light.ecl_baie_led_bas', 'on') }}"

In esphome I put the binary_sensor like this

binary_sensor:
  - platform: homeassistant
    id: led_baie_bas
    entity_id: binary_sensor.led_baie_bas
  - platform: homeassistant
    id: led_baie_haut
    entity_id: binary_sensor.led_baie_haut

On the Oled display I put this

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    update_interval: 0.2s
    lambda: |-
      
      // Print image
      //it.image(0, 0, id(fan));
      //it.image(0, 32, id(fan));

      if (id(ventillateur_1).state) {
        it.print(0, 0, id(font5), "\U000F0210");
      } else {
        it.print(0, 0, id(font5), "\U000F081D");
      }

      if (id(ventillateur_2).state) {
        it.print(0, 32, id(font5), "\U000F0210");
      } else {
        it.print(0, 32, id(font5), "\U000F081D");
      }

      if (id(led_baie_haut).state) {
      it.print(40, 0, id(font5), "\U000F0336");
      } else {
          it.print(40, 0, id(font5), "\U000F0E50");
      }

      if (id(led_baie_bas).state) {
      it.print(40, 32, id(font5), "\U000F0336");
      } else {
          it.print(40, 32, id(font5), "\U000F0E50");
      }

and here is the result for

  • 1 relay ON
  • 1 relay OFF
  • 1 light ON
  • 1 light OFF