# "*": "https://raw.githubusercontent.com/wefindx/schema/master/method/oo-item.yaml" # "base:title": "0oo - Sunrise WakeUp Screen" "og:title": "Sunrise WakeUp Screen" "og:description": "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 …" "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": "PIOIP75wU7zfS2u6gfmPJ6N8vNbJ051hOanUofdCNfOIhPkYD1twfrdurgrTX47y" "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,"}] # "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": "PIOIP75wU7zfS2u6gfmPJ6N8vNbJ051hOanUofdCNfOIhPkYD1twfrdurgrTX47y" "item:voting:submit-value-option": {"selected": "[-]", "value": "-"} "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:
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.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" # "item:link:items": "item:link:add": "/admin/hlog/link/add/?parent=87001" "item:project:items": "item:project:add": "/admin/hlog/project/add/?parent=87001" "item:comment:add": "/methods/addnote?parent=87001" "item:comment:add:csrf_token": "PIOIP75wU7zfS2u6gfmPJ6N8vNbJ051hOanUofdCNfOIhPkYD1twfrdurgrTX47y" "item:comment:form": |