RF Communication
This feature is included only in tasmota-sensors
and tasmota32
binaries
When compiling your build add the following to user_config_override.h
:
#ifndef USE_RC_SWITCH
#define USE_RC_SWITCH // Add support for RF transceiver using library RcSwitch (+2k7 code, 460 iram)
#endif
This guide does not apply to Sonoff RF Bridge specific commands
Tasmota uses the rc-switch library to decode RF codes. Supported hardware depends on rc-switch library support only.
Sending RF Codes~
Send an RF control code as a decimal or hexadecimal string in a JSON payload. An inexpensive RF receiver such as a STX882 can be connected to a device running Tasmota. In order to send RF data you need to configure the connected GPIO as RFSend (105)
If you send only the "Data" value in decimal or hexadecimal other values will be sent as default.
Example
RfSend 123456
will be sent as {"Data":"0x1E240","Bits":24,"Protocol":1,"Pulse":351}
When sending decimal formatted command you need to follow the pattern otherwise a part of the command will be ignored.
Example
RfSend 123456, 24, 1, 238
is missing the repeat
value so the last number intended as pulse value won't be sent
Receiving RF Codes~
An inexpensive RF receiver such as a SRX882 can be connected to a device running Tasmota. Configure the GPIO connected to Data pin on the RF receiver as 'RFrecv (106)'.
Once you have identified the protocols that you want to receive data on , you can enable only those protocols .
The RfProtocol command will only work if you have set a pin function to rfrecv
Example
RfProtocol 5
will enable only protocols 1 & 3 stat/tasmota_D728A8/RESULT {"RfProtocol":"1,3"}
RfProtocol27 1
will enable protocol 27 stat/tasmota_D728A8/RESULT {"RfProtocol":"1,3,27"}
RfProtocol 0
stat/tasmota_D728A8/RESULT {"RfProtocol":"None Enabled"}
RfProtocol a
stat/tasmota_D728A8/RESULT {"RfProtocol":"1,2,3,4,5,6,7,8,9,10,11,12,
13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35"}
If you have an RF receiver configured, a message will be logged each time an RF code is seen. RF driver will try to decode it against all protocols supported by rc-switch library.
When Tasmota receives an RF message, the data portion of the payload has the same format as the RfSend
JSON parameters.
"RfReceived":{"Data":"<hex-value>","Bits":<value>,"Protocol":<value>,"Pulse":<value>}
This JSON payload data can be used in a rule such as:
ON RfReceived#Data=<hex-value> DO <command> ENDON
Examples:
Sonoff RM433 Remote
MQT: tele/tasmota/RESULT = {"Time":"2020-05-27T18:59:06","RfReceived":{"Data":"0x7028D2","Bits":24,"Protocol":1,"Pulse":238}}