[SOLVED] HUE + HM-PB-2-FM + WebSwitch

Hi Community,

i’m new to Openhab, comping from FHEM. I’m trying to get my Hue Bulbs running together with a WebGui Switch and my Homematic HM-PB-2-FM. SO that every Device Knows the actual State and I’m able to Switch the light with the HM on and with the guy off.

What is the best way to get this running?
I already got the HM running together with the HM switch:

Switch  ki_lights_ceiling_switch_1 	"Kitchen_Button_1" { channel="homematic:HG-HM-PB-2-FM:36f880d0:NEQ0890367:1#PRESS_SHORT" }
Switch  ki_lights_ceiling_switch_2	"Kitchen_Button_2" { channel="homematic:HG-HM-PB-2-FM:36f880d0:NEQ0890367:2#PRESS_SHORT" }
Switch  ki_lights_ceiling_switch_1l  "Kitchen Button 1 Long" { channel="homematic:HG-HM-PB-2-FM:36f880d0:NEQ0890367:1#PRESS_LONG" }
Switch  ki_lights_ceiling_switch_2l  "Kitchen Button 2 Long" { channel="homematic:HG-HM-PB-2-FM:36f880d0:NEQ0890367:2#PRESS_LONG" }
Dimmer KI_Light_Spot1_B	"Spot 1"	(g_KI_Lights_B) {channel="hue:0220:001788492029:13:brightness"}
Dimmer KI_Light_Spot2_B	"Spot 2"	(g_KI_Lights_B) {channel="hue:0220:001788492029:14:brightness"}
Dimmer KI_Light_Spot3_B	"Spot 3"	(g_KI_Lights_B) {channel="hue:0220:001788492029:15:brightness"}
Dimmer KI_Light_Spot4_B	"Spot 4"	(g_KI_Lights_B) {channel="hue:0220:001788492029:16:brightness"}
Dimmer KI_Light_Spot5_B	"Spot 5"    (g_KI_Lights_B) {channel="hue:0220:001788492029:17:brightness"}
Dimmer KI_Light_Spot6_B	"Spot 6"	(g_KI_Lights_B) {channel="hue:0220:001788492029:18:brightness"}
Dimmer KI_Light_Spot7_B	"Spot 7"	(g_KI_Lights_B) {channel="hue:0220:001788492029:19:brightness"}
Dimmer KI_Light_Spot8_B	"Spot 8"	(g_KI_Lights_B) {channel="hue:0220:001788492029:20:brightness"}
Dimmer KI_Light_Spot9_B	"Spot 9"	(g_KI_Lights_B) {channel="hue:0220:001788492029:22:brightness"}
Dimmer KI_Light_Spot10_B "Spot 10"	(g_KI_Lights_B) {channel="hue:0220:001788492029:23:brightness"}
rule "KI_Lights_Switch_on"
when
   Item ki_lights_ceiling_switch_1 changed from OFF to ON  
then
    sendCommand(g_KI_Lights_B,100)
end

rule "KI_Lights_Switch_off"
when
   Item ki_lights_ceiling_switch_2 changed from OFF to ON 
then
    g_KI_Lights.sendCommand(OFF)
end

Am I on the right way? How could I integrate a Web Switch on the Website / in the app?

thy!

The Rules look reasonable.

To control from the sitemap or HABPanel create an Unbound Item to put on your sitemap and update your Rules to trigger on this unbound Item as well.

Finally, add a MyUnboundSwitch.postUpdate(ON) to the first rule and MyUnboundSwitch.postUpdate(OFF) to the second rule so the unbound Item stays in sync with the state of the lights.

One more thing, it is better to get into the habit of using the Item methods than the actions when calling postUpdate and sendCommand so I would change your sendCommand in the first rule to match how you did it in the second rule.

Thy - works perfekt :slight_smile:

The 2nd part don’t work for me. I want to use dimming as well - so I have some other rules with 50 and 20%.

Or is it also possible to use the percentages with the item methods?