nibi79 / worxlandroid

openHAB Binding for Worx Landroid
60 stars 20 forks source link

Mowing activation / deactivation on scheduling days #27

Closed nibi79 closed 4 years ago

nibi79 commented 4 years ago

New channels to activate/deactivate mowing on scheduling days.

Eddy0815 commented 4 years ago

That would be nice, found a solution for me with code in a rule. I made dummy items to safe the scheduling in openhab persistent. rule "LandroidDisabledSchedulerManagerAndSendHome" when Item LandroidDisabledScheduler changed then if (LandroidDisabledScheduler.state == ON) { GRP_LandroidSchedulerDummies.members.forEach[item | var OriLandroidItemName = "LandroidSchedule" + item.name.split("LandroidScheduleDummy").get(1) item.postUpdate(ScriptServiceUtil.getItemRegistry.getItem(OriLandroidItemName).state) ] Thread::sleep(500) if (LandroidStatusDescription.state.toString != "Home") { LandroidSchalterVirt.sendCommand(OFF) } var weekdays = newArrayList("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") var dow = now.getDayOfWeek() logInfo("Mathilda DOW: ", weekdays.get(dow)) var OriLandroidItemName = "LandroidSchedule" + weekdays.get(dow) + "Duration" ScriptServiceUtil.getItemRegistry.getItem(OriLandroidItemName).sendCommand("0") } else if (LandroidDisabledScheduler.state == OFF) { GRP_LandroidSchedulerDummies.members.forEach[item | var OriLandroidItemName = "LandroidSchedule" + item.name.split("LandroidScheduleDummy").get(1) if (ScriptServiceUtil.getItemRegistry.getItem(OriLandroidItemName).state.toString != item.state.toString) { ScriptServiceUtil.getItemRegistry.getItem(OriLandroidItemName).sendCommand(item.state.toString) logInfo("Mathilda", "Ori Value: " + ScriptServiceUtil.getItemRegistry.getItem(OriLandroidItemName).state.toString) logInfo("Mathilda", "Dummy Value: " + item.state.toString) } Thread::sleep(500) ] } end