Tag Archives: Z-wave

Visual indicator that the gargage door is open with Openhab2 and Homeseer HS-WD200+ zwave

I am using openhab2 running on a centos server in the house with a USB Zwave stick.

I have 2 Monoprice Z-Wave Garage Door Sensor, NO LOGO (D132) Monoprice Z-Wave Garage Door Sensors.

I have been using these excellent dimmers in the house HomeSeer HS-WD100+ Z-Wave Plus Scene Capable Wall Dimmer but recently changed one in the living room to HomeSeer HS-WD200+ Z-Wave Plus Scene Capable RGB Wall Dimmer which has the ability to set the LED color and if an LED will flash or not.

My goal was to have LED 7 flash red when garage door 1 is open, and LED 6 flash green when garage door 2 is open.

I am running openhab2 2.3.0 nightly snapshot openhab2-2.3.0.20180427191516-1.noarch. This may or may not work in earlier versions. I have the Z-Wave Binding installed, and in configuration -> system i have Item Linking – Simple Mode turned off.

Here are the relevant openhab items and rules.

items/motion.items

Group Motion

Number garage_door_1_battery "Garage 1 Battery" (Motion) {channel="zwave:device:9d6ae427:node9:battery-level"}
Contact garage_door_1_motion "Garage 1 Motion [%s]" (Motion) {channel="zwave:device:9d6ae427:node9:sensor_door"}
Switch garage_door_1_tamper "Garage 1 Tamper [%s]" (Motion) {channel="zwave:device:9d6ae427:node9:alarm_burglar"}

Number garage_door_2_battery "Garage 2 Battery" (Motion) {channel="zwave:device:9d6ae427:node11:batter-level"}
Contact garage_door_2_motion "Garage 2 Motion [%s]" (Motion) {channel="zwave:device:9d6ae427:node11:sensor_door"}
Switch garage_door_2_tamper "Garage 2 Tamper [%s]" (Motion) {channel="zwave:device:9d6ae427:node11:alarm_burglar"}

items/tv.items

Group GF (All)
Group BS (All)
Group US (All)
Group gSunset
Group g1am
Group g12midnight
Group gfLights

Dimmer light_tv_dimmer "TV light" (GF,gfLights) [ "Lighting" ] {channel="zwave:device:9d6ae427:node20:switch_dimmer"}
Switch light_tv_switch "TV light switch" (GF,gfLights,gSunset,g1am) [ "Lighting" ] {channel="zwave:device:9d6ae427:node20:switch_dimmer"}

Number tv_mode "TV Mode" {channel="zwave:device:9d6ae427:node20:config_decimal_param13"}
Number tv_led1 "TV LED 1" {channel="zwave:device:9d6ae427:node20:config_decimal_param21"}
Number tv_led2 "TV LED 2" {channel="zwave:device:9d6ae427:node20:config_decimal_param22"}
Number tv_led3 "TV LED 3" {channel="zwave:device:9d6ae427:node20:config_decimal_param23"}
Number tv_led4 "TV LED 4" {channel="zwave:device:9d6ae427:node20:config_decimal_param24"}
Number tv_led5 "TV LED 5" {channel="zwave:device:9d6ae427:node20:config_decimal_param25"}
Number tv_led6 "TV LED 6" {channel="zwave:device:9d6ae427:node20:config_decimal_param26"}
Number tv_led7 "TV LED 7" {channel="zwave:device:9d6ae427:node20:config_decimal_param27"}
Number tv_blink_feq "TV Blink Frequency" {channel="zwave:device:9d6ae427:node20:config_decimal_param30"}
Number tv_led_blink_status "TV Blink Status" {channel="zwave:device:9d6ae427:node20:config_decimal_param31"}

rules/garage.rules

rule "G1Open"
when
Item garage_door_1_motion changed to OPEN
then
logInfo("TEST","G1 ON")
tv_mode.sendCommand(1)
tv_blink_feq.sendCommand(1)
tv_led7.sendCommand(1)

var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseOr(64)
tv_led_blink_status.sendCommand(mask)
end

