Name the alarm sounds
Replace Sound 1 to 7 with the names identified by ear on this lamp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c29cdd52f
commit
a355f64d1a
4 files changed
+24
-21
No files matched your search
+18
-17
@@ -117,13 +117,13 @@ select:
|
||||
name: "Alarm ${n} Sound"
|
||||
options:
|
||||
- "Off"
|
||||
- "Sound 1"
|
||||
- "Sound 2"
|
||||
- "Sound 3"
|
||||
- "Sound 4"
|
||||
- "Sound 5"
|
||||
- "Sound 6"
|
||||
- "Sound 7"
|
||||
- "Birds"
|
||||
- "Beach"
|
||||
- "Galaxy Twinkles"
|
||||
- "Piano and Birds"
|
||||
- "Happy Harp"
|
||||
- "Mechanical Alarm Clock"
|
||||
- "Digital Alarm Clock"
|
||||
update_interval: 2s
|
||||
web_server:
|
||||
sorting_group_id: group_alarm_${n}
|
||||
@@ -131,20 +131,21 @@ select:
|
||||
lambda: |-
|
||||
if (!id(alarm_raw_valid)) return {};
|
||||
uint8_t s = id(alarm_raw)[${o} + 6];
|
||||
if (s == 0) return std::string("Off");
|
||||
if (s >= 1 && s <= 7) return std::string("Sound ") + std::to_string(s);
|
||||
return {};
|
||||
static const char *const names[8] = {"Off", "Birds", "Beach", "Galaxy Twinkles", "Piano and Birds",
|
||||
"Happy Harp", "Mechanical Alarm Clock", "Digital Alarm Clock"};
|
||||
if (s > 7) return {};
|
||||
return std::string(names[s]);
|
||||
set_action:
|
||||
- lambda: |-
|
||||
if (!id(alarm_raw_valid)) return;
|
||||
uint8_t value = 0;
|
||||
if (x == "Sound 1") value = 1;
|
||||
else if (x == "Sound 2") value = 2;
|
||||
else if (x == "Sound 3") value = 3;
|
||||
else if (x == "Sound 4") value = 4;
|
||||
else if (x == "Sound 5") value = 5;
|
||||
else if (x == "Sound 6") value = 6;
|
||||
else if (x == "Sound 7") value = 7;
|
||||
if (x == "Birds") value = 1;
|
||||
else if (x == "Beach") value = 2;
|
||||
else if (x == "Galaxy Twinkles") value = 3;
|
||||
else if (x == "Piano and Birds") value = 4;
|
||||
else if (x == "Happy Harp") value = 5;
|
||||
else if (x == "Mechanical Alarm Clock") value = 6;
|
||||
else if (x == "Digital Alarm Clock") value = 7;
|
||||
id(alarm_raw)[${o} + 6] = value;
|
||||
- script.execute: send_alarm_settings
|
||||
|
||||
|
||||
Reference in new issue
Block a user