{"id":1104,"date":"2019-07-19T06:03:21","date_gmt":"2019-07-19T13:03:21","guid":{"rendered":"https:\/\/lianza.org\/blog\/?p=1104"},"modified":"2019-07-19T06:12:03","modified_gmt":"2019-07-19T13:12:03","slug":"i-wanted-to-stop-sleeping-next-to-my-phone","status":"publish","type":"post","link":"https:\/\/lianza.org\/blog\/2019\/07\/19\/i-wanted-to-stop-sleeping-next-to-my-phone\/","title":{"rendered":"I wanted to stop sleeping next to my phone."},"content":{"rendered":"\n<p>The painting &#8220;Mobile Lovers&#8221; by <a href=\"https:\/\/en.wikipedia.org\/wiki\/Banksy\">Banksy<\/a> always struck a chord with me. I know I spend a lot of time looking at my phone, and am wary of it being at the expense of experiencing real life. I think it&#8217;s a very powerful visual.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"600\" src=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/2014.04-Banksy-0015-Edit.jpg\" alt=\"\" class=\"wp-image-1106\" srcset=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/2014.04-Banksy-0015-Edit.jpg 900w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/2014.04-Banksy-0015-Edit-300x200.jpg 300w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/2014.04-Banksy-0015-Edit-768x512.jpg 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><figcaption>Source:<a href=\"https:\/\/news.artnet.com\/exhibitions\/banksy-gives-controversial-mobile-lovers-artwork-to-bristol-youth-club-14648\">Banksy Gives Controversial Mobile Lovers Artwork to Bristol Youth Club<\/a><\/figcaption><\/figure>\n\n\n\n<p>One specific scenario in which I would really like to stop looking at my phone is<strong> in bed right before I sleep<\/strong>. There are countless articles about the damage it does to your sleep quality. However, like many people with operational responsibilities at tech companies, there&#8217;s the possibility that I <strong>could be paged at any time<\/strong>, and those pages come via my phone. Turning it off before bed is not a realistic option. When I wake up in the middle of the night, I will often check my phone to see if I missed anything important. Even with <a href=\"https:\/\/www.androidpit.com\/night-mode-blue-filter-android\">Night Mode<\/a> on, this is still a fairly big bright light in my face, disrupting my ability to get back to sleep. Worse, I might see some distracting thing that lures me into needless latenight phone engagement.<\/p>\n\n\n\n<p>The reality is <strong>I didn&#8217;t need all of my phone&#8217;s capabilities at night<\/strong>, I just needed to be able to receive critical notifications from specific sources. I knew I still wanted something next to my bed that I could glance at &#8211; but <strong>Not My Phone<\/strong>. <\/p>\n\n\n\n<p>My idea &#8211; what if I had a low-light bedside clock that could show notifications on it? I had a spare <a href=\"https:\/\/www.raspberrypi.org\/\">Raspberry Pi<\/a> that wasn&#8217;t being put to use. Maybe I could code something up between it and my phone, using Bluetooth or similar. As I started to poke around, I found a solution that was even simpler&#8230; a company called <a href=\"https:\/\/www.pushbullet.com\/\">Pushbullet<\/a> had already done 90% of the work for me &#8211; they built an app that lets you get your phone&#8217;s push notifications via an API. So&#8230; I grabbed a domain and <a href=\"https:\/\/notmyphone.com\/\">notmyphone.com<\/a> was born.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/IMG_7989-1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/IMG_7989-1-1024x683.jpg\" alt=\"\" class=\"wp-image-1115\" srcset=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/IMG_7989-1-1024x683.jpg 1024w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/IMG_7989-1-300x200.jpg 300w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/IMG_7989-1-768x512.jpg 768w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/IMG_7989-1.jpg 1776w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>The case does somewhat resemble a homemade bomb<\/figcaption><\/figure>\n\n\n\n<p>I picked up this <a href=\"https:\/\/www.amazon.com\/dp\/B07L4C8CPY\/\">cheap screen &amp; case<\/a> for the Raspberry Pi since it didn&#8217;t look too ugly in the photos. As I later learned, the photos don&#8217;t show the power cord, which sticks out the top and looks ridiculous. But, c&#8217;est la vie &#8211; it worked and can be turned down nice and dim. Since the <a href=\"https:\/\/docs.pushbullet.com\/\">Pushbullet API<\/a> supports websockets for notifications, I was able to build an almost completely static site (it&#8217;s hosted on <a href=\"https:\/\/pages.github.com\/\">GitHub Pages<\/a>) to serve the <a href=\"https:\/\/github.com\/tlianza\/notmyphone\">UI<\/a>, and updates are sent directly to the client. The only dynamic part I needed was the OAuth login, which I just built as a <a href=\"https:\/\/workers.cloudflare.com\/\">Cloudflare Worker<\/a>.<\/p>\n\n\n\n<p>While I was targeting the 480&#215;320 screen, it&#8217;s simple enough that it can really run anywhere, and you can easily test it out in the browser. I wanted it to be able to accumulate a few notifications (it&#8217;s coded to store the last 4) in case I woke up and missed more than one thing. They just stack up and the oldest one rolls off the screen as they accumulate.<\/p>\n\n\n\n<ul class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"958\" height=\"630\" src=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone2.png\" alt=\"\" data-id=\"1108\" data-link=\"https:\/\/lianza.org\/blog\/?attachment_id=1108#main\" class=\"wp-image-1108\" srcset=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone2.png 958w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone2-300x197.png 300w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone2-768x505.png 768w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/a><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"638\" src=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone3.png\" alt=\"\" data-id=\"1109\" data-link=\"https:\/\/lianza.org\/blog\/?attachment_id=1109#main\" class=\"wp-image-1109\" srcset=\"https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone3.png 960w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone3-300x199.png 300w, https:\/\/lianza.org\/blog\/wp-content\/uploads\/2019\/07\/Not_My_Phone3-768x510.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/figure><\/li><\/ul>\n\n\n\n<p>A neat behavior the Pushbullet API enabled me to add was<strong> if you dismiss the notification on your phone, it also gets dismissed from the bedside clock<\/strong>. This way it&#8217;s not accumulating things you&#8217;ve already seen, assuming you&#8217;re away from bed when the notifications arrive. You can also fully customize which apps send messages to Pushbullet via their <a href=\"https:\/\/www.pushbullet.com\/apps\">mobile app<\/a>, so I&#8217;ve tuned it down such that I&#8217;m not getting LinkedIn notifications, etc. Only things I deem important enough that I want to see if I wake up at 2am show up on the clock.<\/p>\n\n\n\n<p>Okay, so it&#8217;s not a beautiful work of art, but when I go to bed, I put my phone face-down without worry that I&#8217;m missing anything. When I wake up in the middle of the night, I can glance at the clock and see that all is well and go back to bed without unleashing a phone-screen&#8217;s worth of light into my eyes.<\/p>\n\n\n\n<p>If this is interesting to anyone, feedback &amp; pull requests always welcome. In building this I also developed a <a href=\"https:\/\/github.com\/tlianza\/pigeon\">Sentry client for Cloudflare Workers<\/a> to help me debug issues, which you might find useful for your projects. Fair warning: I&#8217;m by no means a JavaScript expert. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The painting &#8220;Mobile Lovers&#8221; by Banksy always struck a chord with me. I know I spend a lot of time looking at my phone, and am wary of it being at the expense of experiencing real life. I think it&#8217;s a very powerful visual. One specific scenario in which I would really like to stop [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7,9],"tags":[],"class_list":["post-1104","post","type-post","status-publish","format-standard","hentry","category-me","category-techie"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5TCqO-hO","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/posts\/1104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/comments?post=1104"}],"version-history":[{"count":10,"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/posts\/1104\/revisions"}],"predecessor-version":[{"id":1133,"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/posts\/1104\/revisions\/1133"}],"wp:attachment":[{"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/media?parent=1104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/categories?post=1104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lianza.org\/blog\/wp-json\/wp\/v2\/tags?post=1104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}