Add the phone ringing flash light

master
slopjong 2019-04-17 22:19:01 +02:00
parent 25d85c1a51
commit 17b392487e
3 changed files with 29 additions and 7 deletions

View File

@ -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" <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" }
Switch engineering_ceiling_lamps "Ceiling Lamps" <lightbulb> (engineering) { channel="mqtt:topic:engineering_ceiling_lamps:power" }
Switch engineering_status_lamp "Status Lamp" <lightbulb> (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" <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" }
Switch engineering_ceiling_lamps "Ceiling Lamps" <lightbulb> (engineering) { channel="mqtt:topic:engineering_ceiling_lamps:power" }
Switch engineering_status_lamp "Status Lamp" <lightbulb> (engineering) { channel="mqtt:topic:engineering_status_lamp:power" }
Switch engineering_ceiling_phone_flash "Ceiling Phone Flash" <lightbulb> (engineering) { channel="mqtt:topic:engineering_phone_flash:pulse" }
// ----------------------------------------------------------------------------

View File

@ -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

View File

@ -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