Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- substitutions:
- ###### Board specifics
- core: dev
- arduino: recommended
- platform: ESP32
- board: nodemcu-32s # https://esphome.io/devices/nodemcu_esp32.html ESP32-DevkitC
- ###### web portal
- web_port: "80"
- web_version: "2"
- ###### Identity
- devicename: atticlight
- friendlyname: Attic Light Controller
- upper_devicename: AtticLight
- logger_level: DEBUG # default DEBUG, options = NONE,ERROR,WARN,INFO,VERBOSE,VERY_VERBOSE
- # https://esphome.io/components/logger.html?highlight=logger
- ###### Pins
- light_pin1: GPIO21 # light1 (0-10v light1)
- light_pin2: GPIO33 # light2 (0-10v light2)
- light_pin3: GPIO19 # light3 (ledstrip 1)
- light_pin4: GPIO18 # light4 (ledstrip 2)
- relay_pin1: GPIO17 # Relay1,comm = vcc,NO = light1
- relay_pin2: GPIO16 # Relay2,comm = vcc,NO = light2
- relay_pin3: GPIO04 # Relay3,comm = vcc,NO = light3
- relay_pin4: GPIO26 # Relay4,comm = vcc,NO = light4
- touch_pin1: GPIO32 # Touch sensor
- ###### Variables:
- DefaultLightSetting: "60"
- esphome:
- name: $devicename
- friendly_name: $friendlyname
- name_add_mac_suffix: true # this sucks
- project:
- name: "vso.pwm_attic_project"
- version: "1.1.0"
- # to be researched
- # psram:
- # mode: octal
- # speed: 80mhz \
- esp32:
- board: $board
- framework:
- type: arduino
- # Enable logging
- logger:
- level: $logger_level
- # logs:
- # mqtt.component: DEBUG
- # mqtt.client: ERROR
- # Enable Home Assistant API
- api:
- #port: 6053 # set port defaults to 6053
- encryption:
- key: !secret api_key
- reboot_timeout: 0s # default 15min
- on_client_disconnected:
- - logger.log: "API client disconnected!"
- time:
- - platform: homeassistant
- id: homeassistant_time
- ota:
- password: !secret ota_password
- # send log updates
- network:
- enable_ipv6: False
- wifi:
- # use_address: !secret IP_adrress116
- networks:
- - ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: $devicename " Hotspot"
- password: !secret wifi_password
- captive_portal:
- wled:
- web_server:
- port: $web_port
- version: 2
- local: True
- text_sensor:
- - platform: wifi_info
- ip_address:
- name: IP Address
- ssid:
- name: Connected SSID
- bssid:
- name: Connected BSSID
- mac_address:
- name: Mac Wifi Address
- # scan_results:
- # name: ${devicename} Latest Scan Results
- # control external relay switch (powersupplies)
- power_supply:
- # name: "power supply light 1"
- - id: 'power_supply1'
- pin: $relay_pin1
- enable_time: 2ms
- # name: "power supply light 2"
- - id: power_supply2
- pin: $relay_pin2
- enable_time: 2ms
- # name: "power supply light 3"
- - id: power_supply3
- pin: $relay_pin3
- enable_time: 2ms
- # name: "power supply light 4"
- - id: power_supply4
- pin: $relay_pin4
- enable_time: 2ms
- switch:
- # (HA and webportal) restart ESP device button
- - platform: restart
- name: ${devicename}" Restart"
- icon: "mdi:pulse"
- # define 1st light (ha and esphome)
- output:
- # name: "light1 state"
- - platform: ledc # for PWM control 0-10v
- pin: $light_pin1 # PWM Pin 0-10v
- frequency: 1000 Hz # PWM Pin 0-10v between 1000 and 3000 hz
- id: light_output1
- power_supply: power_supply1
- - platform: ledc # for PWM control 0-10v
- pin: $light_pin2 # PWM Pin 0-10v
- frequency: 1000 Hz # PWM Pin 0-10v between 1000 and 3000 hz
- id: light_output2
- power_supply: power_supply2
- light:
- - platform: monochromatic
- id: light1
- name: "Light 1"
- output: light_output1
- on_turn_on:
- - light.turn_off: light3
- - platform: monochromatic
- id: light2
- name: "Light 2"
- output: light_output2
- on_turn_on:
- - light.turn_off: light3
- - platform: neopixelbus
- id: light3
- name: "Hidden lights 3"
- power_supply: power_supply3
- restore_mode: ALWAYS_OFF
- variant: WS2812
- pin: $light_pin3
- num_leds: 8
- type: GRB
- method: # added to avoid issues on multiple strips control
- type: esp32_rmt
- channel: 0
- - platform: neopixelbus
- id: light4
- name: "Hidden lights 4"
- power_supply: power_supply4
- restore_mode: ALWAYS_OFF
- variant: WS2812
- pin: $light_pin4
- num_leds: 16
- type: GRB
- method: # added to avoid issues on multiple strips control
- type: esp32_rmt
- channel: 1
- - platform: partition
- name: "Hidden lights 5 (3+4)"
- id: light5
- segments:
- - id: light3
- from: 0 # number 1
- to : 7 # if 16 leds -1 = 15
- - id: light4
- from: 0 # number 1
- to : 15 # if 16 leds -1 = 15
- #- single_light_id: light6
- binary_sensor:
- - platform: gpio
- name: "Touch Pad" # physical touch-sensor (ts223)
- id: touch_input
- pin: $touch_pin1
- icon: "mdi:GestureTapButton"
- on_click:
- - min_length: 50ms
- max_length: 350ms
- then:
- - script.execute: touch_single
- - min_length: 350ms
- then:
- - light.turn_off: light1
- - light.turn_off: light2
- script:
- - id: touch_single
- then:
- - if:
- condition:
- and:
- - light.is_off: light1
- - light.is_off: light2
- then:
- - light.turn_on:
- id: light1
- brightness: 60%
- - light.turn_on:
- id: light2
- brightness: 60%
- else:
- - if:
- condition:
- light.is_on: light1
- then:
- if:
- condition:
- lambda: |-
- return int(id(light1).remote_values.get_brightness() * 100) == 100;
- then:
- - light.turn_on:
- id: light1
- brightness: 10%
- else:
- - light.dim_relative:
- id: light1
- relative_brightness: 10%
- - if:
- condition:
- light.is_on: light2
- then:
- if:
- condition:
- lambda: |-
- return int(id(light2).remote_values.get_brightness() * 100) == 100;
- then:
- - light.turn_on:
- id: light2
- brightness: 10%
- else:
- - light.dim_relative:
- id: light2
- relative_brightness: 10%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement