Sunset rule - switch name cannot be resolved to an item or type

Hi,

When my sunset rule runs, I get this error:
21:14:00.002 [DEBUG] [.o.m.r.i.engine.ExecuteRuleJob:53 ] - Executing scheduled rule 'React to sunset’
21:14:00.024 [INFO ] [rg.openhab.model.script.Sunset:53 ] - Timer tOutdoorLights_sunset created
21:14:00.108 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob:57 ] - Error during the execution of rule React to sunset
java.lang.RuntimeException: The name ‘Light_Outdoor_Front’ cannot be resolved to an item or type.

I am using the example sunset rule from here:

import org.openhab.core.types.*
import org.joda.time.*
import org.openhab.model.script.actions.*

var Timer tOutdoorLights_sunset

rule “React to sunset"
when
Time cron “0 26 21 * * ?” // Every day 16:00 hours, evaluate sunset
then
/*
var year = now.getYear
var month = now.getMonthOfYear
var day = now.getDayOfMonth
var datum = year+”-"+month+"-"+day+" “+ss.state
logInfo(“Sunset”,“datum = " + datum)
var DateTime sunset = parse(year+”-”+month+"-"+day+“T”+ss.state)
*/
var DateTime sunset = now()

/*
 * Outdoor Lights
 */
 // Cancel timer to avoid reschedule
if(tOutdoorLights_sunset!=null) {
	logInfo("Sunset","Timer tOutdoorLights_sunset cancelled") 
	tOutdoorLights_sunset.cancel()
}

logInfo("Sunset","Timer tOutdoorLights_sunset created") 

tOutdoorLights_sunset = createTimer(sunset.minusMillis(2000)) [|
	logInfo("Sunset","Timer tOutdoorLights_sunset executed") 
	gSunset?.members.forEach(Switch | sendCommand(Switch, ON))
]

end

If I just have my rule do:
sendCommand(Light_Outdoor_Front,ON) I get the error as well.

I’ve defined my switch in the demo version of the items file as this:
Switch Light_Outdoor_Front “Front Lights” (Outdoor, Lights, gSunset, gSunrise) zwave=“2:command=SWITCH_BINARY”}

Can someone help me understand what’s going on?

Looks like an invalid item definition - you need {} around the binding string - e.g. { zwave="2:command=SWITCH_BINARY"}.

Hi Ben, I actually just pasted that line incorrectly. Here is the exact line from my items file:
Switch Light_Outdoor_Front “Front Lights” (Outdoor, Lights, gSunset, gSunrise) {zwave=“2:command=SWITCH_BINARY”}

Any other suggestions?

Not sure if it makes a difference or not, but all of my zwave devices look like this:

{zwave=“3:0:command=sensor_binary,respond_to_basic=true”}

They all have three segment separated by a : between the quotes, and the middle one is a 0.