Tasmota: how to use irsend ?

Created on 16 Apr 2018  路  22Comments  路  Source: arendst/Tasmota

Hey there @ll

I've been using with big success this firmware for a while, finally decided to give a try IR part that was based on my own firmware - but Id love to have 1 reliable platform (and my code sucks comparing to tasmota :D )

While receive went smooth i cannot send commands.

Console:

getting tele/esp07/RESULT = {"IrReceived":{"PROTOCOL":"NEC","BITS":32,"DATA":"FD30CF"}}

when I do irsend {"PROTOCOL":"NEC","BITS":32,"DATA":0xFD30CF}

I get response stat/esp07/RESULT = {"IRSend":"No PROTOCOL, BITS or DATA"}

what do I do wrong ?

All 22 comments

In contrast to the command description hex data are currently not accepted, data in decimal works:

irsend { "Protocol": "NEC", "Bits": 32, "Data": 16593103}

stat/phesp08/RESULT = {"IRSend":"Done"}

Hex send works... post your status 0 output. With no information no one can help you
19:30:09 CMD: irsend { "Protocol": "NEC", "Bits": 32, "Data": 0x15543}
19:30:10 MQT: stat/sonoff-17DBAE/RESULT = {"IRSend":"Done"}
With your value
19:34:13 CMD: irsend { "Protocol": "NEC", "Bits": 32, "Data": 0xFD30CF}
19:34:13 MQT: stat/sonoff-17DBAE/RESULT = {"IRSend":"Done"}

Funny story i can send in decimal but cannot in hex
Everything else works perfect, some modules months without any reboot

