оптимизируй 
esphome:
  name: jr-seu01
  friendly_name: Светильник зал
preferences:
  flash_write_interval: 1min  

esp8266:
  board: esp01_1m
  restore_from_flash: true  

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  safe_mode: true

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password  
#  networks:
#    - ssid: !secret wifi_ssid1
#      password: !secret wifi_password1
##      hidden: true
#      priority: 5
#    - ssid: !secret wifi_ssid2
#      password: !secret wifi_password2
#      priority: 1

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Jr-Seu01"
    password: !secret wifi_password

captive_portal:

#web_server:
#  port: 80
#  auth:
#    username: !secret web_server_username
#    password: !secret web_server_password

text_sensor:
  - platform: wifi_info
    ip_address:
      name: ESP IP Address
    ssid:
      name: ESP Connected SSID
    bssid:
      name: ESP Connected BSSID
    mac_address:
      name: ESP Mac Wifi Address
    scan_results:
      name: ESP Latest Scan Results
  - platform: version
    name: "ESPHome Version" 
  - platform: template
    name: Uptime Human Readable
    id: uptime_human
    icon: mdi:clock-start     

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s
  - platform: uptime
    name: Uptime Sensor
    id: uptime_sensor
    update_interval: 60s
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            state: !lambda |-
              int seconds = round(id(uptime_sensor).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? to_string(days) + "d " : "") +
                (hours ? to_string(hours) + "h " : "") +
                (minutes ? to_string(minutes) + "m " : "") +
                (to_string(seconds) + "s")
              ).c_str(); 


switch:
  - platform: restart
    name: "Restart"      
  - platform: safe_mode
    name: "Restart (Safe Mode)"   
  - platform: shutdown
    name: "Shutdown" 
  - platform: factory_reset
    name: Restart with Factory Default Settings       

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO3
      mode:
        input: true
        pullup: true
      inverted: true
    name: "JR-SEU01 Button 1"
    on_press:
#      - switch.toggle: relay1
      - light.toggle: relay1      
  - platform: gpio
    pin:
      number: GPIO4
      mode:
        input: true
        pullup: true
      inverted: true
    name: "JR-SEU01 Button 2"
    on_press:
#      - switch.toggle: relay2   
      - light.toggle: relay2          

#switch:
#  - platform: gpio
#    name: "JR-SEU01 Relay 1"
#    pin: GPIO13
#    id: relay1
#  - platform: gpio
#    name: "JR-SEU01 Relay 2"
#    pin: GPIO14
#    id: relay2    


light:
  - platform: binary
    name: "JR-SEU01 Relay 1"
    output: light_output1
    id: relay1
    icon: "mdi:coach-lamp-variant"
    restore_mode: RESTORE_DEFAULT_OFF
    effects:
      - strobe:
  - platform: binary
    name: "JR-SEU01 Relay 2"
    output: light_output2
    id: relay2
    icon: "mdi:ceiling-light"
    restore_mode: RESTORE_DEFAULT_OFF
    effects:
      - strobe:      

output:
  - id: light_output1
    platform: gpio
    pin: GPIO13
  - id: light_output2
    platform: gpio
    pin: GPIO14           


status_led:
  pin:
    number: GPIO1
    inverted: no