27 lines
1.0 KiB
YAML
27 lines
1.0 KiB
YAML
###############################################################################
|
|||
|
|
# One weekday switch for one alarm. Included per day from alarm_block.yaml.
|
||
|
|
# n, o come from alarm_block.yaml; day = label, bit = bit in the weekday mask,
|
||
|
|
# w = sort position in the web UI.
|
||
|
|
###############################################################################
|
||
|
|
|
||
|
|
switch:
|
||
|
|
- platform: template
|
||
|
|
id: alarm_${n}_day_${bit}
|
||
|
|
name: "Alarm ${n} ${day}"
|
||
|
|
icon: "mdi:calendar"
|
||
|
|
web_server:
|
||
|
|
sorting_group_id: group_alarm_${n}
|
||
|
|
sorting_weight: ${w}
|
||
|
|
lambda: |-
|
||
|
|
if (!id(alarm_raw_valid)) return {};
|
||
|
|
return (id(alarm_raw)[${o} + 3] >> ${bit}) & 1;
|
||
|
|
turn_on_action:
|
||
|
|
- lambda: |-
|
||
|
|
if (!id(alarm_raw_valid)) return;
|
||
|
|
id(alarm_raw)[${o} + 3] |= (1 << ${bit});
|
||
|
|
- script.execute: send_alarm_settings
|
||
|
|
turn_off_action:
|
||
|
|
- lambda: |-
|
||
|
|
if (!id(alarm_raw_valid)) return;
|
||
|
|
id(alarm_raw)[${o} + 3] &= ~(1 << ${bit});
|
||
|
|
- script.execute: send_alarm_settings
|