Compare commits
4 Commits
383a48cdf5
...
0231ff8f5e
| Author | SHA1 | Date | |
|---|---|---|---|
| 0231ff8f5e | |||
| 9313ae047a | |||
| d25b6ccb6c | |||
| 8b64c0a986 |
68
hexagon.yaml
68
hexagon.yaml
@@ -15,6 +15,7 @@ esphome:
|
||||
- priority: -100
|
||||
# When all is set up. Start the show.
|
||||
then:
|
||||
- delay: 5s
|
||||
- script.execute: game_ready_animation
|
||||
|
||||
# Variables
|
||||
@@ -34,8 +35,11 @@ esp8266:
|
||||
board: d1_mini_lite
|
||||
|
||||
# Enable logging (for development)
|
||||
# NOTE: Logs on the same pin of addressable leds, so may display wrong colors when enabled
|
||||
# logger:
|
||||
|
||||
deep_sleep:
|
||||
|
||||
api:
|
||||
reboot_timeout: 0s
|
||||
|
||||
@@ -109,6 +113,11 @@ sensor:
|
||||
- 850.0 -> 100.0
|
||||
- min:
|
||||
send_first_at: 3
|
||||
on_value_range:
|
||||
- below: 5.0
|
||||
then:
|
||||
- script.execute: battery_low
|
||||
|
||||
|
||||
output:
|
||||
- platform: esp8266_pwm
|
||||
@@ -130,13 +139,17 @@ light:
|
||||
rtttl:
|
||||
output: speaker
|
||||
on_finished_playback:
|
||||
# - script.execute: game_ready_animation
|
||||
- script.execute:
|
||||
id: set_section_color
|
||||
section: !lambda return id(game_selected_section);
|
||||
r: 1.0
|
||||
g: 1.0
|
||||
b: 1.0
|
||||
if:
|
||||
condition:
|
||||
not:
|
||||
- script.is_running: battery_low
|
||||
then:
|
||||
- script.execute:
|
||||
id: set_section_color
|
||||
section: !lambda return id(game_selected_section);
|
||||
r: 1.0
|
||||
g: 1.0
|
||||
b: 1.0
|
||||
|
||||
|
||||
# ---- Scripts ----
|
||||
@@ -159,6 +172,23 @@ script:
|
||||
blue: !lambda return b;
|
||||
#transition_length: 1s;
|
||||
|
||||
- id: set_all_sections_color_animation
|
||||
parameters:
|
||||
r: float
|
||||
g: float
|
||||
b: float
|
||||
then:
|
||||
- repeat:
|
||||
count: 6
|
||||
then:
|
||||
- script.execute:
|
||||
id: set_section_color
|
||||
section: !lambda return iteration;
|
||||
r: !lambda return r;
|
||||
g: !lambda return g;
|
||||
b: !lambda return b;
|
||||
- delay: 200ms
|
||||
|
||||
- id: game_ready_animation
|
||||
then:
|
||||
- script.execute:
|
||||
@@ -223,9 +253,9 @@ script:
|
||||
r: !lambda if (id(game_selected_section) < 3) return 0.0; else return 1.0;
|
||||
g: !lambda if (id(game_selected_section) == 0 || id(game_selected_section) == 3 || id(game_selected_section) == 4) return 0.0; else return 1.0;
|
||||
b: !lambda if (id(game_selected_section) % 2 == 0) return 1.0; else return 0.0;
|
||||
- logger.log:
|
||||
format: "Selected section %d"
|
||||
args: [ 'id(game_selected_section)' ]
|
||||
#- logger.log:
|
||||
# format: "Selected section %d"
|
||||
# args: [ 'id(game_selected_section)' ]
|
||||
- id: game_play_section
|
||||
then:
|
||||
- rtttl.play:
|
||||
@@ -245,3 +275,21 @@ script:
|
||||
default:
|
||||
return "mario:d=4,o=5,b=100:16e6,16e6,32p,8e6,16c6,8e6,8g6,8p,8g,8p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,16p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16c7,16p,16c7,16c7,p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16d#6,8p,16d6,8p,16c6";
|
||||
}
|
||||
- id: battery_low
|
||||
then:
|
||||
#- logger.log: "Executing Battery Low script"
|
||||
# Turn lights on red
|
||||
- script.execute:
|
||||
id: set_all_sections_color_animation
|
||||
r: 1.0
|
||||
g: 0.0
|
||||
b: 0.0
|
||||
# Play battery low tune
|
||||
- rtttl.play:
|
||||
rtttl: Battery Low:d=8,o=6,b=600:c6,p,c5,p,2c4
|
||||
- delay: 5s
|
||||
- light.turn_off: hexagon_sections
|
||||
- delay: 1s
|
||||
# Suspend device to avoid draining battery
|
||||
- deep_sleep.enter:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user