diff --git a/items/level2.items b/items/level2.items index 11630ed..0c0ab1f 100644 --- a/items/level2.items +++ b/items/level2.items @@ -16,6 +16,7 @@ Switch engineering_table_lamps "Table Lamps" (engineering) Switch engineering_ceiling_lamps "Ceiling Lamps" (engineering) { channel="mqtt:topic:engineering_ceiling_lamps:power" } Switch engineering_status_lamp "Status Lamp" (engineering) { channel="mqtt:topic:engineering_status_lamp:power" } +// ---------------------------------------------------------------------------- // If ChromeCast doesn't work you have to link this item with the Chromecast channel manually String chill_zone_chromecast_appid @@ -27,6 +28,22 @@ String chill_zone_chromecast_status "Chromecast Status [%s]" { channel="chromecast:chromecast:b000d809ccb35a409a3dd3d14e0fbf08:statustext" } +// ---------------------------------------------------------------------------- + Switch chill_zone_beamer "Beamer" (chill_zone) + +// ---------------------------------------------------------------------------- + +Switch chill_zone_screen_button_up + "Screen up" + { channel="mqtt:topic:chill_zone_screen:up", autoupdate="false" } + +Switch chill_zone_screen_button_stop + "Screen stop" + { channel="mqtt:topic:chill_zone_screen:stop", autoupdate="false" } + +Switch chill_zone_screen_button_down + "Screen down" + { channel="mqtt:topic:chill_zone_screen:down", autoupdate="false" } diff --git a/rules/level2.rules b/rules/level2.rules index 73a68cb..18bc631 100644 --- a/rules/level2.rules +++ b/rules/level2.rules @@ -17,17 +17,51 @@ then 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 \ No newline at end of file diff --git a/things/level2.things b/things/level2.things index 62b513e..555c8e2 100644 --- a/things/level2.things +++ b/things/level2.things @@ -15,6 +15,23 @@ Bridge mqtt:broker:mosquitto "Mosquitto" [ ] } + // ---------------------------------------------------------------------------- + + Thing topic chill_zone_screen "Screen" @ "Chill Zone" { + Channels: + Type switch : up "Up" [ + commandTopic="cmnd/chill_zone/screen/Power1" + ] + + Type switch : stop "Stop" [ + commandTopic="cmnd/chill_zone/screen/Power2" + ] + + Type switch : down "Down" [ + commandTopic="cmnd/chill_zone/screen/Power3" + ] + } + Thing topic chill_zone_lamps "Lamps" @ "Chill zone" { Channels: Type switch : power "Power" [ @@ -22,6 +39,8 @@ Bridge mqtt:broker:mosquitto "Mosquitto" [ ] } + // ---------------------------------------------------------------------------- + Thing topic engineering_table_lamps "Engineering Table Lamps" @ "Engineering" { Channels: Type switch : power "Power" [