Ruddog

Treatlife YAML

Mar 10th, 2021 (edited)
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.19 KB | None | 0 0
  1. #   IF YOU UNDERSTAND WHAT A LINE IS DOING AND THERE IS NO COMMENT SHOWN PLEASE ADD YOUR KNOWLEDGE IN THE FORM OF COMMENTS.
  2. esphome:
  3.   name: livingrm_lamp_14
  4.   platform: ESP8266
  5.   board: esp01_1m
  6.  
  7. wifi:
  8.   ssid: !secret ssid
  9.   password: !secret wifi_pass
  10.   manual_ip:
  11.      static_ip: 192.168.86.14
  12.      gateway: 192.168.86.1
  13.      subnet: 255.255.255.0
  14.      dns1: 8.8.8.8
  15.      dns2: 8.8.4.4
  16.  
  17.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  18.   ap:
  19.     ssid: "Livingrm Lamp 14"
  20.     password: "ltUA2sDi06zO"
  21.  
  22. captive_portal:
  23. # Enable logging #Everything up to here is understood.
  24. logger: #Does this redirect output from the yaml file during operation
  25.  
  26. # Enable Home Assistant API
  27. api:
  28.   password: !secret wifi_pass # Does the device have the ability to act as an AP?
  29.  
  30. ota:
  31.   password: !secret wifi_pass
  32.  
  33. status_led:
  34.   pin:
  35.     number: GPIO5   # I have seen "pin" used by itself and in a more advanced method. Which these lines is showing.
  36.     inverted: True
  37.    
  38. binary_sensor:
  39. - platform: gpio
  40.   pin:
  41.     number: GPIO4
  42.     inverted: True
  43.   id: sensor
  44.   internal: True
  45.  
  46. - platform: gpio
  47.   pin:
  48.     number: GPIO13
  49.     inverted: True
  50.   id: button
  51.   name: livingrm_lamp_14 Button
  52.   on_press:
  53.     - switch.toggle: livingrm_lamp_14
  54.   internal: True
  55.  
  56. light:
  57. - platform: binary
  58.   id: white_led
  59.   output: led_1
  60.   restore_mode: RESTORE_DEFAULT_ON
  61.   internal: True
  62. output:
  63. - platform: gpio
  64.   id: led_1
  65.   pin:
  66.     number: GPIO4
  67.     inverted: True
  68.  
  69. switch:
  70. - platform: gpio
  71.   id: relay
  72.   pin:
  73.     number: GPIO12
  74.   restore_mode: RESTORE_DEFAULT_OFF
  75.   internal: True
  76.  
  77. - platform: restart
  78.   name: livingrm_lamp_14 REBOOT
  79.  
  80. - platform: template
  81.   name: livingrm_lamp_14
  82.   id: livingrm_lamp_14
  83.   icon: mdi:light-switch
  84.   lambda: |-
  85.     if (id(sensor).state) {
  86.       return false;
  87.     } else {
  88.       return true;
  89.     }
  90.   turn_on_action:
  91.   - if:
  92.       condition:
  93.       - binary_sensor.is_on: sensor
  94.       then:
  95.       - switch.turn_on: relay
  96.       - light.turn_off: white_led
  97.   turn_off_action:
  98.   - if:
  99.       condition:
  100.       - binary_sensor.is_off: sensor
  101.       then:
  102.       - switch.turn_off: relay
  103.       - light.turn_on: white_led
Add Comment
Please, Sign In to add comment