[SOLVED] MQTT2 Actions need more details

Hi guys,
I had MQTT Actions set for MQTT1 version i need little more help.
This is my rules file:

rule "rPCControl"
when
	Item PCControl received command
then 
    logInfo("rule rPCControl", "command "+receivedCommand)
	switch (receivedCommand) {
		case "nhk" : 
			publish("broker", "winthing/system/commands/run", "[\"nhk.vbs\",\"\",\"\"]")
  		case "youtube" :
			publish("broker", "winthing/system/commands/run", "[\"youtube.vbs\",\"\",\"\"]")
		case "netflix" : {
			publish("broker", "winthing/system/commands/run", "[\"Netflix.lnk\",\"\",\"\"]")
            // Wait 5 seconds and send WIN+SHIFT+ENTER to go Fullscreen
            Thread::sleep(5000)
            publish("broker", "winthing/keyboard/commands/press_keys", "[\"LWIN\",\"LSHIFT\",\"ENTER\"]")
   
        }
	}
end

In this link


is following example

rule "On system start"
when
  System started
then
  val actions = getActions("mqtt","mqtt:systemBroker:embedded-mqtt-broker")
  actions.publishMQTT("test/system/started","true")    
end

I set up the my mosquitto MQTT broker in PaperUI it shows online and has id
mqtt:broker:81c98b85

Now how do i fill in the “val actions”?

EDIT (for completenes including the full solution)

rule "rPCControl"
when
	Item PCControl received command
then 	
    logInfo("rule rPCControl", "command "+receivedCommand)
	val actions = getActions("mqtt","mqtt:broker:81c98b85")
	switch (receivedCommand) {
		case "nhk" : {
			actions.publishMQTT("winthing/system/commands/run", "[\"nhk.vbs\",\"\",\"\"]")
			}
  		case "youtube" : {
			actions.publishMQTT("winthing/system/commands/run", "[\"youtube.vbs\",\"\",\"\"]")
			}
		case "netflix" : {
			actions.publishMQTT("winthing/system/commands/run", "[\"Netflix.lnk\",\"\",\"\"]")
            // Wait 5 seconds and send WIN+SHIFT+ENTER to go Fullscreen
            Thread::sleep(5000)
            actions.publishMQTT("winthing/keyboard/commands/press_keys", "[\"LWIN\",\"LSHIFT\",\"ENTER\"]")
   
        }
	}
end

I use text files only but have you tried with

val actions = getActions("mqtt","mqtt:broker:81c98b85")
1 Like