[SOLVED] OH 2.2 Cannot convert percent type error

Hi all,
I am working through some small issues that seemed to have cropped up after the upgrade from OH 2.2 unstable to OH 2.2 stable; OR I simply missed them previously and they have been there for ages :slight_smile:

The error message in the log is:

2017-12-21 20:21:09.293 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Sunset offset trigger rule': An error occurred during the script execution: Cannot convert number literal to typeorg.eclipse.smarthome.core.library.types.PercentType

The rules looks like this

rule "Sunset offset trigger rule"
when
    Channel 'astro:sun:home:set#event' triggered START 
then
    logInfo("sunset-sunlight.rules", "Start of sunset (offset). Is it now dark outside?")
	sendMail("idkpmiller@sip2serve.com", "Start of sunset notification.", "Is it now getting dark outside?")
	EntLight3_Brightness.send(40)
	EntLight2_Brightness.send(40)
	EntLight1_Brightness.send(40)
	postUpdate(NightState, ON)
	//LRTree_Switch.send(ON)
end

The EntLightn devices are Wemo LED bulbs and the number does indeed refer to setting the brightness of the bulbs to 40%.

Thanks

Paul

There is no such Method as .send. Please use .sendCommand instead. There is also a Method .postUpdate, so I would suggest to use this one either:

...
        EntLight1_Brightness.sendCommand(40)
        NightState.postUpdate(ON)
...

Sorry for the late response.
You are correct and this solved the issue, which at the time I ran off and changed and then neglected to thank you and advise searching readers that was indeed the solution.

Many Thanks

Paul