{"id":4548,"date":"2023-06-11T19:23:00","date_gmt":"2023-06-12T02:23:00","guid":{"rendered":"https:\/\/www.sheer.us\/weblogs\/?p=4548"},"modified":"2023-06-11T19:28:17","modified_gmt":"2023-06-12T02:28:17","slug":"using-devicehue","status":"publish","type":"post","link":"https:\/\/www.sheer.us\/weblogs\/programming\/using-devicehue","title":{"rendered":"Using Device::Hue"},"content":{"rendered":"<p>So, I found a major lack of documentation for Device::Hue, and chatGPT had some information that I would describe as whimsically wrong.<\/p>\n<p>Here&#8217;s what I ended up doing to get a working perl setup controlling my hue lights:<\/p>\n<p>1) Put a valid URL in \/etc\/environment for the key HUE_BRIDGE<br \/>\n2) Put a key in \/etc\/environment for the key HUE_KEY<br \/>\n3) The following code sets lights 17 and 19 to red:<\/p>\n<p><PRE><br \/>\nmy $bridge = Device::Hue->new();<br \/>\n$bridge->config();<br \/>\nforeach $light_id (17, 19) {<br \/>\n   my $light = $bridge->light($light_id);<\/p>\n<p>   $light->set_state( { hue => 0, sat => 254 });<br \/>\n   $light->commit();<br \/>\n}<br \/>\n<\/PRE><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, I found a major lack of documentation for Device::Hue, and chatGPT had some information that I would describe as whimsically wrong. Here&#8217;s what I ended up doing to get a working perl setup controlling my hue lights: 1) Put a valid URL in \/etc\/environment for the key HUE_BRIDGE 2) Put a key in \/etc\/environment [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts\/4548"}],"collection":[{"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/comments?post=4548"}],"version-history":[{"count":3,"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts\/4548\/revisions"}],"predecessor-version":[{"id":4551,"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts\/4548\/revisions\/4551"}],"wp:attachment":[{"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/media?parent=4548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/categories?post=4548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/tags?post=4548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}