Skip to content

Commit 81f0b82

Browse files
committed
Casper Glow: add examples
Add examples and blueprints to documentation.
1 parent e0f173f commit 81f0b82

4 files changed

Lines changed: 255 additions & 0 deletions

File tree

source/_integrations/casper_glow.markdown

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,98 @@ The **Casper Glow** {% term integration %} provides the following entities.
8282
- **Dimming time**
8383
- **Description**: Configures how long the dimming sequence lasts before the light turns off. You can choose between 15, 30, 45, 60, or 90 minutes. The new dimming time takes effect the next time the light is turned on.
8484

85+
## Examples
86+
87+
### Bedtime routine
88+
89+
Start a dimming sequence at a set time each night. This blueprint lets you pick your bedtime and how long the light takes to dim, so your Glow is ready when you are.
90+
91+
{% my blueprint_import badge blueprint_url="https://www.home-assistant.io/blueprints/integrations/casper_glow_bedtime_routine.yaml" %}
92+
93+
{% details "Example YAML" %}
94+
{% raw %}
95+
```yaml
96+
triggers:
97+
- trigger: time
98+
at: "22:00:00"
99+
actions:
100+
- action: select.select_option
101+
target:
102+
entity_id: select.jar_dimming_time
103+
data:
104+
option: "30"
105+
- action: light.turn_on
106+
target:
107+
entity_id: light.jar
108+
```
109+
{% endraw %}
110+
{% enddetails %}
111+
112+
### Pause on motion
113+
114+
Keep the light from dimming while you're still up. This blueprint pauses the dimming sequence whenever motion is detected, so the light holds its brightness until you settle in.
115+
116+
{% my blueprint_import badge blueprint_url="https://www.home-assistant.io/blueprints/integrations/casper_glow_pause_on_motion.yaml" %}
117+
118+
{% details "Example YAML" %}
119+
{% raw %}
120+
```yaml
121+
triggers:
122+
- trigger: state
123+
entity_id: binary_sensor.bedroom_motion
124+
to: "on"
125+
conditions:
126+
- condition: state
127+
entity_id: light.jar
128+
state: "on"
129+
actions:
130+
- action: casper_glow.pause
131+
target:
132+
entity_id: light.jar
133+
```
134+
{% endraw %}
135+
{% enddetails %}
136+
137+
### Turn on and hold at nightlight level
138+
139+
Turn on the Glow and let it dim down to a soft nightlight, then hold it there. This blueprint starts the dimming sequence and automatically pauses it when a set number of minutes remain, leaving a gentle glow in the room through the night.
140+
141+
{% my blueprint_import badge blueprint_url="https://www.home-assistant.io/blueprints/integrations/casper_glow_turn_on_pause_nightlight.yaml" %}
142+
143+
{% details "Example YAML" %}
144+
{% raw %}
145+
```yaml
146+
triggers:
147+
- trigger: time
148+
at: "22:00:00"
149+
actions:
150+
- action: select.select_option
151+
target:
152+
entity_id: select.jar_dimming_time
153+
data:
154+
option: "30"
155+
- action: light.turn_on
156+
target:
157+
entity_id: light.jar
158+
- wait_for_trigger:
159+
- trigger: template
160+
value_template: >-
161+
{% set end = states('sensor.jar_dimming_end_time') | as_datetime %}
162+
{% if end is not none %}
163+
{{ ((end - now()).total_seconds() / 60) | round(0) <= 10 }}
164+
{% else %}
165+
false
166+
{% endif %}
167+
timeout:
168+
minutes: 30
169+
continue_on_timeout: false
170+
- action: button.press
171+
target:
172+
entity_id: button.jar_pause
173+
```
174+
{% endraw %}
175+
{% enddetails %}
176+
85177
## Data updates
86178
87179
The **Casper Glow** {% term integration %} detects the device through passive Bluetooth advertisements. All state updates are retrieved by actively {% term polling %} the device every 30 seconds — for example, to detect changes made directly on the light or through the Casper app.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
blueprint:
2+
name: "Bedtime Casper Glow routine"
3+
description: "Turns on the Casper Glow at a set time with a configured dimming duration for bedtime."
4+
domain: automation
5+
input:
6+
bedtime:
7+
name: Bedtime
8+
selector:
9+
time:
10+
glow_device:
11+
name: Casper Glow
12+
selector:
13+
device:
14+
filter:
15+
- integration: casper_glow
16+
dimming_minutes:
17+
name: Dimming duration
18+
default: "30"
19+
selector:
20+
select:
21+
options:
22+
- "15"
23+
- "30"
24+
- "45"
25+
- "60"
26+
- "90"
27+
variables:
28+
glow_device: !input glow_device
29+
triggers:
30+
- trigger: time
31+
at: !input bedtime
32+
actions:
33+
- action: select.select_option
34+
target:
35+
entity_id: >
36+
{{ device_entities(glow_device)
37+
| select('match', 'select\\..*')
38+
| first }}
39+
data:
40+
option: !input dimming_minutes
41+
- action: light.turn_on
42+
target:
43+
entity_id: >
44+
{{ device_entities(glow_device)
45+
| select('match', 'light\\..*')
46+
| first }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
blueprint:
2+
name: "Pause Casper Glow on motion"
3+
description: "Pauses the Casper Glow dimming sequence when motion is detected in the room."
4+
domain: automation
5+
input:
6+
motion_sensor:
7+
name: Motion sensor
8+
selector:
9+
entity:
10+
domain: binary_sensor
11+
device_class: motion
12+
glow_light:
13+
name: Casper Glow light
14+
selector:
15+
entity:
16+
filter:
17+
integration: casper_glow
18+
domain: light
19+
variables:
20+
glow_light: !input glow_light
21+
pause_button: >
22+
{{ device_entities(device_id(glow_light))
23+
| select('match', 'button\\.')
24+
| select('search', 'pause')
25+
| first }}
26+
triggers:
27+
- trigger: state
28+
entity_id: !input motion_sensor
29+
to: "on"
30+
conditions:
31+
- condition: state
32+
entity_id: !input glow_light
33+
state: "on"
34+
actions:
35+
- action: button.press
36+
target:
37+
entity_id: "{{ pause_button }}"
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
blueprint:
2+
name: "Turn on Casper Glow and pause at nightlight level"
3+
description: "Turns on the Casper Glow at a set time, then pauses the dimming sequence when a specified number of minutes remain, holding the light at a dim nightlight level. Requires the Dimming End Time sensor to be enabled."
4+
domain: automation
5+
input:
6+
bedtime:
7+
name: Turn-on time
8+
selector:
9+
time:
10+
glow_device:
11+
name: Casper Glow
12+
selector:
13+
device:
14+
filter:
15+
- integration: casper_glow
16+
dimming_minutes:
17+
name: Dimming duration
18+
default: "15"
19+
selector:
20+
select:
21+
options:
22+
- "15"
23+
- "30"
24+
- "45"
25+
- "60"
26+
- "90"
27+
pause_at_remaining:
28+
name: Pause when this many minutes remain
29+
default: 10
30+
selector:
31+
number:
32+
min: 1
33+
max: 89
34+
unit_of_measurement: min
35+
mode: restart
36+
variables:
37+
glow_device: !input glow_device
38+
dimming_minutes: !input dimming_minutes
39+
pause_at_remaining: !input pause_at_remaining
40+
light_entity: >
41+
{{ device_entities(glow_device) | select('match', 'light\\.') | first }}
42+
select_entity: >
43+
{{ device_entities(glow_device) | select('match', 'select\\.') | first }}
44+
pause_button: >
45+
{{ device_entities(glow_device)
46+
| select('match', 'button\\.')
47+
| select('search', 'pause')
48+
| first }}
49+
sensor_entity: >
50+
{{ device_entities(glow_device)
51+
| select('match', 'sensor\\.')
52+
| select('search', 'dimming_end_time')
53+
| first }}
54+
triggers:
55+
- trigger: time
56+
at: !input bedtime
57+
actions:
58+
- action: select.select_option
59+
target:
60+
entity_id: "{{ select_entity }}"
61+
data:
62+
option: !input dimming_minutes
63+
- action: light.turn_on
64+
target:
65+
entity_id: "{{ light_entity }}"
66+
- wait_for_trigger:
67+
- trigger: template
68+
value_template: >-
69+
{% set end = states(sensor_entity) | as_datetime %}
70+
{% if end is not none %}
71+
{{ ((end - now()).total_seconds() / 60) | round(0) <= pause_at_remaining | int }}
72+
{% else %}
73+
false
74+
{% endif %}
75+
timeout:
76+
minutes: "{{ dimming_minutes | int }}"
77+
continue_on_timeout: false
78+
- action: button.press
79+
target:
80+
entity_id: "{{ pause_button }}"

0 commit comments

Comments
 (0)