101 lines
3.1 KiB
Plaintext
101 lines
3.1 KiB
Plaintext
|
|
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
|
|
then
|
|
val state = chill_zone_beamer.state.toString
|
|
var beamerResponse
|
|
|
|
if (state == 'ON') {
|
|
// turn the beamer on
|
|
beamerResponse = sendHttpGetRequest("http://10.2.113.7/tgi/return.tgi?command=2a3101fe0660")
|
|
} else {
|
|
// turn the beamer off
|
|
beamerResponse = sendHttpGetRequest("http://10.2.113.7/tgi/return.tgi?command=2a3102fd0660")
|
|
}
|
|
val beamerStatus = transform("XPATH", "/return/text()", beamerResponse).replace("\n", '')
|
|
logInfo("beamer", "Beamer state: {}", beamerStatus)
|
|
end
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
rule "Chromecast changed"
|
|
when
|
|
Item chill_zone_chromecast_status changed
|
|
then
|
|
chill_zone_beamer.sendCommand("ON")
|
|
chill_zone_screen_button_down.sendCommand("ON")
|
|
val app = chill_zone_chromecast_status.state.toString
|
|
if (app === null || app == UNDEF || app == 'UNDEF' || app == '' ) {
|
|
// set input to DVI - hackerspace video
|
|
sendHttpGetRequest("http://10.2.113.7/tgi/return.tgi?command=2a3109f6070566")
|
|
logInfo('beamer', 'Switch to input DVI')
|
|
} else {
|
|
// set input to HDMI2 - chromecast
|
|
sendHttpGetRequest("http://10.2.113.7/tgi/return.tgi?command=2a3109f6071576")
|
|
logInfo('beamer', 'Switch to input HDMI2')
|
|
}
|
|
end
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
rule "Screen up"
|
|
when
|
|
Item chill_zone_screen_button_up received command ON
|
|
then
|
|
logInfo('screen', 'Screen up')
|
|
Thread::sleep(2000)
|
|
chill_zone_screen_button_up.sendCommand(OFF)
|
|
end
|
|
|
|
rule "Screen stop"
|
|
when
|
|
Item chill_zone_screen_button_stop received command ON
|
|
then
|
|
logInfo('screen', 'Screen stop')
|
|
Thread::sleep(2000)
|
|
chill_zone_screen_button_stop.sendCommand(OFF)
|
|
end
|
|
|
|
rule "Screen down"
|
|
when
|
|
Item chill_zone_screen_button_down received command ON
|
|
then
|
|
logInfo('screen', 'Screen down')
|
|
Thread::sleep(2000)
|
|
chill_zone_screen_button_down.sendCommand(OFF)
|
|
end |