After update, Instance is not an MQTTActions class

Hello all,

I have a ESP32 connected to a SSR40A relay.
Now i had everything working like a charm.
Yesterday i updated my PI4, and now when i restart the PI i receive the following error.

2020-07-17 17:37:28.074 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'relay Off': Instance is not an MQTTActions class.
Then the relay wont run on or off, but the topic is still receiving the command either 0 or 1.
If i then after some time reset the ESP it turns on and off again, but every time i turn it on or off i receive the error again.
I did find this post Instance is not an MQTTActions class
But that wont help as i allready had the “getActions() from top of file and put as first line in rule”
So with the getAction on top on the file ore in the first line of the rule, i receive the error.

Wat can i do about this ?

val mqttActions = getActions("mqtt", "mqtt:topic:broker:miflora")


rule "relay On"

when
  Item relay changed to ON
then

  mqttActions.publishMQTT("relay","1")
end

rule "relay Off"
when
  Item relay changed to OFF
then

  mqttActions.publishMQTT("relay","0")
end

Greetings

I just ran into a similar problem running a mqtt action on a pi. As stated by Ross in the other thread you linked, I believe your problem is the order which stuff is started up. What I did was simply touch the rule file. In other words, I edited the rules file by adding a comment and saving. The publishMqtt action immediately started working again. This isn’t a solution but perhaps something to delays loading the rule for a few minutes after a restart might work.
Also, your val declaration might need to be inside your rule (mine is)

here is another thread with similar (although I did NOT do what is suggested in this thread, I simply touched the file)

Thanks for the reply.

That would mean i have to added the rules file every time i restart OH.
Witch i do allot, so that would really suck.

Greetings

If you are using openHABian there is an option to cause this to happen for your automatically in openhabian-config somewhere.

When using the new rules engine, which will just be the rules engine in OH 3 this problem will no longer be a problem.

I’ve seen that said, and am curious. Why won’t it be a problem? I can’t see how the NRE is magically exempt from this parallel load timing issue. I thought the core issue was that it is not possible to say ‘everything’s loaded now’.

Thanks for the reply.
Will look in to it.

Thanks for the reply.
But have no idea what to do. Only see 3 post, but nothing about what i have to do.

Greetings

Somehow it is magically exempt. there is something about it that makes it always come up last. And if it didn’t, there was a little script in the helper library to block the loading until everything is ready. So the work around came with the helper libraries. but that script was removed quite some time ago. I’m pushing two years on the ngre, I’ve never one seen that problem where roles start before everything is loaded. Prior to that I’d see it about every other restart.

For anything more technical you’d have to look in the code.

1 Like