mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-09-06 18:08:45 +00:00
Bed LED scripts
This commit is contained in:
@@ -50,6 +50,9 @@ cards:
|
|||||||
template: [small, with_state_background]
|
template: [small, with_state_background]
|
||||||
entity: light.bed_led
|
entity: light.bed_led
|
||||||
name: Bed
|
name: Bed
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.bed_led_toggle
|
||||||
- type: custom:button-card
|
- type: custom:button-card
|
||||||
template: [small, with_state_background]
|
template: [small, with_state_background]
|
||||||
entity: light.bedside
|
entity: light.bedside
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ cards:
|
|||||||
template: [small, with_state_background]
|
template: [small, with_state_background]
|
||||||
entity: light.bed_led
|
entity: light.bed_led
|
||||||
name: Bed
|
name: Bed
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.bed_led_toggle
|
||||||
- type: custom:button-card
|
- type: custom:button-card
|
||||||
template: [small, with_state_background]
|
template: [small, with_state_background]
|
||||||
entity: light.bedside
|
entity: light.bedside
|
||||||
|
|||||||
@@ -31,6 +31,9 @@
|
|||||||
template: default
|
template: default
|
||||||
entity: light.bed_led
|
entity: light.bed_led
|
||||||
name: Bed
|
name: Bed
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.bed_led_toggle
|
||||||
- type: custom:button-card
|
- type: custom:button-card
|
||||||
template: default
|
template: default
|
||||||
entity: light.bedside
|
entity: light.bedside
|
||||||
|
|||||||
@@ -63,6 +63,9 @@
|
|||||||
template: default
|
template: default
|
||||||
entity: light.bed_led
|
entity: light.bed_led
|
||||||
name: Bed
|
name: Bed
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.bed_led_toggle
|
||||||
- type: custom:button-card
|
- type: custom:button-card
|
||||||
template: default
|
template: default
|
||||||
entity: light.bedside
|
entity: light.bedside
|
||||||
|
|||||||
@@ -18,3 +18,29 @@ sensor:
|
|||||||
icon: "mdi:signal"
|
icon: "mdi:signal"
|
||||||
unit_of_measurement: "lqi"
|
unit_of_measurement: "lqi"
|
||||||
value_template: "{{ value_json.linkquality }}"
|
value_template: "{{ value_json.linkquality }}"
|
||||||
|
|
||||||
|
script:
|
||||||
|
bed_led_on:
|
||||||
|
sequence:
|
||||||
|
- delay: "00:00:01"
|
||||||
|
- service: light.turn_on
|
||||||
|
entity_id: light.bed_led
|
||||||
|
- delay: "00:00:03"
|
||||||
|
- service: light.turn_on
|
||||||
|
entity_id: light.bed_led
|
||||||
|
data_template:
|
||||||
|
brightness_pct: "{{ brightness_pct | default(100) }}"
|
||||||
|
|
||||||
|
bed_led_toggle:
|
||||||
|
sequence:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: light.bed_led
|
||||||
|
state: "off"
|
||||||
|
sequence:
|
||||||
|
- service: script.bed_led_on
|
||||||
|
|
||||||
|
default:
|
||||||
|
- service: light.turn_off
|
||||||
|
entity_id: light.bed_led
|
||||||
|
|||||||
@@ -37,12 +37,11 @@ automation:
|
|||||||
data_template:
|
data_template:
|
||||||
entity_id: light.master_bedroom
|
entity_id: light.master_bedroom
|
||||||
brightness_pct: >-
|
brightness_pct: >-
|
||||||
|
{% if not is_state('input_select.house_mode', 'day') %} 40 {% else %} 100 {% endif %}
|
||||||
{% if not is_state('input_select.house_mode', 'day') %}
|
- service: script.bed_led_on
|
||||||
40
|
data_template:
|
||||||
{% else %}
|
brightness_pct: >-
|
||||||
100
|
{% if not is_state('input_select.house_mode', 'day') %} 40 {% else %} 100 {% endif %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
button_1_double:
|
button_1_double:
|
||||||
- service: light.turn_off
|
- service: light.turn_off
|
||||||
@@ -71,7 +70,6 @@ automation:
|
|||||||
data_template:
|
data_template:
|
||||||
entity_id:
|
entity_id:
|
||||||
- light.bedside
|
- light.bedside
|
||||||
- light.bed_led
|
|
||||||
brightness_pct: >-
|
brightness_pct: >-
|
||||||
|
|
||||||
{% if not is_state('input_select.house_mode', 'day') %}
|
{% if not is_state('input_select.house_mode', 'day') %}
|
||||||
@@ -79,6 +77,7 @@ automation:
|
|||||||
{% else %}
|
{% else %}
|
||||||
100
|
100
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
- service: script.bed_led_on
|
||||||
|
|
||||||
button_3_single:
|
button_3_single:
|
||||||
- service: media_player.media_play_pause
|
- service: media_player.media_play_pause
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ automation:
|
|||||||
input:
|
input:
|
||||||
z2m_topic: "z2m_deconz/bedside_switch"
|
z2m_topic: "z2m_deconz/bedside_switch"
|
||||||
click:
|
click:
|
||||||
|
- service: script.bed_led_toggle
|
||||||
|
data_template:
|
||||||
|
brightness_pct: >-
|
||||||
|
{% if is_state('input_select.house_mode', 'night') %} 40 {% else %} 100 {% endif %}
|
||||||
|
|
||||||
- service: light.toggle
|
- service: light.toggle
|
||||||
data_template:
|
data_template:
|
||||||
entity_id: >-
|
entity_id: >-
|
||||||
@@ -28,25 +33,20 @@ automation:
|
|||||||
{% if is_state('input_select.house_mode', 'day') %}
|
{% if is_state('input_select.house_mode', 'day') %}
|
||||||
light.master_bedroom_main
|
light.master_bedroom_main
|
||||||
{% elif is_state('input_select.house_mode', 'bed') %}
|
{% elif is_state('input_select.house_mode', 'bed') %}
|
||||||
light.bedside, light.bed_led
|
light.bedside
|
||||||
{% elif is_state('input_select.house_mode', 'night') %}
|
|
||||||
light.bed_led
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
brightness_pct: >-
|
brightness_pct: >-
|
||||||
|
{% if is_state('input_select.house_mode', 'night') %} 40 {% else %} 100 {% endif %}
|
||||||
{% if is_state('input_select.house_mode', 'night') %}
|
|
||||||
40
|
|
||||||
{% else %}
|
|
||||||
100
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
double_click:
|
double_click:
|
||||||
- service: light.toggle
|
- service: light.toggle
|
||||||
data_template:
|
entity_id: light.bedside
|
||||||
entity_id:
|
data:
|
||||||
- light.bedside
|
|
||||||
- light.bed_led
|
|
||||||
brightness_pct: 100
|
brightness_pct: 100
|
||||||
|
- service: script.bed_led_toggle
|
||||||
|
data_template:
|
||||||
|
brightness_pct: >-
|
||||||
|
{% if is_state('input_select.house_mode', 'night') %} 40 {% else %} 100 {% endif %}
|
||||||
|
|
||||||
hold:
|
hold:
|
||||||
- service: input_select.select_next
|
- service: input_select.select_next
|
||||||
|
|||||||
@@ -58,11 +58,10 @@ automation:
|
|||||||
state: 'double'
|
state: 'double'
|
||||||
action:
|
action:
|
||||||
- service: light.toggle
|
- service: light.toggle
|
||||||
data_template:
|
entity_id: light.bedside
|
||||||
entity_id:
|
data:
|
||||||
- light.bedside
|
|
||||||
- light.bed_led
|
|
||||||
brightness_pct: 100
|
brightness_pct: 100
|
||||||
|
- service: script.bed_led_toggle
|
||||||
|
|
||||||
- alias: Music · Master bedroom · Play pause on switch hold
|
- alias: Music · Master bedroom · Play pause on switch hold
|
||||||
trigger:
|
trigger:
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ script:
|
|||||||
# Set master bedroom state
|
# Set master bedroom state
|
||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
entity_id: light.bedside
|
entity_id: light.bedside
|
||||||
- service: light.turn_on
|
- service: script.bed_led_on
|
||||||
entity_id: light.bed_led
|
|
||||||
data:
|
|
||||||
brightness_pct: 100
|
|
||||||
- service: fan.turn_on
|
- service: fan.turn_on
|
||||||
entity_id: fan.philips_airpurifier
|
entity_id: fan.philips_airpurifier
|
||||||
- service: input_select.select_option
|
- service: input_select.select_option
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ script:
|
|||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
entity_id:
|
entity_id:
|
||||||
- light.hallway_entrance
|
- light.hallway_entrance
|
||||||
- light.bed_led
|
|
||||||
- light.browser_kitchen
|
- light.browser_kitchen
|
||||||
- light.browser_hallway
|
- light.browser_hallway
|
||||||
data:
|
data:
|
||||||
brightness_pct: 100
|
brightness_pct: 100
|
||||||
|
- service: script.bed_led_on
|
||||||
- service: script.security_camera_off
|
- service: script.security_camera_off
|
||||||
- service: script.routine_coming_home_after_sunset
|
- service: script.routine_coming_home_after_sunset
|
||||||
- service: input_select.select_option
|
- service: input_select.select_option
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ script:
|
|||||||
data:
|
data:
|
||||||
message: "Entering night mode. Good night!"
|
message: "Entering night mode. Good night!"
|
||||||
|
|
||||||
|
- service: script.bed_led_on
|
||||||
|
data:
|
||||||
|
brightness_pct: 40
|
||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
entity_id: light.bed_led
|
entity_id: light.bed_led
|
||||||
data:
|
data:
|
||||||
|
|||||||
Reference in New Issue
Block a user