I want to control the lights when Kodi starts to play. I save the state of the lights when play is invoked and want to use the previous state when pause occurs.
This is the rule
rule "Kodi starts to play "
when
Item KodiMediacenter_Control changed
then
if (KodiMediacenter_Control.state == PLAY) {
logInfo("LightCheck",sw_LivingLight.name+ " equals " + sw_LivingLight.state.toString())
LivingLightState=sw_LivingLight.state
sw_LivingLight.sendCommand(OFF)
else if (KodiMediacenter_Control == PAUSE) {
sw_LivingLight.sendCommand(LivingLightState)
}
end
Unfortunately i get the following error:
2017-08-29 21:46:04.961 [INFO ] [se.smarthome.model.script.LightCheck] - sw_LivingLight equals OFF
2017-08-29 21:46:04.961 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Kodi starts to play ': An error occurred during the script execution: Couldn't invoke 'assignValueTo' for feature JvmVoid: (eProxyURI: default.rules#|::0.2.4.2.0.0.1.0.1::0::/1)
The light state does get printed as shown by the debug log, but I am unable to assign it to a variable. Any idea how to fix this?