Advertisement
FullSilence

kitchen-controller

Aug 21st, 2022 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.89 KB | None | 0 0
  1. esphome:
  2.   name: kitchen-controller
  3.  
  4. esp32:
  5.   board: esp32dev
  6.   framework:
  7.     type: arduino
  8.  
  9. # Enable logging
  10. logger:
  11.   #level: INFO
  12.  
  13. # Enable Home Assistant API
  14. ota:
  15.   password: !secret ota_password
  16. api:
  17.   password: !secret api_password
  18.  
  19. wifi:
  20.   ssid: !secret wifi_ssid
  21.   password: !secret wifi_password
  22.  
  23.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  24.   ap:
  25.     ssid: !secret ac_ap_ssid
  26.     password: !secret ac_ap_password
  27.  
  28. captive_portal:
  29. web_server:
  30.   port: 80
  31.  
  32. script:
  33.   - id: turn_lights_off
  34.     mode: restart     # Light will be kept on during 1 minute since the latest time the script is executed
  35.     then:
  36.       - if:
  37.           condition:
  38.             and:
  39.               - light.is_on: led_strip
  40.           then:
  41.             - logger.log: "Запускаем скрипт ожидания"
  42.             - delay: 5min
  43.             - logger.log: "Предупреждаем о скором выключении"
  44.             - light.turn_on:
  45.                 id: led_strip
  46.                 brightness: 100%
  47.                 effect: pulse
  48.             - delay: 30s
  49.             - logger.log: "Выключаем свет"
  50.             - light.turn_off: led_strip
  51.  
  52. output:
  53.   - platform: ledc
  54.     pin: GPIO32
  55.     id: gpio_32
  56.  
  57. light:
  58.   - platform: monochromatic
  59.     output: gpio_32
  60.     name: "Kitchen Light"
  61.     id: led_strip
  62.    
  63.     on_turn_on:
  64.       - logger.log: "Удаленное включение"
  65.       - script.execute: turn_lights_off
  66.      
  67.     effects:
  68.       - pulse:
  69.       - pulse:
  70.           name: "Slow Pulse"
  71.           # transition_length: 0.5s
  72.           update_interval: 2s     # не работает
  73.  
  74. sensor:
  75. #  WiFi Signal Sensor
  76. #  Датчик отображающий уровень сигнала Wifi
  77.   - platform: wifi_signal
  78.     name: "Kitchen WiFi Signal"
  79.     update_interval: 60s
  80. #  Uptime Sensor
  81. #  Датчик отображающий время работы
  82.   - platform: uptime
  83.     name: "Kitchen WiFi Uptame"
  84.    
  85. binary_sensor:
  86.   - platform: gpio
  87.     pin: GPIO22
  88.     name: "Obstacle sensor"
  89.     id: obstacle_sensor # Датчик препятствий
  90.     on_press:
  91.         - then:
  92.           - logger.log: "Переключаем свет"
  93.           - light.toggle:
  94.               id: led_strip
  95.           - script.execute: turn_lights_off
  96.     filters:
  97.       - delayed_on_off: 50ms          
  98.      
  99.   - platform: gpio
  100.     pin: GPIO23
  101.     name: "PIR Sensor"
  102.     device_class: motion      
  103.     on_release:
  104.       - then:
  105.         - logger.log: "Обнаружено движение."
  106.         - script.execute: turn_lights_off
  107.         - if:
  108.             condition:
  109.               and:
  110.                 - light.is_on: led_strip
  111.             then:        
  112.               - light.turn_on:
  113.                   id: led_strip
  114.                   brightness: 100%
  115.                   effect: none
  116.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement