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
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)
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â.
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.