[SOLVED] Gcal Event Scheduler conditional comands

Hello

I just migrated to openhab2 recently. So far so good.
I used to schedule events with conditions from google calendar in openhab 1.x.

For example having the following in the event description would just work fine to control my irrigation.

start {
>  if (Irrigation_MainSwitch.state == ON)  sendCommand(Irrigation_Pump, ON)
>  if (Irrigation_MainSwitch.state == ON)  sendCommand(Irrigation_Garden, ON)
}
end {
  send Irrigation_Pump OFF
  send Irrigation_Garden OFF
}

But using the same old event definitions in openhab2 causes openhab to complain about the script initiating ‘>’:

2017-04-18 11:15:59.558 [DEBUG] [io.gcal.internal.GCalEventDownloader] - found 1 calendar events to process
2017-04-18 11:15:59.587 [DEBUG] [io.gcal.internal.GCalEventDownloader] - created new startJob ‘Front Yard Small’ with details 'SchedulerJob [jobKey=5k1pifcllneqpqgp07dd71g6io@google.com_start, jobGroup=gcal, 1 triggers=[Tue Apr 18 11:16:00 SAST 2017], content=start {

if (Irrigation_MainSwitch.state == ON) sendCommand(Irrigation_Pump, ON)
if (Irrigation_MainSwitch.state == ON) sendCommand(Irrigation_FYSmall , ON)
}
end {
send Irrigation_Pump OFF
send Irrigation_FYSmall OFF
}’
2017-04-18 11:15:59.590 [DEBUG] [io.gcal.internal.GCalEventDownloader] - created new endJob ‘Front Yard Small’ with details ‘SchedulerJob [jobKey=5k1pifcllneqpqgp07dd71g6io@google.com_end, jobGroup=gcal, 1 triggers=[Tue Apr 18 11:20:00 SAST 2017], content=start {
if (Irrigation_MainSwitch.state == ON) sendCommand(Irrigation_Pump, ON)
if (Irrigation_MainSwitch.state == ON) sendCommand(Irrigation_FYSmall , ON)
}
end {
send Irrigation_Pump OFF
send Irrigation_FYSmall OFF
}’
2017-04-18 11:16:00.002 [TRACE] [gcal.internal.util.ExecuteCommandJob] - going to parse command ‘> if (Irrigation_MainSwitch.state == ON) sendCommand(Irrigation_Pump, ON)’
2017-04-18 11:16:00.004 [WARN ] [gcal.internal.util.ExecuteCommandJob] - Command > not supported
2017-04-18 11:16:00.009 [TRACE] [gcal.internal.util.ExecuteCommandJob] - going to parse command ‘> if (Irrigation_MainSwitch.state == ON) sendCommand(Irrigation_FYSmall , ON)’
2017-04-18 11:16:00.010 [WARN ] [gcal.internal.util.ExecuteCommandJob] - Command > not supported
2017-04-18 11:16:59.592 [DEBUG] [openhab.io.gcal.auth.GCalGoogleOAuth] - Got calendar OpenHab CalendarID:

i removed the ‘>’ but without success.

Does anybody know what is happening here? is the script mode not supported anymore?

Any other ideas of how to implement conditional commands from gcal scheduler? Or must I rather look into creating rules to achieve my requirements?

thanks in advance for your input!

Script mode is not supported in OH2. The mechanism in OH1 that was used to inject the script doesn’t exist in OH2.

Thanks for this Mark.

What a pity that scrip injecting doesn’t exist anymore. I guess for
security reasons?

I guess I have to play with the rule engine now.

regards

H.

IIRC, there was a way to inject a script into the console interpreter. That doesn’t exist in OH2 (was replaced with the Karaf console), so gcal must do its work through the ESH API (and there’s no way to execute script commands from the ESH API).