327 lines
No EOL
8.6 KiB
YAML
327 lines
No EOL
8.6 KiB
YAML
esphome:
|
|
name: "wordclock"
|
|
|
|
esp32:
|
|
# board: ttgo-t7-v13-mini32
|
|
board: wemos_d1_mini32
|
|
framework:
|
|
type: arduino
|
|
|
|
external_components:
|
|
- source:
|
|
type: local
|
|
path: components
|
|
components: [ wordclock ]
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
ap:
|
|
ssid: "WordClock Configuration"
|
|
password: !secret ap_password
|
|
manual_ip:
|
|
static_ip: !secret manualip_static_ip
|
|
gateway: !secret manualip_gateway
|
|
subnet: !secret manualip_subnet
|
|
dns1: 1.1.1.1
|
|
dns2: 1.0.0.1
|
|
|
|
captive_portal:
|
|
|
|
# api:
|
|
|
|
ota:
|
|
password: "wordclock"
|
|
|
|
logger:
|
|
|
|
switch:
|
|
- platform: template
|
|
name: "5 Rainbow ON/OFF"
|
|
# lambda: |-
|
|
# return id(wordclock_1)->get_effect_active();
|
|
restore_state: true
|
|
optimistic: true
|
|
restore_mode: RESTORE_DEFAULT_ON
|
|
turn_on_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->set_effect_active(true);
|
|
turn_off_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->set_effect_active(false);
|
|
|
|
# on_...:
|
|
# - globals.set:
|
|
# id: my_global_var
|
|
# value: '10'
|
|
|
|
|
|
# output:
|
|
# - platform: template
|
|
# id: dummy_out
|
|
# type: float
|
|
# write_action:
|
|
# - lambda: |-
|
|
# return id(wordclock_1)->set_effect_active(true);
|
|
# Example configuration entry
|
|
globals:
|
|
- id: my_global_int
|
|
type: int
|
|
restore_value: no
|
|
initial_value: '0'
|
|
# Example for global string variable
|
|
- id: my_global_string
|
|
type: std::string
|
|
restore_value: no # Strings cannot be saved/restored
|
|
initial_value: '"Global value is"'
|
|
|
|
number:
|
|
- platform: template
|
|
name: "1 Red"
|
|
optimistic: true
|
|
restore_value: true
|
|
initial_value: 255
|
|
# lambda: |-
|
|
# return id(wordclock_1)->on_color.red;
|
|
on_value:
|
|
- lambda: |-
|
|
id(wordclock_1)->on_color.red = x;
|
|
set_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->on_color.red = x;
|
|
min_value: 0
|
|
max_value: 255
|
|
step: 1
|
|
- platform: template
|
|
name: "2 Green"
|
|
optimistic: true
|
|
restore_value: true
|
|
initial_value: 255
|
|
# lambda: |-
|
|
# return id(wordclock_1)->on_color.green;
|
|
on_value:
|
|
- lambda: |-
|
|
id(wordclock_1)->on_color.green = x;
|
|
set_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->on_color.green = x;
|
|
min_value: 0
|
|
max_value: 255
|
|
step: 1
|
|
- platform: template
|
|
name: "3 Blue"
|
|
optimistic: true
|
|
restore_value: true
|
|
initial_value: 255
|
|
# lambda: |-
|
|
# return id(wordclock_1)->on_color.blue;
|
|
on_value:
|
|
- lambda: |-
|
|
id(wordclock_1)->on_color.blue = x;
|
|
set_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->on_color.blue = x;
|
|
min_value: 0
|
|
max_value: 255
|
|
step: 1
|
|
- platform: template
|
|
name: "4 Brightness"
|
|
optimistic: true
|
|
restore_value: true
|
|
initial_value: 255
|
|
# lambda: |-
|
|
# return id(wordclock_1)->brightness;
|
|
on_value:
|
|
- lambda: |-
|
|
id(wordclock_1)->brightness = x;
|
|
set_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->brightness = x;
|
|
min_value: 0
|
|
max_value: 255
|
|
step: 1
|
|
- platform: template
|
|
name: "6 Rainbow Speed"
|
|
optimistic: true
|
|
restore_value: true
|
|
initial_value: 12
|
|
on_value:
|
|
- lambda: |-
|
|
id(wordclock_1)->set_effect_speed(x);
|
|
set_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->set_effect_speed(x);
|
|
min_value: 1
|
|
max_value: 4096
|
|
step: 1
|
|
- platform: template
|
|
name: "7 Rainbow Width"
|
|
optimistic: true
|
|
restore_value: true
|
|
initial_value: 50
|
|
on_value:
|
|
- lambda: |-
|
|
id(wordclock_1)->set_effect_width(x);
|
|
set_action:
|
|
- lambda: |-
|
|
id(wordclock_1)->set_effect_width(x);
|
|
min_value: 1
|
|
max_value: 65535
|
|
step: 1
|
|
|
|
# select:
|
|
# - platform: template
|
|
# name: "Rainbow ON/OFF"
|
|
# restore_value: true
|
|
# set_action:
|
|
# - lambda: |-
|
|
# return id(wordclock_1)->set_color_value(x);
|
|
# optimistic: true
|
|
# options:
|
|
# - effect
|
|
# - color
|
|
# initial_option: effect
|
|
# - platform: template
|
|
# name: "Template select"
|
|
# restore_value: true
|
|
# set_action:
|
|
# - lambda: |-
|
|
# return id(wordclock_1)->set_color_value(x);
|
|
# optimistic: true
|
|
# options:
|
|
# - effect
|
|
# - color
|
|
# initial_option: effect
|
|
|
|
|
|
web_server:
|
|
port: 80
|
|
version: 2
|
|
local: true
|
|
|
|
time:
|
|
- platform: sntp
|
|
id: current_time
|
|
timezone: !secret timezone
|
|
|
|
|
|
light:
|
|
- name: NeoPixel Strip 1
|
|
id: neopixel_strip_1
|
|
platform: neopixelbus
|
|
type: GRB
|
|
variant: WS2812
|
|
pin: GPIO22
|
|
num_leds: 198
|
|
restore_mode: ALWAYS_OFF
|
|
internal: true
|
|
method:
|
|
type: esp32_i2s
|
|
effects:
|
|
- addressable_random_twinkle:
|
|
name: "random_twinkle"
|
|
|
|
display:
|
|
- platform: addressable_light
|
|
id: led_matrix_display
|
|
addressable_light_id: neopixel_strip_1
|
|
width: 18
|
|
height: 11
|
|
rotation: 270°
|
|
update_interval: 16ms
|
|
auto_clear_enabled: false
|
|
pixel_mapper: |-
|
|
int mapping_even[] = {0, 2, 4, 6,8,10,11,13,15,17, 16,16,16,16, 16,16,16,16};
|
|
int mapping_odd[] = {17,15,13,11,9, 7, 6, 4, 2, 0, 16,16,16,16, 16,16,16,16};
|
|
if (x > 9) return -1;
|
|
if (y % 2 == 0) {
|
|
return (y * 18 + mapping_even[x]);
|
|
} else {
|
|
return (y * 18 + mapping_odd[x]);
|
|
}
|
|
|
|
color:
|
|
- id: col_on
|
|
red: 90%
|
|
green: 50%
|
|
blue: 0%
|
|
- id: col_off
|
|
red: 0%
|
|
green: 0%
|
|
blue: 0%
|
|
|
|
wordclock:
|
|
id: wordclock_1
|
|
time_id: current_time
|
|
display_id: led_matrix_display
|
|
addressable_light_id: neopixel_strip_1
|
|
brightness: 100%
|
|
color_on: col_on
|
|
color_off: col_off
|
|
update_interval: 16ms
|
|
static_segments: ["IT", "IS"]
|
|
segments:
|
|
- {name: "IT", line: {x1: 0, x2: 1, y1: 0}}
|
|
- {name: "IS", line: {x1: 3, x2: 4, y1: 0}}
|
|
- {name: "AM", line: {x1: 7, x2: 8, y1: 0}}
|
|
- {name: "PM", line: {x1: 9, x2: 10, y1: 0}}
|
|
- {name: "QUARTER", line: {x1: 2, x2: 8, y1: 1}}
|
|
- {name: "TWENTY", line: {x1: 0, x2: 5, y1: 2}}
|
|
- {name: "FIVE_MINUTES", line: {x1: 6, x2: 9, y1: 2}}
|
|
- {name: "HALF", line: {x1: 0, x2: 3, y1: 3}}
|
|
- {name: "TEN_MINUTES", line: {x1: 5, x2: 7, y1: 3}}
|
|
- {name: "TO", line: {x1: 9, x2: 10, y1: 3}}
|
|
- {name: "PAST", line: {x1: 0, x2: 3, y1: 4}}
|
|
- {name: "NINE", line: {x1: 7, x2: 10, y1: 4}}
|
|
- {name: "ONE", line: {x1: 0, x2: 2, y1: 5}}
|
|
- {name: "SIX", line: {x1: 3, x2: 5, y1: 5}}
|
|
- {name: "THREE", line: {x1: 6, x2: 10, y1: 5}}
|
|
- {name: "FOUR", line: {x1: 0, x2: 3, y1: 6}}
|
|
- {name: "FIVE", line: {x1: 4, x2: 7, y1: 6}}
|
|
- {name: "TWO", line: {x1: 8, x2: 10, y1: 6}}
|
|
- {name: "EIGHT", line: {x1: 0, x2: 4, y1: 7}}
|
|
- {name: "ELEVEN", line: {x1: 5, x2: 10, y1: 7}}
|
|
- {name: "SEVEN", line: {x1: 0, x2: 4, y1: 8}}
|
|
- {name: "TWELVE", line: {x1: 5, x2: 10, y1: 8}}
|
|
- {name: "TEN", line: {x1: 0, x2: 2, y1: 9}}
|
|
- {name: "OCLOCK", line: {x1: 5, x2: 10, y1: 9}}
|
|
minutes:
|
|
- {minute: 0, hour_offset: 0, segments: ["OCLOCK"]}
|
|
- {minute: 5, hour_offset: 0, segments: ["FIVE_MINUTES", "PAST"]}
|
|
- {minute: 10, hour_offset: 0, segments: ["TEN_MINUTES", "PAST"]}
|
|
- {minute: 15, hour_offset: 0, segments: ["QUARTER", "PAST"]}
|
|
- {minute: 20, hour_offset: 0, segments: ["TWENTY", "PAST"]}
|
|
- {minute: 25, hour_offset: 0, segments: ["TWENTY", "FIVE_MINUTES", "PAST"]}
|
|
- {minute: 30, hour_offset: 0, segments: ["HALF", "PAST"]}
|
|
- {minute: 35, hour_offset: 1, segments: ["TWENTY", "FIVE_MINUTES", "TO"]}
|
|
- {minute: 40, hour_offset: 1, segments: ["TWENTY", "TO"]}
|
|
- {minute: 45, hour_offset: 1, segments: ["QUARTER", "TO"]}
|
|
- {minute: 50, hour_offset: 1, segments: ["TEN_MINUTES", "TO"]}
|
|
- {minute: 55, hour_offset: 1, segments: ["FIVE_MINUTES", "TO"]}
|
|
hours:
|
|
- {hour: 0, segments: "TWELVE"}
|
|
- {hour: 1, segments: "ONE"}
|
|
- {hour: 2, segments: "TWO"}
|
|
- {hour: 3, segments: "THREE"}
|
|
- {hour: 4, segments: "FOUR"}
|
|
- {hour: 5, segments: "FIVE"}
|
|
- {hour: 6, segments: "SIX"}
|
|
- {hour: 7, segments: "SEVEN"}
|
|
- {hour: 8, segments: "EIGHT"}
|
|
- {hour: 9, segments: "NINE"}
|
|
- {hour: 10, segments: "TEN"}
|
|
- {hour: 11, segments: "ELEVEN"}
|
|
- {hour: 12, segments: "TWELVE"}
|
|
- {hour: 13, segments: "ONE"}
|
|
- {hour: 14, segments: "TWO"}
|
|
- {hour: 15, segments: "THREE"}
|
|
- {hour: 16, segments: "FOUR"}
|
|
- {hour: 17, segments: "FIVE"}
|
|
- {hour: 18, segments: "SIX"}
|
|
- {hour: 19, segments: "SEVEN"}
|
|
- {hour: 20, segments: "EIGHT"}
|
|
- {hour: 21, segments: "NINE"}
|
|
- {hour: 22, segments: "TEN"}
|
|
- {hour: 23, segments: "ELEVEN"}
|
|
|
|
|