完整的:
esphome:
name: light_led_16
platform: ESP8266
board: esp01_1m
on_boot:
then:
- switch.turn_off: sw28121
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
- ssid: !secret wifi_ssid1
password: !secret wifi_password
logger:
ota:
password: !secret ota_password
api:
# password: !secret api_password
mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_username
password: !secret mqtt_password
discovery: True
discovery_retain: true
switch:
- platform: gpio
pin:
number: GPIO1 # TXD
inverted: yes #高电平断,低电平合
id: sw28121
name: "sw2812_txd"
sensor:
- platform: wifi_signal
name: "WiFi Signal_led16"
update_interval: 60s
binary_sensor:
- platform: gpio
pin: GPIO0
id: bs28120
name: "bs2812_gpio0"
filters:
- invert:
on_multi_click: # 模仿按键
- timing: #Double Clicked
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- homeassistant.service:
service: persistent_notification.create
data:
title: "提醒:"
message: "light_led_16按钮两次按下!!!"
notification_id: "light_led_16_press"
# notification_id: !lambda "return now()"
- timing: #Single Long Clicked
- ON for 3s to 5s
- OFF for at least 0.5s
then:
- light.turn_off:
id: ws2812016
- timing: #Single Short Clicked
- ON for at most 2s
- OFF for at least 0.5s
then:
- light.turn_on:
id: ws2812016
brightness: 100%
effect: "Color Wipe"
- platform: gpio
pin: GPIO3 # RXD
name: "sw2812_rxd" # 3.3v Sensor
device_class: motion
id: sw28123
filters:
- invert:
on_press:
then:
- switch.turn_on: sw28121
on_release:
then:
- switch.turn_off: sw28121
light:
- platform: fastled_clockless
id: ws2812016
chipset: WS2812
pin: GPIO2
num_leds: 16
rgb_order: GRB
name: "ws2812_16"
effects:
- random: # Use default parameters:
- random: # Customize parameters
name: Slow Random Effect
transition_length: 20s
update_interval: 15s
- random:
name: Fast Random Effect
transition_length: 3s
update_interval: 6s
- strobe:
- strobe:
name: Strobe Effect With Custom Values
colors:
- state: True
brightness: 100%
red: 100%
green: 90%
blue: 0%
duration: 500ms
- state: False
duration: 250ms
- state: True
brightness: 100%
red: 0%
green: 100%
blue: 0%
duration: 500ms
- flicker:
- flicker:
name: Flicker Effect With Custom Values
alpha: 95%
intensity: 1.5%
- addressable_rainbow:
- addressable_rainbow:
name: Rainbow Effect With Custom Values
speed: 10
width: 50
- addressable_color_wipe:
- addressable_color_wipe:
name: Color Wipe Effect With Custom Values
colors:
- red: 100%
green: 100%
blue: 100%
num_leds: 1
- red: 0%
green: 0%
blue: 0%
num_leds: 1
add_led_interval: 100ms
reverse: False
- addressable_scan:
- addressable_scan:
name: Scan Effect With Custom Values
move_interval: 100ms
- addressable_twinkle:
- addressable_twinkle:
name: Twinkle Effect With Custom Values
twinkle_probability: 5%
progress_interval: 4ms
- addressable_random_twinkle:
- addressable_random_twinkle:
name: Random Twinkle Effect With Custom Values
twinkle_probability: 5%
progress_interval: 32ms
- addressable_fireworks:
- addressable_fireworks:
name: Fireworks Effect With Custom Values
update_interval: 32ms
spark_probability: 10%
use_random_color: false
fade_out_rate: 120
- addressable_flicker:
- addressable_flicker:
name: Addressble Flicker Effect
update_interval: 16ms
intensity: 5%
- lambda: #自定义效果
name: My Lambda Custom Effect
update_interval: 1s
lambda: |-
static int state = 0;
auto call = id(ws2812016).turn_on();
// Transtion of 1000ms = 1s
call.set_transition_length(1000);
if (state == 0) {
call.set_rgb(0.5, 0.5, 0.5);
} else if (state == 1) {
call.set_rgb(0.0, 1.0, 0.0);
} else if (state == 2) {
call.set_rgb(0.0, 0.0, 1.0);
} else {
call.set_rgb(1.0, 0.0, 0.0);
}
call.perform();
state += 1;
if (state == 4)
state = 0;
一个281216位灯,一个感应器,一个指示灯,一个按钮
|