21:03:19 CMD: status 0
21:03:19 MQT: stat/esp07/STATUS = {"Status":{"Module":18,"FriendlyName":"esp07","Topic":"esp07","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}}
21:03:19 MQT: stat/esp07/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://sonoff.maddox.co.uk/tasmota/sonoff.ino.bin","Uptime":"1T00:21:40","StartupUTC":"2018-04-16T19:41:39","Sleep":0,"BootCount":14,"SaveCount":25,"SaveAddress":"FA000"}}
21:03:19 MQT: stat/esp07/STATUS2 = {"StatusFWR":{"Version":"5.12.0d","BuildDateTime":"2018-03-04T23:14:56","Boot":31,"Core":"2_3_0","SDK":"1.5.3(aec24ac9)"}}
21:03:19 MQT: stat/esp07/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"##.##.##.25","LogPort":10514,"SSId1":"aaa","SSId2":"","TelePeriod":300,"SetOption":"00000009"}}
21:03:19 MQT: stat/esp07/STATUS4 = {"StatusMEM":{"ProgramSize":489,"Free":512,"Heap":20,"ProgramFlashSize":1024,"FlashSize":1024,"FlashMode":3}}
21:03:19 MQT: stat/esp07/STATUS5 = {"StatusNET":{"Hostname":"esp07-0938","IPAddress":"##.##.##.38","Gateway":"##.##.##.1","Subnetmask":"255.255.255.0","DNSServer":"##.##.##.1","Mac":"5C:CF:7F:00:00:00","Webserver":2,"WifiConfig":3}}
21:03:19 MQT: stat/esp07/STATUS6 = {"StatusMQT":{"MqttHost":"##.##.##.30","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_0F23AA","MqttUser":"DVES_USER","MqttType":1,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
21:03:19 MQT: stat/esp07/STATUS7 = {"StatusTIM":{"UTC":"Tue Apr 17 20:03:19 2018","Local":"Tue Apr 17 21:03:19 2018","StartDST":"Sun Mar 25 02:00:00 2018","EndDST":"Sun Oct 28 03:00:00 2018","Timezone":1}}
21:03:19 MQT: stat/esp07/STATUS10 = {"StatusSNS":{"Time":"2018-04-17T21:03:19"}}
21:03:19 MQT: stat/esp07/STATUS11 = {"StatusSTS":{"Time":"2018-04-17T21:03:19","Uptime":"1T00:21:40","Vcc":3.113,"Wifi":{"AP":1,"SSId":"aaa","RSSI":84,"APMac":"4C:5E:0C:00:00:00"}}}

Yes but here we can see that you use 5.12.0d and Hex IRsend is implemented since 5.12.0i馃槑

5.12.0i

  • Add 16 timers using commands Timer and Timers (#1091)
  • Add commands Timer 0 to clear timer and Timer 1..16 to copy timer
  • Add optional Timer configuration webpage to be enabled in user_config.h with define USE_TIMERS_WEB
  • Add hexadecimal Data entry to command IrSend using 0x notation (#1290, #2314)
  • Add Domoticz Battery and RSSI Quality (#1604)
  • Add Home Assistant MQTT Discovery for Buttons and change SetOption19 response (#2277)
  • Add support for SGP30 gas and air quality sensor (#2307)
  • Add multiple color entry support for command Led like Led2 120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue (#2303)
  • Add hexadecimal RGB color entry on RGBCW leds (#2304)
  • Change webpage parameter communication
  • Change Timer parameter Device to more obvious Output
  • Change max number of commands in Backlog from 15 to 30 and ignore commands overflowing
  • Change user_config_override usage by providing user_config_override_sample.h (#2228)
  • Change MQTT response topic for Energy changes from ENERGY to SENSOR (#2229, #2251)
  • Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
    *

OK, good point :D Thx for reply and it can be closed i guess

In contrast to the command description hex data are currently not accepted, data in decimal works:

irsend { "Protocol": "NEC", "Bits": 32, "Data": 16593103}

stat/phesp08/RESULT = {"IRSend":"Done"}

I can't get same response!!!
Terminal : 20:35:30 MQT: stat/sonoff/RESULT = {"Command":"Unknown"}

command : irsend { "Protocol": "NEC", "Bits": 32, "Data": 16593103}

Mqttbox : {"Command":"Unknown"}
qos : 0, retain : false, cmd : publish, dup : false, topic : stat/sonoff/RESULT, messageId : , length : 41, Raw payload : 1233467111109109971101003458348511010711011111911034125

My config :
uint32_t ir_receive_decimal : 1; // bit 29 (v6.0.0a) - SetOption29 - IR receive data format
uint32_t receive_raw : 1; // bit 8 (v6.3.0.11) - SetOption58 - Add IR Raw data to JSON message

There are missing another configuration?

Please update your Tasmota version to latest and to the full version (sonoff.bin)

If you need further assistant, please find us in the Tasmota support chat. Thanks

Its a latest version!!!

6.5.0.8? Development branch binaries can be obtained at http://thehackbox.org/tasmota/ (other ESP core available as well).

This was difficult problem for me as well. stat/sonoff/RESULT = {"Command":"Unknown"}

You need to change module type to Generic(0), default is Sonoff(1).

@hpirila

What kind of device (i.e., model) are you using? Is it an IR device or have you connected an IR module to one of your device's GPIO?

Please go to the Console for your device and enter STATUS 0 and paste the log output here. Also, please go to the module configuration (where you selected Generic(0) and either screenshot the GPIO configuration or provide your configuration information.

Regards.

Mike

I have been trying to use IRSend command in console and I can confirm that command will always fail if you have out of the box tasmota. The result is always stat/sonoff/RESULT = {"Command":"Unknown"}

You need to change Module type to example Generic (0) and then the command starts to work. I tried with many device and many 6.5 ++versions.

@hpirila Yes, as designed. You have to assign IRSend(8) to a GPIO pin.

But I actually assigned them as a first thing, then start to give irsend command. But result is command unknown.

In addition you need to change the Module type.

@hpirila

Both Jason & I are trying to better understand your configuration. Yes, it works for you, but perhaps there is a reason... which we would either like to help you understand better or help us understand better in case there truly is an issue to debug. If you could provide the information requested, it would help in this understanding and help users going forward. Thank you in advance for your assistance.

Mike

Here is more detailed description of the problem, if it is a problem you decide. But its quite annoying as I spent lot of time troubleshooting.

I repeated the case with 6.5 official firmware, but I didn't see any difference when tried with latest development. Also I used very clean setup with NodeMCU v3, everything as standard and blank as I could think of.

Using esptool.exe flash official firmware
In web interface: Reset configuration
In web interface: Set AP and password

In web interface console: status 0
14:31:52 CMD: status 0
14:31:52 RSL: stat/sonoff/STATUS = {"Status":{"Module":1,"FriendlyName":["Sonoff"],"Topic":"sonoff","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
14:31:52 RSL: stat/sonoff/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://thehackbox.org/tasmota/release/sonoff.bin","RestartReason":"Software/System restart","Uptime":"0T00:00:23","StartupUTC":"2019-05-04T13:31:29","Sleep":50,"CfgHolder":4617,"BootCount":2,"SaveCount":6,"SaveAddress":"F6000"}}
14:31:52 RSL: stat/sonoff/STATUS2 = {"StatusFWR":{"Version":"6.5.0(sonoff)","BuildDateTime":"2019-03-19T12:47:29","Boot":31,"Core":"2_4_2","SDK":"2.2.1(cfd48f3)"}}
14:31:52 RSL: stat/sonoff/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["Mopo2",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","280500000100000000000000000000000000","00000000"]}}
14:31:52 RSL: stat/sonoff/STATUS4 = {"StatusMEM":{"ProgramSize":524,"Free":476,"Heap":20,"ProgramFlashSize":1024,"FlashSize":4096,"FlashChipId":"1640EF","FlashMode":3,"Features":["00000809","0FDAE394","000783A0","23B617CE","00003BC0"]}}
14:31:52 RSL: stat/sonoff/STATUS5 = {"StatusNET":{"Hostname":"sonoff-5505","IPAddress":"192.168.2.39","Gateway":"192.168.2.1","Subnetmask":"255.255.255.0","DNSServer":"8.8.8.8","Mac":"CC:50:E3:56:55:81","Webserver":2,"WifiConfig":4}}
14:31:52 RSL: stat/sonoff/STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_565581","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
14:31:52 RSL: stat/sonoff/STATUS7 = {"StatusTIM":{"UTC":"Sat May 04 13:31:52 2019","Local":"Sat May 04 14:31:52 2019","StartDST":"Sun Mar 31 02:00:00 2019","EndDST":"Sun Oct 27 03:00:00 2019","Timezone":"+01:00","Sunrise":"05:25","Sunset":"20:09"}}
14:31:52 RSL: stat/sonoff/STATUS10 = {"StatusSNS":{"Time":"2019-05-04T14:31:52"}}
14:31:52 RSL: stat/sonoff/STATUS11 = {"StatusSTS":{"Time":"2019-05-04T14:31:52","Uptime":"0T00:00:23","Vcc":3.002,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Mopo2","BSSId":"20:9A:E9:0E:5D:54","Channel":4,"RSSI":66,"LinkCount":1,"Downtime":"0T00:00:06"}}}

In web interface configure template: Set GPIO4 to Irsend(8) (picture 1)

In web interface console: status 0
14:37:10 CMD: status 0
14:37:10 RSL: stat/sonoff/STATUS = {"Status":{"Module":1,"FriendlyName":["Sonoff"],"Topic":"sonoff","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
14:37:10 RSL: stat/sonoff/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://thehackbox.org/tasmota/release/sonoff.bin","RestartReason":"Software/System restart","Uptime":"0T00:02:41","StartupUTC":"2019-05-04T13:34:29","Sleep":50,"CfgHolder":4617,"BootCount":3,"SaveCount":8,"SaveAddress":"F4000"}}
14:37:10 RSL: stat/sonoff/STATUS2 = {"StatusFWR":{"Version":"6.5.0(sonoff)","BuildDateTime":"2019-03-19T12:47:29","Boot":31,"Core":"2_4_2","SDK":"2.2.1(cfd48f3)"}}
14:37:10 RSL: stat/sonoff/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["Mopo2",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","280500000100000000000000000000000000","00000000"]}}
14:37:10 RSL: stat/sonoff/STATUS4 = {"StatusMEM":{"ProgramSize":524,"Free":476,"Heap":20,"ProgramFlashSize":1024,"FlashSize":4096,"FlashChipId":"1640EF","FlashMode":3,"Features":["00000809","0FDAE394","000783A0","23B617CE","00003BC0"]}}
14:37:10 RSL: stat/sonoff/STATUS5 = {"StatusNET":{"Hostname":"sonoff-5505","IPAddress":"192.168.2.39","Gateway":"192.168.2.1","Subnetmask":"255.255.255.0","DNSServer":"8.8.8.8","Mac":"CC:50:E3:56:55:81","Webserver":2,"WifiConfig":4}}
14:37:10 RSL: stat/sonoff/STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_565581","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
14:37:10 RSL: stat/sonoff/STATUS7 = {"StatusTIM":{"UTC":"Sat May 04 13:37:10 2019","Local":"Sat May 04 14:37:10 2019","StartDST":"Sun Mar 31 02:00:00 2019","EndDST":"Sun Oct 27 03:00:00 2019","Timezone":"+01:00","Sunrise":"05:25","Sunset":"20:09"}}
14:37:10 RSL: stat/sonoff/STATUS10 = {"StatusSNS":{"Time":"2019-05-04T14:37:10"}}
14:37:10 RSL: stat/sonoff/STATUS11 = {"StatusSTS":{"Time":"2019-05-04T14:37:10","Uptime":"0T00:02:41","Vcc":3.002,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Mopo2","BSSId":"20:9A:E9:0E:5D:54","Channel":4,"RSSI":62,"LinkCount":1,"Downtime":"0T00:00:05"}}}

In web interface console: irsend { "Protocol": "NEC", "Bits": 32, "Data": 16593103}
14:38:06 CMD: irsend { "Protocol": "NEC", "Bits": 32, "Data": 16593103}
14:38:06 RSL: stat/sonoff/RESULT = {"Command":"Unknown"}

In web interface configure Module: Set Module type Generic(0) picture(2)

In web interface console: irsend { "Protocol": "NEC", "Bits": 32, "Data": 16593103}
14:39:47 CMD: irsend { "Protocol": "NEC", "Bits": 32, "Data": 16593103}
14:39:47 RSL: stat/sonoff/RESULT = {"IRSend":"Done"}

In web interface console: status 0
14:40:54 CMD: status 0
14:40:54 RSL: stat/sonoff/STATUS = {"Status":{"Module":0,"FriendlyName":["Sonoff"],"Topic":"sonoff","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
14:40:54 RSL: stat/sonoff/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://thehackbox.org/tasmota/release/sonoff.bin","RestartReason":"Software/System restart","Uptime":"0T00:01:28","StartupUTC":"2019-05-04T13:39:26","Sleep":50,"CfgHolder":4617,"BootCount":4,"SaveCount":10,"SaveAddress":"FA000"}}
14:40:54 RSL: stat/sonoff/STATUS2 = {"StatusFWR":{"Version":"6.5.0(sonoff)","BuildDateTime":"2019-03-19T12:47:29","Boot":31,"Core":"2_4_2","SDK":"2.2.1(cfd48f3)"}}
14:40:54 RSL: stat/sonoff/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["Mopo2",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","280500000100000000000000000000000000","00000000"]}}
14:40:54 RSL: stat/sonoff/STATUS4 = {"StatusMEM":{"ProgramSize":524,"Free":476,"Heap":20,"ProgramFlashSize":1024,"FlashSize":4096,"FlashChipId":"1640EF","FlashMode":3,"Features":["00000809","0FDAE394","000783A0","23B617CE","00003BC0"]}}
14:40:54 RSL: stat/sonoff/STATUS5 = {"StatusNET":{"Hostname":"sonoff-5505","IPAddress":"192.168.2.39","Gateway":"192.168.2.1","Subnetmask":"255.255.255.0","DNSServer":"8.8.8.8","Mac":"CC:50:E3:56:55:81","Webserver":2,"WifiConfig":4}}
14:40:54 RSL: stat/sonoff/STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_565581","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
14:40:54 RSL: stat/sonoff/STATUS7 = {"StatusTIM":{"UTC":"Sat May 04 13:40:54 2019","Local":"Sat May 04 14:40:54 2019","StartDST":"Sun Mar 31 02:00:00 2019","EndDST":"Sun Oct 27 03:00:00 2019","Timezone":"+01:00","Sunrise":"05:25","Sunset":"20:09"}}
14:40:54 RSL: stat/sonoff/STATUS10 = {"StatusSNS":{"Time":"2019-05-04T14:40:54"}}
14:40:54 RSL: stat/sonoff/STATUS11 = {"StatusSTS":{"Time":"2019-05-04T14:40:54","Uptime":"0T00:01:28","Vcc":3.007,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"Wifi":{"AP":1,"SSId":"Mopo2","BSSId":"20:9A:E9:0E:5D:54","Channel":4,"RSSI":68,"LinkCount":1,"Downtime":"0T00:00:06"}}}

Picture 1:

1

Picture 2:

2

Thanks. One more piece of information... What is the actual device model that you are using?

NodeMCU V3 ESP8266 WiFi CH340G IoT Development Board

OK... Then yes, Your NodeMCU is not a "Sonoff Basic". That is why you needed to select Generic and then configure it's GPIO.

Yes. It is just difficult to know that, it would make more sense to allow IRSend command if that is allowed to set as output pin. Or then not allow to set IRSend pin at all if it does not work.

Same behavior applies to IRReceive pin, nothing comes to console when Sonoff Basic mode, even pin is set.

Before arriving at configuring sensors, one must properly configure the underlying base device first. If you skip over that step, then configuring a sensor is premature. If you follow the fully documented configuration procedure, then you won't have the issues you encountered due to skipping those steps.

Was this page helpful?
0 / 5 - 0 ratings