Pilotage Ecran esphome

Salut
J’ai quelques avancées avec les ESPhome, mais mon codage reste laborieux
merci le stutos - mais j’ai pas trouvé grand chose / exemples sur les « displays »
j’ai réussi a installer la police ttf et J’arrive a « commander » quelques fonctions sur un ecran oled 1306 (très choupinou)
dernier succès : afficher une entité en provenance de HA
(hou la la, mais bon, même si je pige rien au truc du lambda , je recopie betement !)

j’a besoin d’un petit coup de main pour « Eteindre / allumer » l’écran en fonction d’un switch (HA et ou bouton en local)

exemple de mon code (y compris mes composants habituels (pixel pour l’état du wifi, test time toutes les minutes, … etc.

substitutions:
  device: n184_display
  device_ip: 192.168.1.184
  <<: !include ../secrets.yaml

esphome:  
  name: n184_display
  platform: ESP8266
  board: nodemcuv2
  
  on_boot:
    - priority: 600.0 # after sensor setup, before WIFI initialization 
      then:
        - light.turn_on:
            id: n184_ws2812
            brightness: 25%
            red: 100%
            green: 0%
            blue: 0%    
    - priority: -1000.0 #after wifi initialized
      then:
        if:
          condition:
            wifi.connected:
          then:
            - light.turn_on:
                id: n184_p1
                brightness: 25%
                red: 0%
                green: 25%
                blue: 0%    
            - light.turn_on:
                id: n184_p2
                brightness: 25%
                red: 0%
                green: 0%
                blue: 25%    
                
######################   WIFI 
wifi:
  ssid: ${wifi_ssid}
  password: ${wifi_password}
  manual_ip:
    static_ip: ${device_ip}
    gateway: 192.168.1.1
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "recovery_184"
    password: "a1b2c3d4"

captive_portal:

web_server:
  port: 80
# Enable logging
logger:

# Enable Home Assistant API
api:
#  password: "tyty2020"  mdp DE l ESP pour acceder a l'esp depuis home assistant

ota:
######################   Initialisations
time:
  - platform: homeassistant
    id: ha_time
    on_time:
      - seconds: 0
        minutes: '*'
        then:
          - if:
              condition:
                wifi.connected:
              then:
                - light.turn_on:
                    id: n184_p1
                    brightness: 25%
                    red: 0%
                    green: 25%
                    blue: 0%
              else:
                - light.turn_on:
                    id: n184_p1
                    brightness: 50%
                    red: 100%
                    green: 0%
                    blue: 0%
              
########################### Déclaration protocoles DALLAS  + I2C
dallas:
  - pin: D5 #GPIO14 - Sensor IOT
    update_interval: 300s
    
i2c:
  sda: D2
  scl: D1

font:
  - file: "Roboto-Regular.ttf"
    id: roboto
    size: 20
    
display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    id: my_display
    lambda: |-
      it.print(0, 0, id(roboto), "Hello World!");
      it.printf(127, 30, id(roboto), TextAlign::TOP_RIGHT, "Temp: %.1f°C", id(temp_exter).state);


##### declaration DS18B20 1 et 2  +    TC Max 6675         +      Analog A0     +     Pixel WS2812  D4
switch:
  - platform: restart
    name: "n184_Restart"

    
light:
  - platform: fastled_clockless
    chipset: WS2811
    pin: D4
    num_leds: 2
    rgb_order: GRB
    name: "n184_ws2812"
    id: "n184_ws2812"
    internal: true
    
  - platform: partition
    name: "n184_p1"
    id: "n184_p1"
    segments:
      - id: n184_ws2812
        from: 0
        to: 0
  - platform: partition
    name: "n184_p2"
    id: "n184_p2"
    segments:
      - id: n184_ws2812
        from: 1
        to: 1

binary_sensor:
  - platform: status
    name: "n184_Status"
    
  - platform: gpio
    pin: D7
    name: "n184_Tac_BTN"
    id: "n184_tact_btn"
    on_press:
      - light.toggle: n184_p2

    
sensor:
  - platform: wifi_signal
    name: "n184_WiFi"
    update_interval: 60s
  - platform: uptime
    name: "n184_Uptime"
    
  - platform: dallas
    index: 0 #address: 0x0D8000001F97B428  #index: 0
    name: "n184_temp_ds18b20"
    id: "n184_temp_ds18b20"
    
  - platform: homeassistant
    name: "Temp.Exter"
    id: temp_exter
    entity_id: sensor.node_177_ds18b20_2_temperature
#    internal: true
    
text_sensor:
  - platform: homeassistant
    name: "Météo"
    entity_id: weather.maison
    id: meteo
    internal: true