How to send command to mqtt broker

IMHO you need to use a rule for that like:

rule "MyMQTTRule
when
    Item Smartphone changed
then
    val mqttActions = getActions("mqtt", "mqtt:broker:MQTTBrokerTest")
     mqttActions.publishMQTT("MyTopic", Smartphone.state)
    
end

Please insert your desired Topic instead of “MyTopic”. Could not test ATM, so I’m not sure if the part “Smartphone.state” is correct.

1 Like