Here ya go! Thank you!!
Also, this is what the below code is displaying on my clock:
The hours and minutes are displaying on their correct digits, but the blinking dots are in the bottom right corner of the rightmost digit.
---
substitutions:
device_name: poolclock
esphome:
name: $device_name
platform: ESP8266
board: d1_mini
on_boot:
- light.turn_on:
id: led_strip
brightness: 100%
red: 0
green: 0
blue: 0
effect: ${device_name} Time effect
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${device_name} Fallback Hotspot"
password: !secret wifi_fallback_api_password
logger:
level: DEBUG
api:
#password: !secret hassio_api_password
encryption:
key: !secret hassio_api_key
ota:
password: !secret ota_password
globals:
- id: hours_red_value
type: int
restore_value: yes
initial_value: "0"
- id: hours_green_value
type: int
restore_value: yes
initial_value: "0"
- id: hours_blue_value
type: int
restore_value: yes
initial_value: "0"
- id: minutes_red_value
type: int
restore_value: yes
initial_value: "0"
- id: minutes_green_value
type: int
restore_value: yes
initial_value: "0"
- id: minutes_blue_value
type: int
restore_value: yes
initial_value: "0"
- id: dots_red_value
type: int
restore_value: yes
initial_value: "0"
- id: dots_green_value
type: int
restore_value: yes
initial_value: "0"
- id: dots_blue_value
type: int
restore_value: yes
initial_value: "0"
output:
- platform: template
id: hours_red_output
type: float
write_action:
lambda: id(hours_red_value) = 255.0 * state;
- platform: template
id: hours_green_output
type: float
write_action:
lambda: id(hours_green_value) = 255.0 * state;
- platform: template
id: hours_blue_output
type: float
write_action:
lambda: id(hours_blue_value) = 255.0 * state;
- platform: template
id: minutes_red_output
type: float
write_action:
lambda: id(minutes_red_value) = 255.0 * state;
- platform: template
id: minutes_green_output
type: float
write_action:
lambda: id(minutes_green_value) = 255.0 * state;
- platform: template
id: minutes_blue_output
type: float
write_action:
lambda: id(minutes_blue_value) = 255.0 * state;
- platform: template
id: dots_red_output
type: float
write_action:
lambda: id(dots_red_value) = 255.0 * state;
- platform: template
id: dots_green_output
type: float
write_action:
lambda: id(dots_green_value) = 255.0 * state;
- platform: template
id: dots_blue_output
type: float
write_action:
lambda: id(dots_blue_value) = 255.0 * state;
time:
- platform: sntp
id: sntp_time
timezone: America/Los_Angeles
servers:
- 0.pool.ntp.org
- 1.pool.ntp.org
- 2.pool.ntp.org
light:
- platform: rgb
name: ${device_name} hours lights
id: hours_lights
red: hours_red_output
green: hours_green_output
blue: hours_blue_output
- platform: rgb
name: ${device_name} minutes lights
id: minutes_lights
red: minutes_red_output
green: minutes_green_output
blue: minutes_blue_output
- platform: rgb
name: ${device_name} dots lights
id: dots_lights
red: dots_red_output
green: dots_green_output
blue: dots_blue_output
- platform: neopixelbus
id: led_strip
name: Led strip
internal: true
pin: GPIO2
num_leds: 86
variant: WS2812
type: GRB
effects:
- addressable_lambda:
name: ${device_name} Time effect
update_interval: 200ms
lambda: >-
const int ledsInDigitCount = 21;
const int digitsCount = 4;
int digitsLeds[11][ledsInDigitCount] = {
{0,1,1,1,1,1,1},
{0,0,0,1,1,0,0},
{1,0,1,1,0,1,1},
{1,0,1,1,1,1,0},
{1,1,0,1,1,0,0},
{1,1,1,0,1,1,0},
{1,1,1,0,1,1,1},
{0,0,1,1,1,0,0},
{1,1,1,1,1,1,1},
{1,1,1,1,1,1,0},
{0,0,0,0,0,0,0}
};
int ledOffsets[digitsCount] = {65 , 44 , 21, 0};
auto time = id(sntp_time).now();
int colors[4][3] = {
{id(hours_red_value), id(hours_green_value), id(hours_blue_value)},
{id(hours_red_value), id(hours_green_value), id(hours_blue_value)},
{id(minutes_red_value), id(minutes_green_value), id(minutes_blue_value)},
{id(minutes_red_value), id(minutes_green_value), id(minutes_blue_value)}
};
int values[digitsCount] = {};
values[0] = time.hour / 10;
values[1] = time.hour % 10;
values[2] = time.minute / 10;
values[3] = time.minute % 10;
it.all() = Color(0,0,0);
if ((time.second % 2) > 0) {
it[14] = Color(id(dots_red_value), id(dots_green_value), id(dots_blue_value));
it[15] = Color(id(dots_red_value), id(dots_green_value), id(dots_blue_value));
}
for (int valueI = 0; valueI < digitsCount; valueI++) {
int ledsOffset = ledOffsets[valueI];
int timeValue = values[valueI];
int *color = colors[valueI];
int *leds = digitsLeds[timeValue];
for (int ledI = 0; ledI < ledsInDigitCount; ledI++) {
if(leds[ledI] > 0) {
int ledIndex = ledI + ledsOffset;
it[ledIndex] = Color(color[0], color[1], color[2]);
}
}
}