import org.openhab.core.types.* import org.openhab.core.library.types.* import org.openhab.core.persistence.* import org.openhab.model.script.actions.* import org.joda.time.* //import java.util.Date //import java.text.SimpleDateFormat var boolean Log_MorningJobCoffee = true var boolean Log_CoffeeSwitch = true //////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Variables to set (easier than changing numbers within the code) */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //var Number counter = 1 var Timer TimeoutTimer = null //////////////////////////////////////////////////////////////////////////////////////////////////////////////// var Number HarmonyWZ_Vol_Min = 0 var Number HarmonyWZ_Vol_Max = 65 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// var Number StartupSat = 40000 var Number StartupCable = 40000 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// var Number DefaultVolume = 25 var Number TVVolume = 55 var Number MorningVolume = 45 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Switches */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////// rule "Coffee machine cronjob ON" when Time cron "0 15 06 ? * MON-FRI *" then if Switch_GF_CoffeeMachine.state == OFF { if (Log_MorningJobCoffee) {logInfo("Coffee machine cronjob ON", "Switching on Coffeemachine 1")} sendCommand(Switch_GF_CoffeeMachine, ON) } if (HarmonyWZ_Activity!="Cable Radio") { if (Log_MorningJobCoffee) {logInfo("Coffee machine cronjob ON", "Switching on Cable Radio 1")} sendCommand(HarmonyWZ_Activity, "Cable Radio") Thread::sleep(StartupCable)} else {} if (Log_MorningJobCoffee) {logInfo("Coffee machine cronjob ON", "Switching to TV")} sendCommand(CableWZ_TV, ON) Thread::sleep(5000) if (Log_MorningJobCoffee) {logInfo("Coffee machine cronjob ON", "Switching to Cahnnel 1")} harmonyPressButton("HarmonyWZ","UPC STB", "1") Thread::sleep(5000) if (Log_MorningJobCoffee) {logInfo("Coffee machine cronjob ON", "Switching to radio")} sendCommand(CableWZ_Radio, ON) Thread::sleep(5000) if (Log_MorningJobCoffee) {logInfo("Coffee machine cronjob ON", "Switching to Fun Radio")} sendCommand(CableWZ_FunRadio, ON) if (Log_MorningJobCoffee) {logInfo("Coffee machine cronjob ON", "Setting volume")} var Number VolumeControl VolumeControl = DefaultVolume while(VolumeControlHarmonyWZ_Vol_Max) {NewTimer = HarmonyWZ_Vol_Max} if(receivedCommand==INCREASE) harmonyPressButton(HarmonyWZ,"Onkyo AV Receiver", VolumeUp) if(receivedCommand==DECREASE) harmonyPressButton(HarmonyWZ,"Onkyo AV Receiver", VolumeDown) //harmonyPressButton(,, ) } end rule "OnkyoWZ_VolSetCWZMorning" when Item OnkyoWZ_VolSetCWZMorning received command ON then sendCommand(OnkyoWZ_Vol, "38") end rule "CableWZ_FunRadio" when Item CableWZ_FunRadio received command ON then harmonyPressButton("HarmonyWZ","UPC STB", "1") harmonyPressButton("HarmonyWZ","UPC STB", "5") harmonyPressButton("HarmonyWZ","UPC STB", "0") end rule "CableWZ_RadioNRJ" when Item CableWZ_RadioNRJ received command ON then harmonyPressButton("HarmonyWZ","UPC STB", "1") harmonyPressButton("HarmonyWZ","UPC STB", "4") harmonyPressButton("HarmonyWZ","UPC STB", "1") end rule "CableWZ_RSR1ERE" when Item CableWZ_RSR1ERE received command ON then harmonyPressButton("HarmonyWZ","UPC STB", "1") harmonyPressButton("HarmonyWZ","UPC STB", "0") harmonyPressButton("HarmonyWZ","UPC STB", "1") end rule "CableWZ_Couleur3" when Item CableWZ_Couleur3 received command ON then harmonyPressButton("HarmonyWZ","UPC STB", "1") harmonyPressButton("HarmonyWZ","UPC STB", "0") harmonyPressButton("HarmonyWZ","UPC STB", "3") end