Add a door status and control the lights, beamer and screen

master
slopjong 2019-04-12 20:28:43 +02:00
parent f70e47e415
commit 25d85c1a51
3 changed files with 43 additions and 0 deletions

View File

@ -10,6 +10,8 @@ Group entrance "Entrance" (main_floor)
//-------------------------------------------------------------------------------
Switch entrance_door_status "Door Status" { channel="mqtt:topic:entrance_door_status:status" }
Switch entrance_ceiling_lamps "Ceiling Lamps" <lightbulb> (entrance) { channel="mqtt:topic:entrance_ceiling_lamps:power" }
Switch chill_zone_lamps "Lamps" <lightbulb> (chill_zone) { channel="mqtt:topic:chill_zone_lamps:power" }
Switch engineering_table_lamps "Table Lamps" <lightbulb> (engineering) { channel="mqtt:topic:engineering_table_lamps:power" }

View File

@ -1,4 +1,38 @@
rule "Door Status"
when
Item entrance_door_status changed
then
val state = entrance_door_status.state.toString
// the sensor state is inverted:
// OFF means opened
// ON means opened
if (state == 'OFF') {
logInfo('door', 'opened')
entrance_ceiling_lamps.sendCommand("ON")
chill_zone_lamps.sendCommand("ON")
engineering_table_lamps.sendCommand("ON")
engineering_ceiling_lamps.sendCommand("ON")
engineering_status_lamp.sendCommand("ON")
} else {
logInfo('door', 'closed')
// turn the beamer off
sendHttpGetRequest("http://10.2.113.7/tgi/return.tgi?command=2a3102fd0660")
chill_zone_screen_button_up.sendCommand("ON")
entrance_ceiling_lamps.sendCommand("OFF")
chill_zone_lamps.sendCommand("OFF")
engineering_table_lamps.sendCommand("OFF")
engineering_ceiling_lamps.sendCommand("OFF")
engineering_status_lamp.sendCommand("OFF")
}
logInfo("door", "Space state: {}", state)
end
// ----------------------------------------------------------------------------
rule "Beamer Power"
when
Item chill_zone_beamer received command

View File

@ -8,6 +8,13 @@ Bridge mqtt:broker:mosquitto "Mosquitto" [
clientID="openHAB2"
]{
Thing topic entrance_door_status "Entrance Door Status" @ "Entrance" {
Channels:
Type switch : status "Status" [
stateTopic="stat/entrance/door_status/POWER"
]
}
Thing topic entrance_ceiling_lamps "Entrance Ceiling Lamps" @ "Entrance" {
Channels:
Type switch : power "Power" [