Instance is not an MQTTActions class

hello,

after every time i restart ma RPI, i can’t use my MQTT Commands.

i got this error Messsage

12:17:35.899 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'RF Subwoofer': Instance is not an MQTTActions class.

After i save my *.rule again, everything works fine.

val mqttActions = getActions("mqtt","mqtt:broker:pibroker")


rule "RF Subwoofer"
	when
		Item RF_Subwoofer received update
	then
		if (RF_Subwoofer.state == ON) {
			mqttActions.publishMQTT("home/OpenMQTTGateway/commands/MQTTtoPilight", "{\"message\":\"{\\\"systemcode\\\":1,\\\"programcode\\\":4,\\\"on\\\":1}\",\"protocol\":\"rsl366\"}")
			createTimer(now.plusSeconds(1), [|
				mqttActions.publishMQTT("home/OpenMQTTGateway/commands/MQTTtoPilight", "{\"message\":\"{\\\"systemcode\\\":1,\\\"programcode\\\":4,\\\"on\\\":1}\",\"protocol\":\"rsl366\"}")
			])
			createTimer(now.plusSeconds(1), [|
				mqttActions.publishMQTT("home/OpenMQTTGateway/commands/MQTTtoPilight", "{\"message\":\"{\\\"systemcode\\\":1,\\\"programcode\\\":4,\\\"on\\\":1}\",\"protocol\":\"rsl366\"}")
			])
		}
		else {
			mqttActions.publishMQTT("home/OpenMQTTGateway/commands/MQTTtoPilight", "{\"message\":\"{\\\"systemcode\\\":1,\\\"programcode\\\":4,\\\"off\\\":1}\",\"protocol\":\"rsl366\"}")
			createTimer(now.plusSeconds(1), [|
					mqttActions.publishMQTT("home/OpenMQTTGateway/commands/MQTTtoPilight", "{\"message\":\"{\\\"systemcode\\\":1,\\\"programcode\\\":4,\\\"off\\\":1}\",\"protocol\":\"rsl366\"}")
			])
			createTimer(now.plusSeconds(1), [|
					mqttActions.publishMQTT("home/OpenMQTTGateway/commands/MQTTtoPilight", "{\"message\":\"{\\\"systemcode\\\":1,\\\"programcode\\\":4,\\\"off\\\":1}\",\"protocol\":\"rsl366\"}")
			])
		}
end

You’re suffering a version of the perennial openHAB file load sequence problem.
Here, your rule file loads before the MQTT binding is ready to supply the Actions.

A circumvention would be not to request Actions at top of rule file, but later when the rule runs
i.e. remove getActions() from top of file and put as first line in rule.

1 Like