{"id":15813,"date":"2023-10-03T08:46:52","date_gmt":"2023-10-03T14:46:52","guid":{"rendered":"https:\/\/macblaze.ca\/?p=15813"},"modified":"2023-12-04T10:17:27","modified_gmt":"2023-12-04T17:17:27","slug":"smart-lights","status":"publish","type":"post","link":"https:\/\/macblaze.ca\/?p=15813","title":{"rendered":"Smart lights"},"content":{"rendered":"<h2>&#8230;And Home Assistant<\/h2>\n<p>So last year I bought a couple of smart lights to play around with. I ended up installing <a href=\"https:\/\/www.home-assistant.io\/\" target=\"_blank\" rel=\"noopener\">Home Assistant<\/a> in a docker on my pi (the pi400) to control them.<\/p>\n<p>I have an Office light and TV room light.<\/p>\n<ul>\n<li>The TV light turns on 1\/2 hour before sunset and off at 10:10 pm everyday.<\/li>\n<li>The Office turns on 1\/2 hour before sunset then fades to a calm colour at 7 pm, turning off completely at 10:10pm.<\/li>\n<li>In the morning the Office light turns on at 7 am and the off 1\/2 hour after sunset.<\/li>\n<\/ul>\n<p>But I want the office light to not turn on\/off in the morning when the days are long so I had to write some YAML code which I&#8217;ve had to revise several times.<\/p>\n<p>This is a trigger to fire my office light (in the morning) between September 25 and May 15. It still may not be working right, but so far so good.<\/p>\n<p>Edit YAML mode:<\/p>\n<pre><code>\ncondition: template\nvalue_template: &gt;\n  {% set n = now() %} {{ n.month == 9 and n.day &gt;= 25 or n.month &gt; 9\n         or n.month == 5 and n.day &lt;= 15 or n.month &lt; 5 }}\n<\/code><\/pre>\n<p><a href=\"https:\/\/community.home-assistant.io\/t\/automation-during-date-range\/133814\/50\">https:\/\/community.home-assistant.io\/t\/automation-during-date-range\/133814\/50<\/a><\/p>\n<pre><code>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8230;And Home Assistant So last year I bought a couple of smart lights to play around with. I ended up installing Home Assistant in a docker on my pi (the pi400) to control them. I have an Office light and TV room light. The TV light turns on 1\/2 hour before sunset and off at [&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},"categories":[1],"tags":[136],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/macblaze.ca\/index.php?rest_route=\/wp\/v2\/posts\/15813"}],"collection":[{"href":"https:\/\/macblaze.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/macblaze.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/macblaze.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/macblaze.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=15813"}],"version-history":[{"count":7,"href":"https:\/\/macblaze.ca\/index.php?rest_route=\/wp\/v2\/posts\/15813\/revisions"}],"predecessor-version":[{"id":15871,"href":"https:\/\/macblaze.ca\/index.php?rest_route=\/wp\/v2\/posts\/15813\/revisions\/15871"}],"wp:attachment":[{"href":"https:\/\/macblaze.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/macblaze.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/macblaze.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}