IR Tasmota Command via MQTT

Hello,

In Sonoff Tasmota Console i have working command:

cmnd/sonoff1/IRsend {“protocol”:“RC6” ,“bits”:32 ,“data”:17695740}

Now i would like to send this command via Switch item in OpenHAB2.

Switch hk “hk” { mqtt=“>[broker:cmnd/sonoff1/IRsend:command:*: ??? ]”}

I dont know how. Everytime i get this

18:04:53 MQTT: stat/sonoff1/RESULT = {“IRSend”:“Invalid JSON”}

I think you need MQTT Action binding for this use case…

  1. Unbind your Switch from mqtt binding
  2. Within a rule (triggered with your Switch), you need the following code:
publish("broker", "cmnd/sonoff1/IRsend", "{\“protocol\”:\“RC6\” ,\“bits\”:32 ,\“data\”:17695740}")

which sends MQTT message…

Andreas

Hi guys, I’m struggling trying to find a solution from my case…

I’m using Tasmota 8.4 and I’m able to read and write commands by local Tasmota console but I’m not able to do the same by MQTT FX (I’m trying here before go OH2).

This is from Tasmota Console:
01:52:53 CMD: Irsend {“Protocol”:“NEC”,“Bits”:32,“Data”:0x20DF10EF}
01:52:53 MQT: stat/Tasmota_135/RESULT = {“IRSend”:“Done”}

This is from MQTT FX:
Input on MQTT FX: cmnd/Tasmota_135/Irsend {“Protocol”:“NEC”,“Bits”:32,“Data”:“0x20DF10EF”}
Output on Tasmota Console: 01:54:11 MQT: stat/Tasmota_135/RESULT = {“Command”:“Unknown”}

Do you guys have any tip for me?
Thank you in advance,
From Brazil!!!

We don’t know how your topics are setup on your Tasmota device - can we see a screenshot?

You could also provide a screenshot from MQTT.fx showing how your are trying to publish the command.

From other examples on this forum, everyone seems to use capital letters. Try:

cmnd/Tasmota_135/IRSEND

Also, it looks like to have put quotes around your data string when sending via MQTT, but didn’t on the Tasmota console. Try:

{“Protocol”:“NEC”,“Bits”:32,“Data”:0x20DF10EF}

Please only post once with your issue, and preferably start a new thread.

1 Like

Thank you for your feedback,
Unfortunately I’m still falling…

Please follow some details below:

My MQTT Configuration in Tasmota:
image

Sending default command via MQTT FX to test communication:
image

Response on Tasmota Console: works fine!!

Trying to Send IRSEND:
image

Response on Tasmota Console: getting error!
image

I also tried the commands below and the result is exactly the same:
cmnd/Tasmota_135/Irsend IRSEND"," {\“Protocol\”:\“NEC\”,\“Bits\”:21,\“Data\”:0x20df10ef,}

cmnd/Tasmota_135/Irsend {“Protocol”:“NEC”,“Bits”:32,“Data”:“0x20DF10EF”}

cmnd/Tasmota_135/Irsend, “{“Protocol”:“NEC”,“Bits”:32,“Data”:“0x20DF10EF”}”

cmnd/Tasmota_135/IRsend -m{“Protocol”:“NEC”,“Bits”:32,“Data”:0x20DF10EF}

Directly in Tasmota Console works very fine with the command below:
image

Do you have any suggestion?
Thank you again,
T

I think you’re using MQTT.fx wrong. You need to write the message/payload in the big text field underneath the topic, I think.

(I use MQTT Explorer, but I think they’re similar)

2 Likes

You are right!
I was sending the command on TOPIC instead of payload.

Thank you very much!!!

Is there a way to check, wheter the command was send sucessfully?
I am using raw commands (that were sent 3 times, like the original equipment does)

(AEG Oven/Hood combination, codes are in here: https://pastebin.com/N6kG7Wu5)
This works, but not every time :confused:
irsend 3,1416,1494,722,1570,1974,1510,722,1468,726,718,724,1468,724,2216,696
(sending it 3 times / 3 in the front)

Unfortunately IR is (almost always) send-and-forget one way communication.

Could you just send the command more than three times just to be sure it works every time?

2 Likes

Jep, I changed my rules to send the command again. (2*5 times :smile:)
(Slight delay of 10-15 seconds, but fine for using it as a routine)