rule "G1Closed"
when
Item garage_door_1_motion changed to CLOSED
then
logInfo("TEST", "G1 OFF")
var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseXor(64)
if (mask == 0){
tv_mode.sendCommand(0)
}
tv_led7.sendCommand(0)
tv_led_blink_status.sendCommand(mask)
end

rule "G2Open"
when
Item garage_door_2_motion changed to OPEN
then
logInfo("TEST","G2 ON")
tv_mode.sendCommand(1)
tv_blink_feq.sendCommand(1)
tv_led6.sendCommand(2)

var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseOr(32)
tv_led_blink_status.sendCommand(mask)
end

rule "G2Closed"
when
Item garage_door_2_motion changed to CLOSED
then
logInfo("TEST", "G2 OFF")
var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseXor(32)
if (mask == 0) {
tv_mode.sendCommand(0)
}
tv_led6.sendCommand(0)
tv_led_blink_status.sendCommand(mask)
end

Note: [ “Lighting” ] is for the alexa bridge, gSunset, g1am, g12midnight are used to by other rules to turn on lights at sunset and turn off at 1am or midnight. gfLights is used by the scene controller so if you double tap the Homeseer switch it turns off all the light lights on the ground floor. I have included that below as a bonus.

items/scene.items

Number TVScene "TV Scene" { channel="zwave:device:9d6ae427:node20:scene_number" }
Number SofaScene "Sofa Scene" { channel="zwave:device:9d6ae427:node18:scene_number" }
Number DiningScene "Dining Scene" { channel="zwave:device:9d6ae427:node17:scene_number" }

rules/scene.rules

rule "Mushroom Pushing"
when
Item SofaScene received update
then
if (SofaScene.state == 1.0) {
logInfo("Test", "Mushroom 1x pushed")
}
if (SofaScene.state == 1.1) {
logInfo("Test", "Mushroom leave alone")
}
if (SofaScene.state == 1.2) {
logInfo("Test", "Mushroom kept in")
}
if (SofaScene.state == 1.3) {
logInfo("Test", "Mushroom 2x pushed")
gfLights.members.forEach(Switch|
sendCommand(Switch, OFF)
)

}
if (SofaScene.state == 1.4) {
logInfo("Test", "Mushroom 3x pushed")
}
if (SofaScene.state == 1.5) {
logInfo("Test", "Mushroom 4x pushed")
}
if (SofaScene.state == 1.6) {
logInfo("Test", "Mushroom 5x pushed")
}
end
rule "TVScene Pushing"
when
Item TVScene received update
then
if (TVScene.state == 1.0) {
logInfo("Test", "Mushroom 1x pushed")
}
if (TVScene.state == 1.1) {
logInfo("Test", "Mushroom leave alone")
}
if (TVScene.state == 1.2) {
logInfo("Test", "Mushroom kept in")
}
if (TVScene.state == 1.3) {
logInfo("Test", "Mushroom 2x pushed")
gfLights.members.forEach(Switch|
sendCommand(Switch, OFF)
)

}
if (TVScene.state == 1.4) {
logInfo("Test", "Mushroom 3x pushed")
}
if (TVScene.state == 1.5) {
logInfo("Test", "Mushroom 4x pushed")
}
if (TVScene.state == 1.6) {
logInfo("Test", "Mushroom 5x pushed")
}
end
rule "DiningScene Pushing"
when
Item DiningScene received update
then
if (DiningScene.state == 1.0) {
logInfo("Test", "Mushroom 1x pushed")
}
if (DiningScene.state == 1.1) {
logInfo("Test", "Mushroom leave alone")
}
if (DiningScene.state == 1.2) {
logInfo("Test", "Mushroom kept in")
}
if (DiningScene.state == 1.3) {
logInfo("Test", "Mushroom 2x pushed")
gfLights.members.forEach(Switch|
sendCommand(Switch, OFF)
)

}
if (DiningScene.state == 1.4) {
logInfo("Test", "Mushroom 3x pushed")
}
if (DiningScene.state == 1.5) {
logInfo("Test", "Mushroom 4x pushed")
}
if (DiningScene.state == 1.6) {
logInfo("Test", "Mushroom 5x pushed")
}
end