Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # IF YOU UNDERSTAND WHAT A LINE IS DOING AND THERE IS NO COMMENT SHOWN PLEASE ADD YOUR KNOWLEDGE IN THE FORM OF COMMENTS.
- esphome:
- name: livingrm_lamp_14
- platform: ESP8266
- board: esp01_1m
- wifi:
- ssid: !secret ssid
- password: !secret wifi_pass
- manual_ip:
- static_ip: 192.168.86.14
- gateway: 192.168.86.1
- subnet: 255.255.255.0
- dns1: 8.8.8.8
- dns2: 8.8.4.4
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Livingrm Lamp 14"
- password: "ltUA2sDi06zO"
- captive_portal:
- # Enable logging #Everything up to here is understood.
- logger: #Does this redirect output from the yaml file during operation
- # Enable Home Assistant API
- api:
- password: !secret wifi_pass # Does the device have the ability to act as an AP?
- ota:
- password: !secret wifi_pass
- status_led:
- pin:
- number: GPIO5 # I have seen "pin" used by itself and in a more advanced method. Which these lines is showing.
- inverted: True
- binary_sensor:
- - platform: gpio
- pin:
- number: GPIO4
- inverted: True
- id: sensor
- internal: True
- - platform: gpio
- pin:
- number: GPIO13
- inverted: True
- id: button
- name: livingrm_lamp_14 Button
- on_press:
- - switch.toggle: livingrm_lamp_14
- internal: True
- light:
- - platform: binary
- id: white_led
- output: led_1
- restore_mode: RESTORE_DEFAULT_ON
- internal: True
- output:
- - platform: gpio
- id: led_1
- pin:
- number: GPIO4
- inverted: True
- switch:
- - platform: gpio
- id: relay
- pin:
- number: GPIO12
- restore_mode: RESTORE_DEFAULT_OFF
- internal: True
- - platform: restart
- name: livingrm_lamp_14 REBOOT
- - platform: template
- name: livingrm_lamp_14
- id: livingrm_lamp_14
- icon: mdi:light-switch
- lambda: |-
- if (id(sensor).state) {
- return false;
- } else {
- return true;
- }
- turn_on_action:
- - if:
- condition:
- - binary_sensor.is_on: sensor
- then:
- - switch.turn_on: relay
- - light.turn_off: white_led
- turn_off_action:
- - if:
- condition:
- - binary_sensor.is_off: sensor
- then:
- - switch.turn_off: relay
- - light.turn_on: white_led
Add Comment
Please, Sign In to add comment