diff --git a/items/level2.items b/items/level2.items index 4d24f36..a3c61ca 100644 --- a/items/level2.items +++ b/items/level2.items @@ -10,13 +10,13 @@ Group entrance "Entrance" (main_floor) //------------------------------------------------------------------------------- -Switch entrance_door_status "Door Status" { channel="mqtt:topic:entrance_door_status:status" } - -Switch entrance_ceiling_lamps "Ceiling Lamps" (entrance) { channel="mqtt:topic:entrance_ceiling_lamps:power" } -Switch chill_zone_lamps "Lamps" (chill_zone) { channel="mqtt:topic:chill_zone_lamps:power" } -Switch engineering_table_lamps "Table Lamps" (engineering) { channel="mqtt:topic:engineering_table_lamps:power" } -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" } +Switch entrance_door_status "Door Status" { channel="mqtt:topic:entrance_door_status:status" } +Switch entrance_ceiling_lamps "Ceiling Lamps" (entrance) { channel="mqtt:topic:entrance_ceiling_lamps:power" } +Switch chill_zone_lamps "Lamps" (chill_zone) { channel="mqtt:topic:chill_zone_lamps:power" } +Switch engineering_table_lamps "Table Lamps" (engineering) { channel="mqtt:topic:engineering_table_lamps:power" } +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" } +Switch engineering_ceiling_phone_flash "Ceiling Phone Flash" (engineering) { channel="mqtt:topic:engineering_phone_flash:pulse" } // ---------------------------------------------------------------------------- diff --git a/rules/level2.rules b/rules/level2.rules index f158b12..7305634 100644 --- a/rules/level2.rules +++ b/rules/level2.rules @@ -33,6 +33,21 @@ end // ---------------------------------------------------------------------------- +rule "Phone Ringing" +when + Time cron "*/2 * * ? * *" +then + // we could also fetch the XML but fetching the HTML seems to be faster + // http://10.2.113.137/admin/spacfg.xml + val phoneResponse = sendHttpGetRequest("http://10.2.113.137") + val isRinging = "Ringing" == (transform("REGEX", ".*(Ringing).*", phoneResponse)) + if (isRinging) { + engineering_ceiling_phone_flash.sendCommand("ON") + } +end + +// ---------------------------------------------------------------------------- + rule "Beamer Power" when Item chill_zone_beamer received command diff --git a/things/level2.things b/things/level2.things index 17d24c5..21b0f31 100644 --- a/things/level2.things +++ b/things/level2.things @@ -69,6 +69,13 @@ Bridge mqtt:broker:mosquitto "Mosquitto" [ ] } + Thing topic engineering_phone_flash "Engineering Phone Flash" @ "Engineering" { + Channels: + Type switch : pulse "Flash" [ + commandTopic="cmnd/engineering/ceiling/phone_flash/Power" + ] + } + } // See services/chromecast.cfg for the callback URL