# <!-- METAHEADER
# –––––––––––––––––––––––––––––––––––––––––––––––––– -->
"*": "https://raw.githubusercontent.com/wefindx/schema/master/method/oo-item.yaml"
# <!-- HEADER
# –––––––––––––––––––––––––––––––––––––––––––––––––– -->
"base:title": "0oo - Sunrise WakeUp Screen"
"og:title": "Sunrise WakeUp Screen"
"og:description": "These days, computer screens are quite abundant, but few have &quot;Wake Up Lights&quot;. So, we could use computer screen as a morning light simulator. Here is a hint, if you&#x27;re on Linux: 1. Check available screens connected: `xrandr -q | grep &quot; connected&quot;` 2. Set screen brightness: `xrandr --output HDMI-1 --brightness 0.5` Ok, now, let&#x27;s say you&#x27;re interested in sleeping at 15:30 UTC, and waking at 0 UTC... You could simply do, something like this in Python: &lt;pre&gt; import os import time device = &#x27;HDMI-1&#x27; # Let&#x27;s say we sleep 1/3 of day, and sun # starts setting 0.5 hr …"
"og:image": "https://avatars0.githubusercontent.com/u/28134655"
"og:url": "/method/87001/"
"base:css": "/static/css/bootstrap.min.9c25540d6272.css"
"base:extra-css": "/static/css/base.57997aeac1df.css"
"base:favicon": "/static/favicon.acaa334f0136.ico"
"base:body_class": ""
"layout:logo": "/static/0oo.8d2a8bbef612.svg"
"layout:index": "/"
"layout:menu": "/menu/"
"layout:categories": "/intents/"
"layout:ideas": "/methods/"
"layout:projects": "/projects/"
"layout:users": "/users/"
"layout:about": "/about/"
"layout:help": "/help/"
"layout:bug_report": "https://github.com/wefindx/0oo"
"layout:login": "/accounts/login/"
"layout:light-off": "/darken/?darken=true"
"layout:set-multilingual": "/mulang/?mulang=true"
"layout:lang": "Language"
"layout:set-language-post-action": "/i18n/setlang/"
"layout:csrf-token": "zQvv1lvkUBVfOj65n6YjI0fu4mcqWo3Tz2mUlhx1rnUn3dz5PDsWiD3nbO1ZF9le"
"layout:input-next": "/method/87001/"
"layout:languages": [{"code": "ja", "is-active": "false", "name": "日本語"}, {"code": "lt", "is-active": "false", "name": "Lietuviškai"}, {"code": "zh-hans", "is-active": "false", "name": "简体中文"}, {"code": "en", "is-active": "true", "name": "English"}, {"code": "ru", "is-active": "false", "name": "Русский"}, {"code": "oo", "is-active": "false", "name": "O;o,"}]
# <!-- TOPIC
# –––––––––––––––––––––––––––––––––––––––––––––––––– -->
"item:parent:intents": [{"url": "/intent/1215/", "title": "Time Technologies"}]
"item:title": "Sunrise WakeUp Screen"
"item:summary": "Simulate sunrise with computer screen."
"item:voting": 0
"item:voting:add": "/admin/hlog/voting/add/?method=87001"
"item:voting:csrf_token": "zQvv1lvkUBVfOj65n6YjI0fu4mcqWo3Tz2mUlhx1rnUn3dz5PDsWiD3nbO1ZF9le"
"item:voting:submit-value-option": {"selected": "[-]", "value": "-"}
"item:base-administration": false
"item:body": |
    These days, computer screens are quite abundant, but few have "Wake Up Lights". So, we could use computer screen as a morning light simulator.
    
    Here is a hint, if you're on Linux:
    
    1. Check available screens connected:
    
    `xrandr -q | grep " connected"`
    
    2. Set screen brightness:
    
    `xrandr --output HDMI-1 --brightness 0.5`
    
    Ok, now, let's say you're interested in sleeping at 15:30 UTC, and waking at 0 UTC...
    You could simply do, something like this in Python:
    
    <pre>
    import os
    import time
    device = 'HDMI-1'
    
    # Let's say we sleep 1/3 of day, and sun
    # starts setting 0.5 hr before sleep:
    sun = {'rise': 1.0, 'set': 2/3 - 0.5/24}
    
    fade = 0.025 # amount of day to use for fading
    lbound = 0.05 # minimum amount of brightness
    ubound = 1.0 # maximum amount of brightness
    brange = abs(ubound-lbound)
    
    while True:
        now = (time.time()/86400.) % 1
    
        # night
        if sun['set'] <= now <= sun['rise']:
            fadepart = lbound
    
            # sunset
            if sun['set'] <= now <= sun['set']+fade:
                fadepart = lbound + brange - (now - sun['set'])/fade * brange
    
        # day
        elif sun['rise'] <= now <= sun['set']:
            fadepart = ubound
    
            # sunrise
            if sun['rise'] <= now <= sun['rise']+fade:
                fadepart = lbound + (now - sun['rise'])/fade * brange
    
    
        print(fadepart)
    
        os.system(f'xrandr --output {device} --brightness {fadepart}')
    
        time.sleep(5) # check every 5 secs.
    </pre>
    
    This might actually work...
"item:source-date": ""
"item:permalink": "/method/87001/?l=en"
"item:owner": "Mindey"
"item:created": "2021-11-26T15:57:20.055790"
"item:ownerlink": "/user/147/Mindey"
# <!-- LINKS
# –––––––––––––––––––––––––––––––––––––––––––––––––– -->
"item:link:add": "/admin/hlog/link/add/?parent=87001"
"item:link:items":
"item:project:items":

# <!-- COMMENTS
# –––––––––––––––––––––––––––––––––––––––––––––––––– -->
"item:comment:items":
"base:js": "/static/js/base.c7357c06cc89.js"
