Im running Openhab 2.4 on a RaspberryPi 3B+ with Openhabian. Im using NodeRed as an alternative Rule Engine and wanted to play around with connecting the two with mqtt instead of the Openhab nodes.
installed Mosquitto through Openhabian and its online and connected to NodeRed and Openhab with the MQTT2 Binding installed. I set everything up according to the section relating to connecting two Openhab instances here https://www.openhab.org/addons/bindings/mqtt.generic/ .
The problem is that when I change an Item in the Group it doesnt publish to mqtt but I get this error:
2019-03-17 12:37:19.383 [ome.event.ItemCommandEvent] - Item 'Schreibtischlampe' received command ON
2019-03-17 12:37:19.400 [nt.ItemStatePredictedEvent] - Schreibtischlampe predicted to become ON
2019-03-17 12:37:19.407 [vent.ItemStateChangedEvent] - Schreibtischlampe changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2019-03-17 12:37:19.447 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Publish all': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.binding.mqtt.action.MQTTActions.publishMQTT(org.eclipse.smarthome.core.thing.binding.ThingActions,java.lang.String,java.lang.String) on instance: null
My rule is this:
rule "Publish all"
when
Member of AllItems changed
then
val actions = getActions("mqtt","mqtt:broker:MQTTBroker")
actions.publishMQTT("allItems/"+triggeringItem.name,triggeringItem.state)
end
and Thing file is this
Bridge mqtt:broker:MQTTBroker [ host="localhost", secure=false, username="xxxxxxxxx", password="xxxxxxxxx" ]
{
Channels:
Type publishTrigger : myTriggerChannel "Receive everything" [ stateTopic="allItems/#", separator="#" ]
}
Schreibtischlampe is the only member off the Group AlIItems right now.
What did I do wrong. This is the first Time I ever used MQTT so I dont really know anything. Did I forget to install something?