Hi, I’ve been struggling to get google to answer with an appropriate response to “is the shed door open?” So, as I have little skills in coding I thought I would do it this way with recorded sound files.
I have created a virtual switch called “HouseCheck” so when activated the below rule runs.
The delay is to allow time for google to say “OK turning on House Check” before the audiofiles play.
There are 3 item states to check but I only get a response from one. Im not sure if they are all trying to play at once or if the rule is just terminating after the first response.
Any help appreciated.
var Timer atimer = null rule "House Door Status" when Item HouseCheck changed to ON then val state1 = Front_Door_Status.state val state2 = Garage_Door_Status.state val state3 = SB_02_P1.state var volup = 30 var voldown = 20 //var delay1 = 3 Kitchen_Volume.sendCommand(volup) atimer?.cancel atimer = createTimer(now.plusSeconds(3)) [| if (state1 == OPEN) playSound("FrontisOpen.mp3") if (state1 == CLOSED) playSound("FrontisClosed.mp3") if (state2 == OPEN) playSound("GarageisOpen.mp3") if (state2 == CLOSED) playSound("GarageisClosed.mp3") if (state3 == OPEN) playSound("ShedisOpen.mp3") if (state3 == CLOSED) playSound("ShedisClosed.mp3") ] Kitchen_Volume.sendCommand(voldown) HouseCheck.sendCommand(OFF) end