Bed LED scripts

This commit is contained in:
2020-12-27 19:12:40 +02:00
parent f44a33fc57
commit bf4af3a69a
11 changed files with 65 additions and 29 deletions
@@ -50,6 +50,9 @@ cards:
template: [small, with_state_background]
entity: light.bed_led
name: Bed
tap_action:
action: call-service
service: script.bed_led_toggle
- type: custom:button-card
template: [small, with_state_background]
entity: light.bedside
@@ -50,6 +50,9 @@ cards:
template: [small, with_state_background]
entity: light.bed_led
name: Bed
tap_action:
action: call-service
service: script.bed_led_toggle
- type: custom:button-card
template: [small, with_state_background]
entity: light.bedside
@@ -31,6 +31,9 @@
template: default
entity: light.bed_led
name: Bed
tap_action:
action: call-service
service: script.bed_led_toggle
- type: custom:button-card
template: default
entity: light.bedside
@@ -63,6 +63,9 @@
template: default
entity: light.bed_led
name: Bed
tap_action:
action: call-service
service: script.bed_led_toggle
- type: custom:button-card
template: default
entity: light.bedside
@@ -18,3 +18,29 @@ sensor:
icon: "mdi:signal"
unit_of_measurement: "lqi"
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:
entity_id: light.master_bedroom
brightness_pct: >-
{% if not is_state('input_select.house_mode', 'day') %}
40
{% else %}
100
{% endif %}
{% if not is_state('input_select.house_mode', 'day') %} 40 {% else %} 100 {% endif %}
- service: script.bed_led_on
data_template:
brightness_pct: >-
{% if not is_state('input_select.house_mode', 'day') %} 40 {% else %} 100 {% endif %}
button_1_double:
- service: light.turn_off
@@ -71,7 +70,6 @@ automation:
data_template:
entity_id:
- light.bedside
- light.bed_led
brightness_pct: >-
{% if not is_state('input_select.house_mode', 'day') %}
@@ -79,6 +77,7 @@ automation:
{% else %}
100
{% endif %}
- service: script.bed_led_on
button_3_single:
- service: media_player.media_play_pause
@@ -21,6 +21,11 @@ automation:
input:
z2m_topic: "z2m_deconz/bedside_switch"
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
data_template:
entity_id: >-
@@ -28,25 +33,20 @@ automation:
{% if is_state('input_select.house_mode', 'day') %}
light.master_bedroom_main
{% elif is_state('input_select.house_mode', 'bed') %}
light.bedside, light.bed_led
{% elif is_state('input_select.house_mode', 'night') %}
light.bed_led
light.bedside
{% endif %}
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:
- service: light.toggle
data_template:
entity_id:
- light.bedside
- light.bed_led
entity_id: light.bedside
data:
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:
- service: input_select.select_next
@@ -58,11 +58,10 @@ automation:
state: 'double'
action:
- service: light.toggle
data_template:
entity_id:
- light.bedside
- light.bed_led
entity_id: light.bedside
data:
brightness_pct: 100
- service: script.bed_led_toggle
- alias: Music · Master bedroom · Play pause on switch hold
trigger:
+1 -4
View File
@@ -5,10 +5,7 @@ script:
# Set master bedroom state
- service: light.turn_on
entity_id: light.bedside
- service: light.turn_on
entity_id: light.bed_led
data:
brightness_pct: 100
- service: script.bed_led_on
- service: fan.turn_on
entity_id: fan.philips_airpurifier
- service: input_select.select_option
+1 -1
View File
@@ -11,11 +11,11 @@ script:
- service: light.turn_on
entity_id:
- light.hallway_entrance
- light.bed_led
- light.browser_kitchen
- light.browser_hallway
data:
brightness_pct: 100
- service: script.bed_led_on
- service: script.security_camera_off
- service: script.routine_coming_home_after_sunset
- service: input_select.select_option
+3
View File
@@ -10,6 +10,9 @@ script:
data:
message: "Entering night mode. Good night!"
- service: script.bed_led_on
data:
brightness_pct: 40
- service: light.turn_on
entity_id: light.bed_led
data: