# Brightness depending on the time of day

**URL:** <https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167>\
**Category:** Questions\
**Created:** [November 30, 2021, 10:41am UTC](https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167 "2021-11-30T10:41:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quarks](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/quarks/32/2325_2.png) [@Quarks](https://wled.discourse.group/u/Quarks)\
**Post date:** [November 30, 2021, 10:41am UTC](https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167/1 "2021-11-30T10:41:30Z")

</div>

we switch a WS2801 strip using a PIR motion sensor HC-SR501. That works fine.  
Now we would like to achieve that the brightness is reduced by 25% between 8:00 p.m. and 6:00 a.m.

Is that possible with macros?

---

<div class="post-metadata">

**Author:** ![blazoncek](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/blazoncek/32/1886_2.png) [@blazoncek](https://wled.discourse.group/u/blazoncek)\
**Post date:** [November 30, 2021, 5:18pm UTC](https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167/2 "2021-11-30T17:18:46Z")

</div>

Yes.  
First off, save all your presets **without** brightness included.  
Next create two presets that will change brightness only to 75% and 100%.  
Next create two presets that will turn WLED on and off.  
Then create a playlist (preset for on + preset for desired effect when WLED is triggered)  
Assign playlist to On action and off preset to Off action.  
Schedule preset for 75% brightness at 8:00 p.m.  
Schedule preset for 100% brightness at 6:00 a.m.

---

<div class="post-metadata">

**Author:** ![Quarks](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/quarks/32/2325_2.png) [@Quarks](https://wled.discourse.group/u/Quarks)\
**Post date:** [December 1, 2021, 6:17pm UTC](https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167/3 "2021-12-01T18:17:26Z")

</div>

Thank you very much for this detailed guide. I didn’t expect that.  
Try to build it up like that, I might have to ask.  
I will report 🙂

---

<div class="post-metadata">

**Author:** ![Quarks](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/quarks/32/2325_2.png) [@Quarks](https://wled.discourse.group/u/Quarks)\
**Post date:** [December 2, 2021, 10:45am UTC](https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167/4 "2021-12-02T10:45:56Z")

</div>

thanks to your help i was able to solve the problem. Once again many thanks !

I have created 3 presets:

Schedule preset for 75% brightness at 8:00 p.m.  
`{"on": false, "bri": 64}`

Schedule preset for 100% brightness at 6:00 a.m.  
`{"on": false, "bri": 191}`

on event:  
on / off preset without brightness

---

<div class="post-metadata">

**Author:** ![huggy-d1](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/huggy-d1/32/51_2.png) [@huggy-d1](https://wled.discourse.group/u/huggy-d1)\
**Post date:** [December 2, 2021, 4:53pm UTC](https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167/5 "2021-12-02T16:53:33Z")

</div>

If you want it to match sunrise (dawn) and sunset (dusk) for your area, you can use the sunrise / sunset triggering in the time/macros scheduling section. Just include an approximate lat/lon for your location and the sunrise / sunset will work and automatically adjust.

If you want the brightness to progress, there are a couple techniques people have used, including sending the brightness and on/off commands using a RPi or PC that’s always on. Schedule with cron or Task Scheduler to run a curl command at the proper time that sends that JSON data to that WLED’s IP address.

---

<div class="post-metadata">

**Author:** ![Quarks](https://yyz2.discourse-cdn.com/free1/user_avatar/wled.discourse.group/quarks/32/2325_2.png) [@Quarks](https://wled.discourse.group/u/Quarks)\
**Post date:** [December 3, 2021, 11:57am UTC](https://wled.discourse.group/t/brightness-depending-on-the-time-of-day/4167/6 "2021-12-03T11:57:02Z")

</div>

Thanks for the tip. I have the time 6:00 a.m. replaced by sunrise.

This small application should work locally 🙂 CURL / cron is being used sensibly on my next larger project.
