{"id":1016,"date":"2024-04-27T16:23:21","date_gmt":"2024-04-27T14:23:21","guid":{"rendered":"https:\/\/www.homeserver.lu\/?p=1016"},"modified":"2024-04-27T16:23:21","modified_gmt":"2024-04-27T14:23:21","slug":"command-a-philips-hue-light-from-a-knx-switch-through-openhab","status":"publish","type":"post","link":"https:\/\/www.homeserver.lu\/?p=1016","title":{"rendered":"Command a Philips Hue light from a KNX switch through openHAB"},"content":{"rendered":"\n<p>I am using openHAB as my main home automation server. I want to be able to switch on\/off Philips Hue lights with the <em>Gira KNX TS3 <\/em>sensors installed in my rooms.<\/p>\n\n\n\n<p>Basically, you need to create a group address, map it to the TS switch channel, create a virtual KNX device in openHAB and create two rules to link both objects (one rule for switching ON and one for switching OFF).<\/p>\n\n\n\n<p>In the ETS software, create a group address (e.g. 1\/9\/9) and map it to the TS button&#8217;s channel that should allow switching the Hue light ON and OFF.<\/p>\n\n\n\n<p>In openHAB, <strong>create a KNX device thing<\/strong> called <em>Virtual KNX switch<\/em>. <strong>Add a channel<\/strong> with type <em>Switch Control<\/em> and <strong>configure<\/strong> it to address <em>1\/9\/9<\/em>. Map an item of type <em>Contact<\/em> to this channel (let&#8217;s name it <em>KitchenVirtualSwitch<\/em>).<\/p>\n\n\n\n<p>Assuming that your Hue light is called <em>HueLight<\/em>, create a rule to switch the light ON:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\" data-file=\"Kitchen Hue switch ON\"><code>configuration: {}\ntriggers:\n  - id: &quot;1&quot;\n    configuration:\n      command: ON\n      itemName: KitchenVirtualSwitch\n    type: core.ItemCommandTrigger\nconditions: []\nactions:\n  - inputs: {}\n    id: &quot;2&quot;\n    configuration:\n      type: application\/vnd.openhab.dsl.rule\n      script: &quot;\n\n        \\          HueLight.sendCommand(ON)\n\n        \\          logInfo( \\&quot;openHAB.Rules\\&quot;,\\&quot;KitchenVirtualSwitch TS =&gt; Hue ON\\&quot;\n        )\n\n        \\ &quot;\n    type: script.ScriptAction<\/code><\/pre><\/div>\n\n\n\n<p>The logInfo entry is optional, but very helpful when debugging. Let&#8217;s create a second rule for switching the light OFF:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\" data-file=\"Kitchen Hue switch OFF\"><code>configuration: {}\ntriggers:\n  - id: &quot;1&quot;\n    configuration:\n      command: OFF\n      itemName: KitchenVirtualSwitch\n    type: core.ItemCommandTrigger\nconditions: []\nactions:\n  - inputs: {}\n    id: &quot;2&quot;\n    configuration:\n      type: application\/vnd.openhab.dsl.rule\n      script: &quot;\n\n        \\          HueLight.sendCommand(OFF)\n\n        \\          logInfo( \\&quot;openHAB.Rules\\&quot;,\\&quot;KitchenVirtualSwitch TS =&gt; Hue OFF\\&quot;\n        )\n\n        \\ &quot;\n    type: script.ScriptAction\n<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I am using openHAB as my main home automation server. I want to be able to switch on\/off Philips Hue lights with the Gira KNX TS3 sensors installed in my rooms. Basically, you need to create a group address, map it to the TS switch channel, create a virtual KNX device in openHAB and create [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1016","post","type-post","status-publish","format-standard","hentry","category-openhab"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1016"}],"version-history":[{"count":6,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1016\/revisions"}],"predecessor-version":[{"id":1022,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1016\/revisions\/1022"}],"wp:attachment":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}