{"id":841,"date":"2019-12-04T00:47:01","date_gmt":"2019-12-03T23:47:01","guid":{"rendered":"http:\/\/bergatrollet.se\/blog\/?p=841"},"modified":"2019-12-04T00:50:27","modified_gmt":"2019-12-03T23:50:27","slug":"fibaro-controlling-hue","status":"publish","type":"post","link":"http:\/\/bergatrollet.se\/blog\/2019\/12\/fibaro-controlling-hue\/","title":{"rendered":"Fibaro controlling Hue"},"content":{"rendered":"\n<p>I just covered the topic in a group on Facebook, and might as well cover it here as well so it&#8217;s public also to non-swedes.<\/p>\n\n\n\n<p>The question was how to control the Hue lights from scripts. There is a requirement to use a magic Id number to do this. In fact, there are actually two.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Instaling the Hue function in HC2<\/h2>\n\n\n\n<p>First you need to install the Hue plugin to have the HC2 even talk to Hue. <a href=\"https:\/\/manuals.fibaro.com\/knowledge-base-browse\/adding-philips-hue-to-your-home-center\/\">This guide <\/a>is very straight forward so no point repeating the same content again. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.Enable Hue devices in scenes using blocks<\/h2>\n\n\n\n<p>What is enormously annoying is that the Hue plugin cannot be used in scenes that you build using blocks. For this, you need to create a Virtual Device.<\/p>\n\n\n\n<p>There is one that looks very competent, but which was developed way after I installed my setup. Feel free to test it- <a href=\"https:\/\/forum.fibaro.com\/files\/file\/90-philips-hue-aio-vd-standalone\/\">HERE<\/a>. <\/p>\n\n\n\n<p>My picture is from the version I have installed but in any case you need to find the hueLightID as per my picture below:<br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1529\" height=\"1027\" data-attachment-id=\"843\" data-permalink=\"http:\/\/bergatrollet.se\/blog\/2019\/12\/fibaro-controlling-hue\/image-1-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?fit=1529%2C1027\" data-orig-size=\"1529,1027\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?fit=605%2C406\" src=\"https:\/\/i1.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?fit=520%2C349\" alt=\"\" class=\"wp-image-843\" srcset=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?w=1529 1529w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?resize=300%2C202 300w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?resize=1024%2C688 1024w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?resize=768%2C516 768w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-1.png?w=1210 1210w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<p>That Id is actually rather straight forward. It&#8217;s the index number found in the Hue mobile app.  Chose the cogwheel (settings) and scroll down to the About option.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1182\" height=\"2560\" data-attachment-id=\"844\" data-permalink=\"http:\/\/bergatrollet.se\/blog\/2019\/12\/fibaro-controlling-hue\/image-2-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?fit=1182%2C2560\" data-orig-size=\"1182,2560\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?fit=473%2C1024\" src=\"https:\/\/i1.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?fit=473%2C1024\" alt=\"\" class=\"wp-image-844\" srcset=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?w=1182 1182w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?resize=138%2C300 138w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?resize=473%2C1024 473w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?resize=768%2C1664 768w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?resize=709%2C1536 709w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-2-scaled.png?resize=945%2C2048 945w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">2. Addressing the Hue lamps from own LUA code<\/h2>\n\n\n\n<p>In your own LUA scripts, you use the Id of the Hue plugin per lamp and not the Id of the lamp a per the Hue index. Hoover the wrench with the mouse and then you see in the URL in the bottom left cornet the Id. In this case 74. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1198\" height=\"435\" data-attachment-id=\"842\" data-permalink=\"http:\/\/bergatrollet.se\/blog\/2019\/12\/fibaro-controlling-hue\/image-10\/\" data-orig-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image.png?fit=1198%2C435\" data-orig-size=\"1198,435\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image.png?fit=605%2C220\" src=\"https:\/\/i1.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image.png?fit=520%2C189\" alt=\"\" class=\"wp-image-842\" srcset=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image.png?w=1198 1198w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image.png?resize=300%2C109 300w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image.png?resize=1024%2C372 1024w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image.png?resize=768%2C279 768w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<p>I might just as well provide you with a small piece of LUA that I used to create a Scene for a Walk In Closet. I have installed a door sensor on the door and there is a Hue lamp in there. I want the lamp to turn on when the door is opened, and turn off as soon as the door is closed. You already know that the lamp is Fibaro device Id 74. The Door sensor is device 236.<\/p>\n\n\n\n<p>Script called &#8220;Turn ON WiC light&#8221;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&#8211;[[<br> %% properties<br> 236 value<br> %% weather<br> %% events<br> %% globals<br> &#8211;]]<\/p><p>local startSource = fibaro:getSourceTrigger();<br> if (<br>  ( tonumber(fibaro:getValue(236, &#8220;value&#8221;)) &gt; 0 )<br> or<br> startSource[&#8220;type&#8221;] == &#8220;other&#8221;<br> )<br> then<br>     fibaro:call(74, &#8220;turnOn&#8221;);<br>     fibaro:call(74, &#8220;changeBightness,216&#8221;);<br>     fibaro:call(74, &#8220;changeHue,45853&#8221;);<br>     fibaro:call(74, &#8220;changeSaturation,61&#8221;);<br> end<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"605\" height=\"483\" data-attachment-id=\"851\" data-permalink=\"http:\/\/bergatrollet.se\/blog\/2019\/12\/fibaro-controlling-hue\/image-5-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-5.png?fit=772%2C616\" data-orig-size=\"772,616\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-5.png?fit=605%2C483\" src=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-5.png?resize=605%2C483\" alt=\"\" class=\"wp-image-851\" srcset=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-5.png?w=772 772w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-5.png?resize=300%2C239 300w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-5.png?resize=768%2C613 768w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<p>Script called &#8220;Turn OFF WiC light&#8221;<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&#8211;[[<br> %% properties<br> 236 value<br> %% weather<br> %% events<br> %% globals<br> &#8211;]]<\/p><p>local startSource = fibaro:getSourceTrigger();<br> if (<br>  ( tonumber(fibaro:getValue(236, &#8220;value&#8221;)) == 0 )<br> or<br> startSource[&#8220;type&#8221;] == &#8220;other&#8221;<br> )<br> then<br>     fibaro:call(74, &#8220;turnOff&#8221;);<br> end<\/p><cite> <\/cite><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"605\" height=\"384\" data-attachment-id=\"850\" data-permalink=\"http:\/\/bergatrollet.se\/blog\/2019\/12\/fibaro-controlling-hue\/image-4-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-4.png?fit=836%2C530\" data-orig-size=\"836,530\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-4.png?fit=605%2C384\" src=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-4.png?resize=605%2C384\" alt=\"\" class=\"wp-image-850\" srcset=\"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-4.png?w=836 836w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-4.png?resize=300%2C190 300w, https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/image-4.png?resize=768%2C487 768w\" sizes=\"auto, (max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<p>Come to think of it, I guess these could be merged to one and the same, right?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just covered the topic in a group on Facebook, and might as well cover it here as well so it&#8217;s public also to non-swedes. The question was how to control the Hue lights from scripts. There is a requirement &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"http:\/\/bergatrollet.se\/blog\/2019\/12\/fibaro-controlling-hue\/\"> <span class=\"screen-reader-text\">Fibaro controlling Hue<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[112],"tags":[110,111],"class_list":["post-841","post","type-post","status-publish","format-standard","hentry","category-home-automation","tag-fibaro","tag-homeautomation"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pkM6p-dz","jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts\/841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/comments?post=841"}],"version-history":[{"count":5,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts\/841\/revisions"}],"predecessor-version":[{"id":852,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts\/841\/revisions\/852"}],"wp:attachment":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/media?parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/categories?post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/tags?post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}