{"id":409,"date":"2020-09-20T23:12:37","date_gmt":"2020-09-20T23:12:37","guid":{"rendered":"https:\/\/lab.rapternet.us\/?p=409"},"modified":"2020-09-20T23:12:37","modified_gmt":"2020-09-20T23:12:37","slug":"automated-stairway-night-lights","status":"publish","type":"post","link":"https:\/\/lab.rapternet.us\/?p=409","title":{"rendered":"Automated Stairway Night Lights"},"content":{"rendered":"\n<p>I wanted a simple but useful project as my first bit of home automation after getting some <a href=\"https:\/\/lab.rapternet.us\/?p=400\">CloudFree smart plugs<\/a>. We have fairy (christmas) lights on our banisters going upstairs that we plug in whenever we want to use them, so why not set them up on the smart plugs and setup an automation to turn them on at night, and turn them off around when we should be going to bed. This seemed like a simple enough project for a first shot at it, and something that we would use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Goal<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Stairway lights turn on before sundown<\/li><li>Stairway lights turn off around bedtime on weekdays<\/li><li>Stairway lights turn off slightly later on weekends<\/li><\/ul>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Automations<\/h2>\n\n\n\n<p>After getting the two <a href=\"https:\/\/lab.rapternet.us\/?p=400\">smart plugs setup on MQTT<\/a>, the process in home assistant was straight forward to do. Under Configuration \u2192 Automations, I added 3 total automations:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Turn off at Bedtime Weekday<\/li><li>Turn off at Bedtime Weekend<\/li><li>Turn on at Night<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Turn on At Night<\/h2>\n\n\n\n<p>Home Assistant has a trigger at sunset, so I used that with a 30 minute offset (turn them on slightly before sunset). For the actions on this automation, I wanted to turn on the lights (not toggle), so I used that in my actions, and since this wasn&#8217;t dependent on the day of the week, this automation won&#8217;t have any conditions on it.<\/p>\n\n\n\n<p>Trigger:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Type: Sun<\/li><li>Event: Sunset<\/li><li>Offset: -00:30:00<\/li><\/ul>\n\n\n\n<p>Actions:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Type: Device<\/li><li>Device: CloudFree<\/li><li>Action: Turn on CloudFree CloudFreeSmartPlug1 (will be different based on the friendly name of your smart plugs)<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Type: Device<\/li><li>Device: CloudFree<\/li><li>Action: Turn on CloudFree SmartPlug2 (will be different based on the friendly name of your smart plugs)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Turn off At Bedtime<\/h2>\n\n\n\n<p>I have two automations for turning the lights off, one for weekdays, and one for weekends. I couldn&#8217;t see a straight forward way to change the time without having a separate automation, and since this is the first set of automations I&#8217;ve worked on, I didn&#8217;t mind having multiple of them for the same task. Since both of the turn off automations are extremely similar, I&#8217;m going to group them together in this guide. The only differences between them are the trigger time and the condition days.<\/p>\n\n\n\n<p>Triggers:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Type: Time<\/li><li>At Time: 21:30 (military time)<\/li><\/ul>\n\n\n\n<p>Conditions:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Condition Type: Time<\/li><\/ul>\n\n\n\n<p>This was setup as YAML, so click those 3 dots and click \u201cEdit as YAML\u201d. The GUI doesn&#8217;t have the day of week conditions available, but they can be configured in the YAML, which is why we needed to do it this way. Below is for the weekday settings, and the second group of days is for the weekend settings.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">weekday:\n  - sun\n  - mon\n  - tue\n  - wed\n  - thu<\/pre>\n\n\n\n<p>Below are the days for the weekend settings.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">condition: time\nweekday:\n  - fri\n  - sat<\/pre>\n\n\n\n<p>Actions:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Type: Device<\/li><li>Device: CloudFree<\/li><li>Action: Turn off CloudFree CloudFreeSmartPlug1<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Type: Device<\/li><li>Device: CloudFree<\/li><li>Action: Turn off CloudFree SmartPlug2<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>This was a relatively quick project from receiving the smart plugs to having them in home assistant with automations in place. We already like the ability to turn them on and off from the HASS GUI and having the automations on them is that much better.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"797\" height=\"1024\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-a-797x1024.png\" alt=\"\" class=\"wp-image-411\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-a-797x1024.png 797w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-a-234x300.png 234w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-a-768x986.png 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-a-1196x1536.png 1196w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-a.png 1517w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"943\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-actions-1024x943.png\" alt=\"\" class=\"wp-image-412\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-actions-1024x943.png 1024w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-actions-300x276.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-actions-768x707.png 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2020\/09\/turn-off-automation-actions.png 1114w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted a simple but useful project as my first bit of home automation after getting some CloudFree smart plugs. We have fairy (christmas) lights on our banisters going upstairs that we plug in whenever we want to use them, so why not set them up on the smart plugs and setup an automation to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lab.rapternet.us\/?p=409\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Automated Stairway Night Lights&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":417,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[39,49],"class_list":["post-409","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","tag-home-assistant","tag-smart-home"],"_links":{"self":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=409"}],"version-history":[{"count":6,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/409\/revisions"}],"predecessor-version":[{"id":418,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/409\/revisions\/418"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/media\/417"}],"wp:attachment":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}