2023-01-26 15:21:59 +01:00
|
|
|
esphome:
|
|
|
|
name: unhb-uhr
|
|
|
|
|
|
|
|
esp8266:
|
|
|
|
board: d1_mini
|
|
|
|
|
|
|
|
# Enable logging
|
|
|
|
logger:
|
|
|
|
|
|
|
|
# Enable Home Assistant API
|
|
|
|
api:
|
|
|
|
encryption:
|
2023-01-26 20:16:23 +01:00
|
|
|
key: !secret clock01_hass_api
|
2023-01-26 15:21:59 +01:00
|
|
|
|
|
|
|
ota:
|
2023-01-26 20:16:23 +01:00
|
|
|
password: !secret clock01_ota
|
|
|
|
|
2023-01-26 15:21:59 +01:00
|
|
|
|
|
|
|
wifi:
|
|
|
|
ssid: !secret wifi_ssid
|
|
|
|
password: !secret wifi_password
|
|
|
|
|
|
|
|
manual_ip:
|
|
|
|
static_ip: 192.168.10.192
|
|
|
|
gateway: 192.168.10.1
|
|
|
|
subnet: 255.255.255.0
|
|
|
|
dns1: 192.168.10.1
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
|
|
ap:
|
|
|
|
ssid: "Unhb-Uhr Fallback Hotspot"
|
2023-01-26 20:16:23 +01:00
|
|
|
password: !secret wifi_fallback_passwd
|
2023-01-26 15:21:59 +01:00
|
|
|
|
|
|
|
captive_portal:
|
|
|
|
|
|
|
|
web_server:
|
|
|
|
port: 80
|
|
|
|
|
|
|
|
mqtt:
|
|
|
|
broker: mqtt.int.weltendiskus.de
|
|
|
|
topic_prefix: uhr/01
|
|
|
|
|
|
|
|
time:
|
|
|
|
- platform: sntp
|
|
|
|
id: sntp_time
|
|
|
|
|
|
|
|
light:
|
|
|
|
- platform: neopixelbus
|
|
|
|
type: GRBW
|
|
|
|
variant: SK6812
|
|
|
|
pin: GPIO2
|
|
|
|
num_leds: 19
|
|
|
|
name: "NeoPixel Light"
|
|
|
|
gamma_correct: 1.7
|
|
|
|
method:
|
|
|
|
type: esp8266_uart
|
|
|
|
bus: 1
|
|
|
|
async: false
|
|
|
|
effects:
|
|
|
|
- addressable_scan:
|
|
|
|
- addressable_color_wipe:
|
|
|
|
- addressable_rainbow:
|
|
|
|
- addressable_fireworks:
|
|
|
|
- addressable_lambda:
|
|
|
|
name: "Uhr-Sek-Zufall"
|
|
|
|
update_interval: 1000ms
|
|
|
|
lambda: |-
|
|
|
|
// it.size() - Number of LEDs
|
|
|
|
// it[num] - Access the LED at index num.
|
|
|
|
// Set the LED at num to the given r, g, b values
|
|
|
|
// it[num] = Color(r, g, b);
|
|
|
|
// Get the color at index num (Color instance)
|
|
|
|
// it[num].get();
|
|
|
|
|
|
|
|
// Example: Simple color wipe
|
|
|
|
for (int i = it.size()-1 ; i >= 0; i--) {
|
|
|
|
it[i] = Color::random_color();
|
|
|
|
}
|
|
|
|
// it[0] = Color::random_color();
|
|
|
|
|
|
|
|
// Bonus: use .range() and .all() to set many LEDs without having to write a loop.
|
|
|
|
// it.range(0, 50) = Color::BLACK;
|
|
|
|
// it.all().fade_to_black(10);
|
|
|
|
- addressable_lambda:
|
|
|
|
name: "Uhr-Sekunden"
|
|
|
|
update_interval: 1000ms
|
|
|
|
lambda: |-
|
|
|
|
auto sek_offset=9;
|
|
|
|
// it.size() - Number of LEDs
|
|
|
|
// it[num] - Access the LED at index num.
|
|
|
|
// Set the LED at num to the given r, g, b values
|
|
|
|
// it[num] = Color(r, g, b);
|
|
|
|
// Get the color at index num (Color instance)
|
|
|
|
// it[num].get();
|
|
|
|
auto time = id(sntp_time).now();
|
|
|
|
// Example: Simple color wipe
|
|
|
|
for (int i = it.size()-1 ; i >= 0; i--) {
|
|
|
|
it[i] = Color(0,0,0);
|
|
|
|
}
|
|
|
|
auto center=time.second%it.size();;
|
|
|
|
it[(center)]=Color(255,0,0);
|
|
|
|
|
|
|
|
// it[0] = Color::random_color();
|
|
|
|
|
|
|
|
// Bonus: use .range() and .all() to set many LEDs without having to write a loop.
|
|
|
|
// it.range(0, 50) = Color::BLACK;
|
|
|
|
// it.all().fade_to_black(10);
|
|
|
|
- addressable_lambda:
|
|
|
|
name: "Uhr-Sekunden-Linie"
|
|
|
|
update_interval: 500ms
|
|
|
|
lambda: |-
|
|
|
|
auto time = id(sntp_time).now();
|
|
|
|
auto sek_offset=9;
|
|
|
|
int sek, i;
|
|
|
|
|
|
|
|
it.range(0, it.size()) = Color::BLACK;
|
|
|
|
|
|
|
|
sek = time.second*19;
|
|
|
|
i=0;
|
|
|
|
while(sek>=60) {
|
|
|
|
it[i] = Color(255,0,0);
|
|
|
|
sek-=60; i++;
|
|
|
|
}
|
|
|
|
if (sek!=0) it[i] = Color(sek*4, 0, 0);
|
|
|
|
- addressable_lambda:
|
|
|
|
name: "Uhr-Sekunden-Punkt"
|
|
|
|
update_interval: 1000ms
|
|
|
|
lambda: |-
|
|
|
|
auto time = id(sntp_time).now();
|
|
|
|
auto sek_offset=9;
|
|
|
|
int sek, i;
|
|
|
|
|
|
|
|
it.range(0, it.size()) = Color::BLACK;
|
|
|
|
|
|
|
|
sek = time.second*19;
|
|
|
|
|
|
|
|
i=sek/60;
|
|
|
|
sek=sek%60;
|
|
|
|
|
|
|
|
if (sek!=0) {
|
|
|
|
it[i] = Color((sek*4)+10, 0, 0);
|
|
|
|
it[(i+it.size()-1)%it.size()] = Color((60-sek)*4+10, 0, 0);
|
|
|
|
}
|
2023-01-26 20:16:23 +01:00
|
|
|
else { it[i] = Color(255, 0, 0); }
|