[SOLVED] MQTT Action : cannot invoke method

  • Platform information:
    • Hardware: Raspberry Pi 3B
    • OS: Archlinux ARM
    • Java Runtime Environment: Oracle JDK 8
    • openHAB version: 2.3.0
  • Issue of the topic:
    I’m trying to publish a simple temperature value for testing purpose on a distant MQTT broker.
    Openhab logs indicates that the connection to the broker is successful.
    But when the rule is triggered, I get the following error:

2018-08-14 22:28:20.391 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘test mqtt action’: An error occurred during the script execution: Could not invoke method: org.openhab.action.mqtt.internal.Mqtt.publish(java.lang.String,java.lang.String,java.lang.String) on instance: null

  • Rules code related to the issue:

rule “test mqtt action”
Item RFXCOM_LivingRoom_Sensor_TH_Temperature received update
publish(“minimiBroker”, “node-red/temp”, RFXCOM_LivingRoom_Sensor_TH_Temperature.state)

  • Services configuration related to the issue:


If your subscribed to that topic and using persistence on mqtt item, then openhab log should show the updates, no rule needed. Create a sitemap with your item, if you want to view the temp. without looking in the logs.

Have you installed the MQTT Action?

You might need to call toString on the state. Sometimes the Rules is not very good at realizing when it needs to convert something to a String, particularly with Number states.

Thanks for answering.

I’m actually experimenting things with mqtt / mysensors / node-red, I needed to see the temp in NodeRED to check if my configuration is working.

@rlkoshak, the toString did the trick ! Thanks !