[SOLVED] Error when rule executes using receivedevent

I am running version 2.5 on a pi. I had a fully stable install earlier today and started adding a few rules.

Here is the rule I added pertaining to my Phillips Hue Dimmer using the deconz binding:

rule "FFAgent Button pressed"
Channel "deconz:switch:homeserver:KitchenRemote:buttonevent" triggered 1003 or 
Channel "deconz:switch:homeserver:KitchenRemote:buttonevent" triggered 1001
logInfo("DimmerTest", "receivedEvent=" + receivedEvent)



I had the error below earlier today, which prompted me to clear the cache and restart. After doing so my rule was rock solid until I did another restart. I always do a final restart after I make modifications just to make sure things persist. In this particular case they did not…

Rule 'FFAgent Button pressed': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null

Does anyone know what this error means and where I can start debugging. Here is the entry from my events file you can see that the events are being captured when I press the remote.

2020-02-21 16:07:33.948 [vent.ChannelTriggeredEvent] - deconz:switch:homeserver:KitchenRemote:buttonevent triggered 1000
2020-02-21 16:07:33.975 [vent.ItemStateChangedEvent] - KitchenButton changed from 1003 to 1000
2020-02-21 16:07:34.738 [vent.ChannelTriggeredEvent] - deconz:switch:homeserver:KitchenRemote:buttonevent triggered 1001
2020-02-21 16:07:34.753 [vent.ItemStateChangedEvent] - KitchenButton changed from 1000 to 1001
2020-02-21 16:07:34.878 [vent.ChannelTriggeredEvent] - deconz:switch:homeserver:KitchenRemote:buttonevent triggered 1003
2020-02-21 16:07:34.885 [vent.ItemStateChangedEvent] - KitchenButton changed from 1001 to 1003

Try this:

logInfo("DimmerTest", "receivedEvent=" + receivedEvent.toString)

Nah… use parameterized logging…

logInfo(“DimmerTest”, “receivedEvent={}”, receivedEvent)

@5iver @vzorglub thanks for prompt reply it is the log statement causing the error. Weird it worked earlier, but bad code will sometimes do that.

Both suggestions that you provided do lead to an error. It states that toString is not a method.

I am searching community now.

Error when I put toString in or getEvent. To string says tostring in the error, but same error.

2020-02-21 16:49:02.653 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'FFAgent Button pressed 2': 'getEvent' is not a member of 'org.eclipse.smarthome.core.thing.events.ChannelTriggeredEvent';

The error on this command was the quotes used. I am not sure I know which ones to use.

It looks like some Smart Quotes somehow got in there…

logInfo("DimmerTest", "receivedEvent={}", receivedEvent)

Just be aware of this issue (does not affect the new rule engine)…

1 Like

Now all of a sudden this morning it is working again.

I am going to take the received event out of my log for now and just leave it out for the time being. I don’t really need it, just like the info for debug when a problem happens.

Your line worked with the smart quotes replaced, but my original one is working again also. So weird!

1 Like

Did further testing today! Looks like the {} solution with the correct quotes works. It persist across reboots and such.

Thanks guys!

1 Like

Parameterized logging… it looks better, is easier to use, and has performance benefits. There is not much information in the OH docs, but it is used in the examples (guess who put it there :wink:). There is plenty of info in the SLF4J docs…


1 Like