Skip to content

Instantly share code, notes, and snippets.

@asciipip
Created April 11, 2019 18:47
Show Gist options
  • Save asciipip/7345db73570295bd607ed86f302e87a0 to your computer and use it in GitHub Desktop.
Save asciipip/7345db73570295bd607ed86f302e87a0 to your computer and use it in GitHub Desktop.
The morning alarm script I use with `oh-set-gradually`.
#### Normal use: start at 6:00 am
[rest]
host = "openhab.example.com"
port = 8080
[monitor]
item = "morning_alarm_running"
initialize = "ON"
stop_on = "OFF"
finalize = "OFF"
### Phase 1 - 6:00
##
## Gradually brighten lights, hitting target brightness at 6:15.
##
## Target is 50% for room light, 75% for nightstand, since the nightstand
## light is less bright overall. Similarly, don't start the room light
## until 6:05, letting the nightstand start things off very gently.
##
## At the same time, shift the nightstand color temperature from 2500K up
## to about 5000K, simulating sunrise.
[[changes]]
item = "phil_nightstand_color_temperature"
end_value = 100
[[changes]]
item = "phil_nightstand_light"
start_value = [0, 0, 0]
duration = 900
end_value = [0, 0, 75]
[[changes]]
item = "bedroom_light"
start_value = 0
start_time = 300
duration = 600
end_value = 50
[[changes]]
item = "phil_nightstand_color_temperature"
start_time = 300
duration = 600
end_value = 62
### Phase 1.5 - 6:30
##
## Bring all of the lights up to full brightness.
[[changes]]
item = "bedroom_lights"
start_time = 1800
end_value = 100
### Phase 2 - 7:10
##
## Turn the nightstand green, indicating time to definitely be out of bed.
## Gradually shift toward red, hitting full red at 7:50 (ten minutes after
## target departure time).
[[changes]]
item = "phil_nightstand_light"
start_time = 4200
duration = 2400
start_value = [120, 50, 100]
end_value = [0, 100, 100]
### Phase 3 - 8:00
##
## Turn everything off. Reset nightstand to 0% saturation (white light).
[[changes]]
item = "bedroom_lights"
start_time = 7200
end_value = "OFF"
[[changes]]
item = "phil_nightstand_light"
start_time = 7200
end_value = [0, 0, 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment