Page 1 of 2
rc-switch plugin
Posted: 30 Dec 2016, 13:28
by kniazio
I have a proven operating sketch to control wall switches
https://pl.aliexpress.com/item/EU-Stand ... =200001056
Is there a person who remodel this sketch for a plugin for EspEasy?
I really want this.
Code: Select all
/*
* This sketch demonstrates how to set up a simple HTTP-like server.
* The server will set a switch depending on the request
* http://server_ip/sw1/0 will turn sw1 off
* http://server_ip/sw1/1 will turn sw1 on
* server_ip is the IP address of the ESP8266 module, will be
* printed to Serial when the module is connected.
*/
#include <RCSwitch.h>
#include <ESP8266WiFi.h>
RCSwitch mySwitch = RCSwitch();
const char* ssid = "your_ssid";
const char* password = "your_password";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(10);
// prepare GPIO2
pinMode(2, OUTPUT);
// Transmitter is connected to ESP8266 PIN #2
mySwitch.enableTransmit(2);
//EtekCity ZAP Remote Outlets use pulse of approximately 189
mySwitch.setPulseLength(189);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println("new client");
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();
// Match the request
int val;
int swi;
// **** SWITCH 1 ****
if (req.indexOf("/sw1/0") != -1)
{val = 0;
swi = 1;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(5260604, 24);}
else if (req.indexOf("/sw1/1") != -1)
{val = 1;
swi = 1;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(5260595, 24);}
// **** SWITCH 2 ****
else if (req.indexOf("/sw2/0") != -1)
{val = 0;
swi = 2;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(1234567, 24);}
else if (req.indexOf("/sw2/1") != -1)
{val = 1;
swi = 2;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(2345678, 24);}
// **** SWITCH 3 ****
else if (req.indexOf("/sw3/0") != -1)
{val = 0;
swi = 3;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(3456789, 24);}
else if (req.indexOf("/sw3/1") != -1)
{val = 1;
swi = 3;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(4567890, 24);}
// **** SWITCH 4 ****
else if (req.indexOf("/sw4/0") != -1)
{val = 0;
swi = 4;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(5678901, 24);}
else if (req.indexOf("/sw4/1") != -1)
{val = 1;
swi = 4;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(6789012, 24);}
// **** SWITCH 5 ****
else if (req.indexOf("/sw5/0") != -1)
{val = 0;
swi = 5;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(7890123, 24);}
else if (req.indexOf("/sw5/1") != -1)
{val = 1;
swi = 5;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(8901234, 24);}
// **** SWITCH 6 ****
else if (req.indexOf("/sw6/0") != -1)
{val = 0;
swi = 6;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(9012345, 24);}
else if (req.indexOf("/sw6/1") != -1)
{val = 1;
swi = 6;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(1098765, 24);}
// **** SWITCH 7 ****
else if (req.indexOf("/sw7/0") != -1)
{val = 0;
swi = 7;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(4478268, 24);}
else if (req.indexOf("/sw7/1") != -1)
{val = 1;
swi = 7;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(4478259, 24);}
// **** SWITCH 8 ****
else if (req.indexOf("/sw8/0") != -1)
{val = 0;
swi = 8;
// Insert your "OFF" code here, before ", 24)"
mySwitch.send(87124, 24);}
else if (req.indexOf("/sw8/1") != -1)
{val = 1;
swi = 8;
// Insert your "ON" code here, before ", 24)"
mySwitch.send(87121, 24);}
else {
Serial.println("invalid request");
client.stop();
return;
}
client.flush();
// Prepare the response
String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>\r\nSwitch ";
s += String(swi, DEC);
s += " is now ";
s += (val)?"ON":"OFF";
s += "</html>\n";
// Send the response to the client
client.print(s);
delay(1);
Serial.println("Client disonnected");
// The client will actually be disconnected
// when the function returns and 'client' object is detroyed
}
Re: rc-switch plugin
Posted: 07 Jan 2017, 19:40
by kniazio
Is there anyone who can help me?
Re: rc-switch plugin
Posted: 08 Jan 2017, 10:25
by BertB
You could look if RFLINK ( also in this forum) controls the device.
If not, you could ask them to implement it.
I use RFLINK for numerous RF applications.
Re: rc-switch plugin
Posted: 08 Jan 2017, 15:19
by data
Re: rc-switch plugin
Posted: 08 Jan 2017, 16:24
by Stuntteam
BertB wrote:You could look if RFLINK ( also in this forum) controls the device.
If not, you could ask them to implement it.
I use RFLINK for numerous RF applications.
It is very likely that RFLink supports it.. If not, we will add support for it.
Re: rc-switch plugin
Posted: 08 Jan 2017, 16:39
by kniazio
I would like to have but easyesp.
I do not want to engage other devices.
Re: rc-switch plugin
Posted: 08 Jan 2017, 19:07
by kniazio
Yes, I checked.
It only works with sockets type kaku_switch sold in stores Jula
Re: rc-switch plugin
Posted: 08 Jan 2017, 21:43
by NietGiftig
kniazio wrote:I do not want to engage other devices.
Thats clear then!
You have work to do

Re: rc-switch plugin
Posted: 19 Jan 2017, 12:19
by s4nder
I made a 2 plugins with RC-Switch, but did not find the time to test it or publish it. Here is the code:
_P112_RFTX.ino:
Code: Select all
//#######################################################################################################
//########################### Plugin 112: Output 433 MHZ - RF ###########################
//#######################################################################################################
/*
Version: 1.0
Description: use this script to send RF with a cheap FS1000A alike sender
Example of usage:
Learn codes via _P111_RF.ino plugin!
Needs: RCSwitch library
Tested on GPIO:14
Author: S4nder
Copyright: (c) 2015-2016 Sander Pleijers (s4nder)
License: MIT
License URI: http://en.wikipedia.org/wiki/MIT_License
Status : "Proof of concept"
Usage:
1=RFSEND
2=commando
3=repeat (if not set will use default settings)
4=bits (if not set will use default settings)
1 2 3 4
http://<ESP IP address>/control?cmd=rfsend,blablacommando,10,24
This program was developed independently and it is not supported in any way.
*/
#include <RCSwitch.h>
RCSwitch *rcswitchSender;
#define PLUGIN_112
#define PLUGIN_ID_112 112
#define PLUGIN_NAME_112 "RF Transmit - FS1000A alike sender"
unsigned long Plugin_112_Repeat;
unsigned long Plugin_112_Bits;
unsigned long Plugin_112_Pulse;
boolean Plugin_112(byte function, struct EventStruct *event, String& string)
{
boolean success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
Device[++deviceCount].Number = PLUGIN_ID_112;
Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
Device[deviceCount].SendDataOption = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_112);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
break;
}
case PLUGIN_WEBFORM_LOAD:
{
char tmpString[128];
Plugin_112_Bits = ExtraTaskSettings.TaskDevicePluginConfigLong[0];
if (Plugin_112_Bits < 100) Plugin_112_Bits = 24;
Plugin_112_Pulse = ExtraTaskSettings.TaskDevicePluginConfigLong[1];
if (Plugin_112_Pulse > 1000) Plugin_112_Pulse = 165;
Plugin_112_Repeat = ExtraTaskSettings.TaskDevicePluginConfigLong[2];
if (Plugin_112_Repeat > 10) Plugin_112_Pulse = 1;
sprintf_P(tmpString, PSTR("<TR><TD>Bits (default=24):<TD><input type='text' name='plugin_112_bits' value='%u'>"), Plugin_112_Bits);
string += tmpString;
sprintf_P(tmpString, PSTR("<TR><TD>Pulselength (default=165):<TD><input type='text' name='plugin_112_pulse' value='%u'>"), Plugin_112_Pulse);
string += tmpString;
sprintf_P(tmpString, PSTR("<TR><TD>Repeat (default=1):<TD><input type='text' name='plugin_112_repeat' value='%u'>"), Plugin_112_Repeat);
string += tmpString;
success = true;
break;
}
case PLUGIN_WEBFORM_SAVE:
{
String plugin1 = WebServer.arg("plugin_112_bits");
Plugin_112_Bits = plugin1.toInt();
String plugin2 = WebServer.arg("plugin_112_pulse");
Plugin_112_Pulse = plugin2.toInt();
String plugin3 = WebServer.arg("plugin_112_repeat");
Plugin_112_Repeat = plugin3.toInt();
if (Plugin_112_Bits > 100) Plugin_112_Bits = 24;
if (Plugin_112_Pulse > 1000) Plugin_112_Pulse = 165;
if (Plugin_112_Pulse > 10) Plugin_112_Repeat = 1;
ExtraTaskSettings.TaskDevicePluginConfigLong[0] = Plugin_112_Bits;
ExtraTaskSettings.TaskDevicePluginConfigLong[1] = Plugin_112_Pulse;
ExtraTaskSettings.TaskDevicePluginConfigLong[2] = Plugin_112_Repeat;
SaveTaskSettings(event->TaskIndex);
success = true;
break;
}
case PLUGIN_WEBFORM_SHOW_CONFIG:
{
string += String(ExtraTaskSettings.TaskDevicePluginConfigLong[0]);
string += String(ExtraTaskSettings.TaskDevicePluginConfigLong[1]);
string += String(ExtraTaskSettings.TaskDevicePluginConfigLong[2]);
success = true;
break;
}
case PLUGIN_INIT:
{
LoadTaskSettings(event->TaskIndex);
Plugin_112_Bits = ExtraTaskSettings.TaskDevicePluginConfigLong[0];
Plugin_112_Pulse = ExtraTaskSettings.TaskDevicePluginConfigLong[1];
Plugin_112_Repeat = ExtraTaskSettings.TaskDevicePluginConfigLong[2];
//if (Plugin_112_Bits > 100) Plugin_112_Bits = 24;
if (Plugin_112_Pulse > 1000) Plugin_112_Pulse = 165;
//if (Plugin_112_Repeat > 10) Plugin_112_Repeat = 1;
int txPin = Settings.TaskDevicePin1[event->TaskIndex];
if (rcswitchSender == 0 && txPin != -1)
{
addLog(LOG_LEVEL_INFO, "INIT: RF433 TX created!");
//rcswitchSender = new RCSwitch(txPin);
rcswitchSender = new RCSwitch();
rcswitchSender->enableTransmit(txPin);
rcswitchSender->setPulseLength(Plugin_112_Pulse);
}
if (rcswitchSender != 0 && txPin == -1)
{
addLog(LOG_LEVEL_INFO, "INIT: RF433 TX REMOVED!");
delete rcswitchSender;
rcswitchSender = 0;
}
success = true;
break;
}
case PLUGIN_TEN_PER_SECOND:
{
}
case PLUGIN_WRITE:
{
String Plugin_112_Result = "";
unsigned int Plugin_112_DeviceNr = 0;
unsigned int Plugin_112_Value = 0;
char command[80]; command[0] = 0;
char TmpStr1[80]; TmpStr1[0] = 0;
string.toCharArray(command, 80);
String tmpString = string;
int argIndex = tmpString.indexOf(',');
if (argIndex) tmpString = tmpString.substring(0, argIndex);
if (GetArgv(command, TmpStr1, 2)) Plugin_112_Value = str2int(TmpStr1);
if (GetArgv(command, TmpStr1, 3)) Plugin_112_Repeat = str2int(TmpStr1);
if (GetArgv(command, TmpStr1, 4)) Plugin_112_Bits = str2int(TmpStr1);
if (Plugin_112_Repeat > 10) Plugin_112_Repeat = 1;
if (Plugin_112_Bits > 100) Plugin_112_Bits = 24;
if (tmpString.equalsIgnoreCase("RFSEND") && rcswitchSender != 0 && Plugin_112_Bits != 0)
{
Serial.println("RFSEND");
success = true;
Plugin_112_Result = "Unknown RF command or structure !!!";
for (int i = 0; i <= Plugin_112_Repeat; i++) {
rcswitchSender->send(Plugin_112_Value, Plugin_112_Bits);
//delay(1000);
}
addLog(LOG_LEVEL_INFO, "RF Code Sent: " + String(Plugin_112_Value));
if (printToWeb)
{
String url = String(Settings.Name) + "/control?cmd=" + string;
printWebString += F("RCSwitch Code Sent!");
printWebString += F("<BR>Value: ");
printWebString += String(Plugin_112_Value);
printWebString += F("<BR>Repeats: ");
printWebString += String(Plugin_112_Repeat);
printWebString += F("<BR>Bits: ");
printWebString += String(Plugin_112_Bits);
printWebString += F("<BR>Pulselength: ");
printWebString += String(Plugin_112_Pulse);
printWebString += F("<BR><BR>");
printWebString += F("<BR>Use URL: <a href=\"http://");
printWebString += url;
printWebString += F("\">http://");
printWebString += url;
printWebString += F("</a>");
}
}
break;
}
}
return success;
}
And _P111_RF.ino:
Code: Select all
//#######################################################################################################
//#################################### Plugin 111: Input RF #############################################
//#######################################################################################################
/*
Version: 1.1
Description: use this script to recieve RF with a cheap MX-05V alike reciever
Author: S4nder
Copyright: (c) 2015-2016 Sander Pleijers (s4nder)
License: MIT
License URI: http://en.wikipedia.org/wiki/MIT_License
Status : "Proof of concept"
This program was developed independently and it is not supported in any way.
*/
#include <RCSwitch.h>
RCSwitch *rfReceiver;
#define PLUGIN_111
#define PLUGIN_ID_111 111
#define PLUGIN_NAME_111 "RF Recieve - MX-05V alike reciever"
#define PLUGIN_ValueNAME1_111 "RF"
boolean Plugin_111(byte function, struct EventStruct *event, String& string)
{
boolean success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
Device[++deviceCount].Number = PLUGIN_ID_111;
Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
Device[deviceCount].VType = SENSOR_TYPE_LONG;
Device[deviceCount].Ports = 0;
Device[deviceCount].InverseLogicOption = false;
Device[deviceCount].FormulaOption = false;
Device[deviceCount].ValueCount = 1;
Device[deviceCount].SendDataOption = true;
Device[deviceCount].TimerOption = false;
Device[deviceCount].GlobalSyncOption = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_111);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_ValueNAME1_111));
break;
}
case PLUGIN_INIT:
{
int rfPin = Settings.TaskDevicePin1[event->TaskIndex];
//Serial.println(String(rfPin));
if (irReceiver != 0) {
String log = F("BUG: Cannot use IR reciever and RF reciever at the same time!");
Serial.print(log);
addLog(LOG_LEVEL_INFO, log);
delete rfReceiver;
rfReceiver = 0;
} else {
if (rfPin != -1)
{
Serial.println("INIT: RF433 RX created!");
rfReceiver = new RCSwitch();
rfReceiver->enableReceive(rfPin);
}
if (rfReceiver != 0 && rfPin == -1)
{
Serial.println("INIT: RF433 RX removed!");
rfReceiver->resetAvailable();
delete rfReceiver;
rfReceiver = 0;
}
}
success = true;
break;
}
case PLUGIN_ONCE_A_SECOND:
{
if (irReceiver != 0) break;
if (rfReceiver->available())
{
Serial.print("RF recieved");
int valuerf = rfReceiver->getReceivedValue();
if (valuerf == 0) {
Serial.print("Unknown encoding");
String log = F("RF Code Recieved: ");
log += String(valuerf);
log += " =Unknown encoding";
addLog(LOG_LEVEL_INFO, log);
} else {
Serial.print("Received ");
Serial.print( rfReceiver->getReceivedValue() );
Serial.print(" / ");
Serial.print( rfReceiver->getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( rfReceiver->getReceivedProtocol() );
UserVar[event->BaseVarIndex] = (valuerf & 0xFFFF);
UserVar[event->BaseVarIndex + 1] = ((valuerf >> 16) & 0xFFFF);
String log = F("RF Code Recieved: ");
log += String(valuerf);
addLog(LOG_LEVEL_INFO, log);
/*
Usage:
1=RFSEND
2=commando
3=repeat (if not set will use default settings)
4=bits (if not set will use default settings)
1 2 3 4
http://<ESP IP address>/control?cmd=RFSEND,blablacommando,10,24
Output this in logging:
*/
String url = String(Settings.Name) + "/control?cmd=RFSEND," + String(rfReceiver->getReceivedValue()) + ",1," + String(rfReceiver->getReceivedBitlength()) ;
String printString = F("For sending this command,");
addLog(LOG_LEVEL_INFO, printString);
printString = F("use URL: <a href=\"http://");
printString += url;
printString += F("\">http://");
printString += url;
printString += F("</a>");
addLog(LOG_LEVEL_INFO, printString);
sendData(event);
}
rfReceiver->resetAvailable();
}
success = true;
break;
}
}
return success;
}
But as said, it may be buggy! It works perfect for me on a Wemos D1 mini...

Re: rc-switch plugin
Posted: 19 Jan 2017, 16:44
by kniazio
You do not know how long I waited for this plugin

It works perfectly
I checked out the sockets
Kemot,
http://allegro.pl/3x-gniazdo-gniazdko-s ... 94168.html
Clarus
https://www.google.pl/search?q=gniazdka ... ikR01VM%3A
and wallswitches
https://pl.aliexpress.com/item/EU-Stand ... =200001056
Many, many thanks
Regards and Respect
Re: rc-switch plugin
Posted: 19 Jan 2017, 20:49
by data
Which receiver do you use?
Re: rc-switch plugin
Posted: 20 Jan 2017, 07:27
by kniazio
Re: rc-switch plugin
Posted: 20 Jan 2017, 07:44
by data
This is an RXB6 receiver. You can get the receiver module alone for about US$1.21 here:
http://s.click.aliexpress.com/e/IybEuny
I hope the next release will make use of the RSSI output available on v2.0 of this receiver:
viewtopic.php?f=11&t=2502
Re: rc-switch plugin
Posted: 20 Jan 2017, 08:47
by data
@s4nder
Thank you very much for these plugins. I hope they'll find their way into the regular build.
Works fine on both - R147_RC8 and R148
Re: rc-switch plugin
Posted: 24 Jan 2017, 10:26
by s4nder
No problem, glad i can contribute something back to the community.
There is only one annoying bug with my plugin; if you use the _P016_IR.ino plugin (IR recieve) on the same device the RF receiver 'receives' strange codes (that the IR receiver actually receives it seems...). But my code has a check for that. If someone is able to find a solution for that he/she would be the hero of the day!
Can someone post this to the development playground on git?
Re: rc-switch plugin
Posted: 26 Jan 2017, 14:17
by gaetandu80fr
Hello S4ander,
Thank you for sharing.
Is the plugin receiver compatible with DIO CHACON remote control (ref: 54760 / model: PBT-707)?
This remote uses NEXA / HOME EASY protocols
Cordially
s4nder wrote:I made a 2 plugins with RC-Switch, but did not find the time to test it or publish it. Here is the code:
_P112_RFTX.ino:
Code: Select all
//#######################################################################################################
//########################### Plugin 112: Output 433 MHZ - RF ###########################
//#######################################################################################################
/*
Version: 1.0
Description: use this script to send RF with a cheap FS1000A alike sender
Example of usage:
Learn codes via _P111_RF.ino plugin!
Needs: RCSwitch library
Tested on GPIO:14
Author: S4nder
Copyright: (c) 2015-2016 Sander Pleijers (s4nder)
License: MIT
License URI: http://en.wikipedia.org/wiki/MIT_License
Status : "Proof of concept"
Usage:
1=RFSEND
2=commando
3=repeat (if not set will use default settings)
4=bits (if not set will use default settings)
1 2 3 4
http://<ESP IP address>/control?cmd=rfsend,blablacommando,10,24
This program was developed independently and it is not supported in any way.
*/
#include <RCSwitch.h>
RCSwitch *rcswitchSender;
#define PLUGIN_112
#define PLUGIN_ID_112 112
#define PLUGIN_NAME_112 "RF Transmit - FS1000A alike sender"
unsigned long Plugin_112_Repeat;
unsigned long Plugin_112_Bits;
unsigned long Plugin_112_Pulse;
boolean Plugin_112(byte function, struct EventStruct *event, String& string)
{
boolean success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
Device[++deviceCount].Number = PLUGIN_ID_112;
Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
Device[deviceCount].SendDataOption = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_112);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
break;
}
case PLUGIN_WEBFORM_LOAD:
{
char tmpString[128];
Plugin_112_Bits = ExtraTaskSettings.TaskDevicePluginConfigLong[0];
if (Plugin_112_Bits < 100) Plugin_112_Bits = 24;
Plugin_112_Pulse = ExtraTaskSettings.TaskDevicePluginConfigLong[1];
if (Plugin_112_Pulse > 1000) Plugin_112_Pulse = 165;
Plugin_112_Repeat = ExtraTaskSettings.TaskDevicePluginConfigLong[2];
if (Plugin_112_Repeat > 10) Plugin_112_Pulse = 1;
sprintf_P(tmpString, PSTR("<TR><TD>Bits (default=24):<TD><input type='text' name='plugin_112_bits' value='%u'>"), Plugin_112_Bits);
string += tmpString;
sprintf_P(tmpString, PSTR("<TR><TD>Pulselength (default=165):<TD><input type='text' name='plugin_112_pulse' value='%u'>"), Plugin_112_Pulse);
string += tmpString;
sprintf_P(tmpString, PSTR("<TR><TD>Repeat (default=1):<TD><input type='text' name='plugin_112_repeat' value='%u'>"), Plugin_112_Repeat);
string += tmpString;
success = true;
break;
}
case PLUGIN_WEBFORM_SAVE:
{
String plugin1 = WebServer.arg("plugin_112_bits");
Plugin_112_Bits = plugin1.toInt();
String plugin2 = WebServer.arg("plugin_112_pulse");
Plugin_112_Pulse = plugin2.toInt();
String plugin3 = WebServer.arg("plugin_112_repeat");
Plugin_112_Repeat = plugin3.toInt();
if (Plugin_112_Bits > 100) Plugin_112_Bits = 24;
if (Plugin_112_Pulse > 1000) Plugin_112_Pulse = 165;
if (Plugin_112_Pulse > 10) Plugin_112_Repeat = 1;
ExtraTaskSettings.TaskDevicePluginConfigLong[0] = Plugin_112_Bits;
ExtraTaskSettings.TaskDevicePluginConfigLong[1] = Plugin_112_Pulse;
ExtraTaskSettings.TaskDevicePluginConfigLong[2] = Plugin_112_Repeat;
SaveTaskSettings(event->TaskIndex);
success = true;
break;
}
case PLUGIN_WEBFORM_SHOW_CONFIG:
{
string += String(ExtraTaskSettings.TaskDevicePluginConfigLong[0]);
string += String(ExtraTaskSettings.TaskDevicePluginConfigLong[1]);
string += String(ExtraTaskSettings.TaskDevicePluginConfigLong[2]);
success = true;
break;
}
case PLUGIN_INIT:
{
LoadTaskSettings(event->TaskIndex);
Plugin_112_Bits = ExtraTaskSettings.TaskDevicePluginConfigLong[0];
Plugin_112_Pulse = ExtraTaskSettings.TaskDevicePluginConfigLong[1];
Plugin_112_Repeat = ExtraTaskSettings.TaskDevicePluginConfigLong[2];
//if (Plugin_112_Bits > 100) Plugin_112_Bits = 24;
if (Plugin_112_Pulse > 1000) Plugin_112_Pulse = 165;
//if (Plugin_112_Repeat > 10) Plugin_112_Repeat = 1;
int txPin = Settings.TaskDevicePin1[event->TaskIndex];
if (rcswitchSender == 0 && txPin != -1)
{
addLog(LOG_LEVEL_INFO, "INIT: RF433 TX created!");
//rcswitchSender = new RCSwitch(txPin);
rcswitchSender = new RCSwitch();
rcswitchSender->enableTransmit(txPin);
rcswitchSender->setPulseLength(Plugin_112_Pulse);
}
if (rcswitchSender != 0 && txPin == -1)
{
addLog(LOG_LEVEL_INFO, "INIT: RF433 TX REMOVED!");
delete rcswitchSender;
rcswitchSender = 0;
}
success = true;
break;
}
case PLUGIN_TEN_PER_SECOND:
{
}
case PLUGIN_WRITE:
{
String Plugin_112_Result = "";
unsigned int Plugin_112_DeviceNr = 0;
unsigned int Plugin_112_Value = 0;
char command[80]; command[0] = 0;
char TmpStr1[80]; TmpStr1[0] = 0;
string.toCharArray(command, 80);
String tmpString = string;
int argIndex = tmpString.indexOf(',');
if (argIndex) tmpString = tmpString.substring(0, argIndex);
if (GetArgv(command, TmpStr1, 2)) Plugin_112_Value = str2int(TmpStr1);
if (GetArgv(command, TmpStr1, 3)) Plugin_112_Repeat = str2int(TmpStr1);
if (GetArgv(command, TmpStr1, 4)) Plugin_112_Bits = str2int(TmpStr1);
if (Plugin_112_Repeat > 10) Plugin_112_Repeat = 1;
if (Plugin_112_Bits > 100) Plugin_112_Bits = 24;
if (tmpString.equalsIgnoreCase("RFSEND") && rcswitchSender != 0 && Plugin_112_Bits != 0)
{
Serial.println("RFSEND");
success = true;
Plugin_112_Result = "Unknown RF command or structure !!!";
for (int i = 0; i <= Plugin_112_Repeat; i++) {
rcswitchSender->send(Plugin_112_Value, Plugin_112_Bits);
//delay(1000);
}
addLog(LOG_LEVEL_INFO, "RF Code Sent: " + String(Plugin_112_Value));
if (printToWeb)
{
String url = String(Settings.Name) + "/control?cmd=" + string;
printWebString += F("RCSwitch Code Sent!");
printWebString += F("<BR>Value: ");
printWebString += String(Plugin_112_Value);
printWebString += F("<BR>Repeats: ");
printWebString += String(Plugin_112_Repeat);
printWebString += F("<BR>Bits: ");
printWebString += String(Plugin_112_Bits);
printWebString += F("<BR>Pulselength: ");
printWebString += String(Plugin_112_Pulse);
printWebString += F("<BR><BR>");
printWebString += F("<BR>Use URL: <a href=\"http://");
printWebString += url;
printWebString += F("\">http://");
printWebString += url;
printWebString += F("</a>");
}
}
break;
}
}
return success;
}
And _P111_RF.ino:
Code: Select all
//#######################################################################################################
//#################################### Plugin 111: Input RF #############################################
//#######################################################################################################
/*
Version: 1.1
Description: use this script to recieve RF with a cheap MX-05V alike reciever
Author: S4nder
Copyright: (c) 2015-2016 Sander Pleijers (s4nder)
License: MIT
License URI: http://en.wikipedia.org/wiki/MIT_License
Status : "Proof of concept"
This program was developed independently and it is not supported in any way.
*/
#include <RCSwitch.h>
RCSwitch *rfReceiver;
#define PLUGIN_111
#define PLUGIN_ID_111 111
#define PLUGIN_NAME_111 "RF Recieve - MX-05V alike reciever"
#define PLUGIN_ValueNAME1_111 "RF"
boolean Plugin_111(byte function, struct EventStruct *event, String& string)
{
boolean success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
Device[++deviceCount].Number = PLUGIN_ID_111;
Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
Device[deviceCount].VType = SENSOR_TYPE_LONG;
Device[deviceCount].Ports = 0;
Device[deviceCount].InverseLogicOption = false;
Device[deviceCount].FormulaOption = false;
Device[deviceCount].ValueCount = 1;
Device[deviceCount].SendDataOption = true;
Device[deviceCount].TimerOption = false;
Device[deviceCount].GlobalSyncOption = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_111);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_ValueNAME1_111));
break;
}
case PLUGIN_INIT:
{
int rfPin = Settings.TaskDevicePin1[event->TaskIndex];
//Serial.println(String(rfPin));
if (irReceiver != 0) {
String log = F("BUG: Cannot use IR reciever and RF reciever at the same time!");
Serial.print(log);
addLog(LOG_LEVEL_INFO, log);
delete rfReceiver;
rfReceiver = 0;
} else {
if (rfPin != -1)
{
Serial.println("INIT: RF433 RX created!");
rfReceiver = new RCSwitch();
rfReceiver->enableReceive(rfPin);
}
if (rfReceiver != 0 && rfPin == -1)
{
Serial.println("INIT: RF433 RX removed!");
rfReceiver->resetAvailable();
delete rfReceiver;
rfReceiver = 0;
}
}
success = true;
break;
}
case PLUGIN_ONCE_A_SECOND:
{
if (irReceiver != 0) break;
if (rfReceiver->available())
{
Serial.print("RF recieved");
int valuerf = rfReceiver->getReceivedValue();
if (valuerf == 0) {
Serial.print("Unknown encoding");
String log = F("RF Code Recieved: ");
log += String(valuerf);
log += " =Unknown encoding";
addLog(LOG_LEVEL_INFO, log);
} else {
Serial.print("Received ");
Serial.print( rfReceiver->getReceivedValue() );
Serial.print(" / ");
Serial.print( rfReceiver->getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( rfReceiver->getReceivedProtocol() );
UserVar[event->BaseVarIndex] = (valuerf & 0xFFFF);
UserVar[event->BaseVarIndex + 1] = ((valuerf >> 16) & 0xFFFF);
String log = F("RF Code Recieved: ");
log += String(valuerf);
addLog(LOG_LEVEL_INFO, log);
/*
Usage:
1=RFSEND
2=commando
3=repeat (if not set will use default settings)
4=bits (if not set will use default settings)
1 2 3 4
http://<ESP IP address>/control?cmd=RFSEND,blablacommando,10,24
Output this in logging:
*/
String url = String(Settings.Name) + "/control?cmd=RFSEND," + String(rfReceiver->getReceivedValue()) + ",1," + String(rfReceiver->getReceivedBitlength()) ;
String printString = F("For sending this command,");
addLog(LOG_LEVEL_INFO, printString);
printString = F("use URL: <a href=\"http://");
printString += url;
printString += F("\">http://");
printString += url;
printString += F("</a>");
addLog(LOG_LEVEL_INFO, printString);
sendData(event);
}
rfReceiver->resetAvailable();
}
success = true;
break;
}
}
return success;
}
But as said, it may be buggy! It works perfect for me on a Wemos D1 mini...

Re: rc-switch plugin
Posted: 28 Jan 2017, 14:52
by s4nder
Good question, I think that should work but i cannot test it. NEXA / HOME EASY is a quite simple protocol but unfortunately I cannot find a 'compatibility'-list for the rc-switch library.
Maybe someone has already done a fork for it:
https://433mhz.codeplex.com/SourceControl/latest
For me at home I can control quite some devices. Even a 433mhz doorbel, and the older KAKU switches in the garden from my neighbors....

Re: rc-switch plugin
Posted: 28 Jan 2017, 16:13
by kniazio
Re: rc-switch plugin
Posted: 01 Feb 2017, 12:10
by gaetandu80fr
thank you for your reply
This plug-in uses a modified version of NexaCtrl library that no longer supports Home Easy
And this plug-in works only in emission off I have indicated that I needed the reception
Re: rc-switch plugin
Posted: 04 Feb 2017, 21:19
by Raimund
Re: rc-switch plugin
Posted: 24 Feb 2017, 09:02
by s4nder
Can someone post my plugins to the Github Plugin playground?:
https://github.com/letscontrolit/ESPEas ... Playground
No clue how to do this...

Maybe this way the plugins will find their way to the final builds.
By the way, i also use these modules now:
https://www.aliexpress.com/item/433-Mhz ... 52611.html they work fine and are nice and small.
Re: rc-switch plugin
Posted: 24 Feb 2017, 17:41
by ipua
Hi s4nder,
Thanks for yur plugin!
I am using it and it workrks great!
Also I am using modules from exactly same seller - they working fine.
Re: rc-switch plugin
Posted: 25 Feb 2017, 21:28
by oisisi
For my understanding, under 'commando' it expects the raw binary sequence? Higher level command from rc-switch (like the ones mentioned
here) are not supported, right?
Re: rc-switch plugin
Posted: 28 Feb 2017, 10:10
by s4nder
oisisi wrote:For my understanding, under 'commando' it expects the raw binary sequence? Higher level command from rc-switch (like the ones mentioned
here) are not supported, right?
It uses a 8 digit code that is received with the reciever plugin. Then you can use it like this:
http://*yourwemos*/control?cmd=RFSEND,10939202,2
Where '10939202' should be the code u see in the esp-easy logging, from the reciever plugin. The plugins i made do not have support for tri-state (.sendTriState) or other commands (.switchOn) yet, it uses only .send(). But in most cases for me, the 8 digit codes do somehow work here...
Re: rc-switch plugin
Posted: 28 Feb 2017, 14:59
by oisisi
Thanks for the reply. I now hacked together my own standalone sketch. Regrettably, I lack the skills to work it into a plugin.
Re: rc-switch plugin
Posted: 28 Feb 2017, 21:36
by data
Post it here, we might try to create a plugin out of it...
Re: rc-switch plugin
Posted: 01 Mar 2017, 13:22
by oisisi
data wrote:Post it here, we might try to create a plugin out of it...
I was afraid this would pop up. It is currently very ugly, I'll clean it up a bit and post it.
Re: rc-switch plugin
Posted: 01 Mar 2017, 21:00
by oisisi
data wrote:Post it here, we might try to create a plugin out of it...
Well you were warned. Here it is. It works with sockets that have dip switches for selecting the code and ones with two rotary code selectors.
Code: Select all
/*
MQTT -> ESP8266 -> RC controlled socket
parsing JSON formatted topic and turns 433.92 MHz
radio controlled sockets on or off using library RCSwitch
two protocols are defined:
prot 1 uses two five-digit binary codes
prot 2 uses two int values
The topic of choice is "home/action/rfbridge"
Command line examples as published using mosquitto:
mosquitto_pub -t home/action/rfbridge -m "{prot: 1, state: 1, ident: 10000, unit: 10000}"
mosquitto_pub -t home/action/rfbridge -m "{prot: 2, state: 1, ident: 2, unit: 4}"
The JSON library isn't to picky about properly formatted objects. From Node_RED I would send
as payload {"prot": 2, "state": 1, "ident": 2, "unit": 4}
-- oisisi
*/
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <RCSwitch.h>
#include <ArduinoJson.h>
// #define DEBUG
const char* ssid = "....";
const char* password = "....";
const char* mqtt_server = "....";
WiFiClient espClient;
PubSubClient client(espClient);
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(115200);
setup_wifi();
client.setServer(mqtt_server, 1883);
client.setCallback(callback);
// sender's data in pin is connected to WEMOS pin D6
mySwitch.enableTransmit(D6);
}
void setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
// MQTT message received callback
void callback(char* topic, byte* payload, unsigned int length) {
// prep JSON buffer
StaticJsonBuffer<90> jsonBuffer;
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
Serial.println("");
Serial.println("length: " + String(length));
for (int i = 0; i < length; i++) {
Serial.print((char)payload[i]);
}
Serial.println();
// copy MQTT payload into JSON object
JsonObject& root = jsonBuffer.parseObject(payload);
if (!root.success()) {
Serial.println("parseObject() failed");
return;
}
// JSON values -> vars
// state 1 is on, 0 is off
int swstate = root["state"];
// store protocol
int swprot = root["prot"];
// reject if protocol declaration is missing/wrong
if (swprot != 2 && swprot != 1) {
Serial.print(swprot);
Serial.println(" no protocol defined");
return;
}
// if switch should be turned on
if ( swstate == 1 ) {
// if protocol is of type 2
if ( swprot == 2) {
// store values as INTs
int swunit = root["unit"];
int swident = root["ident"];
// pass values to RCSwitch
mySwitch.switchOn(swunit, swident);
}
// if protocol is of type 1
if ( swprot == 1) {
// store values as const char*
const char* swunit = root["unit"];
const char* swident = root["ident"];
// pass values to RCSwitch
mySwitch.switchOn(swunit, swident);
}
// everything below this is redundant or debug stuff
// if switch should be turned off
} else {
if ( swprot == 2) {
int swunit = root["unit"];
int swident = root["ident"];
mySwitch.switchOff(swunit, swident);
}
if ( swprot == 1) {
const char* swunit = root["unit"];
const char* swident = root["ident"];
mySwitch.switchOff(swunit, swident);
}
}
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
if (client.connect("ESP8266Client")) {
Serial.println("connected");
// this is the topic we're listening to
client.subscribe("home/action/rfbridge");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
yield();
}
Re: rc-switch plugin
Posted: 07 Mar 2017, 17:41
by s4nder
oisisi wrote: ↑01 Mar 2017, 21:00
data wrote:Post it here, we might try to create a plugin out of it...
Well you were warned. Here it is. It works with sockets that have dip switches for selecting the code and ones with two rotary code selectors.
...........
Ill try to see if I can get any logic in the plugin to support dip switches. But for now, my time is limited.
Does anyone know how to publish scripts to the Github repository (or playground or wherever)? I always get this message when syncing: 'Sync failed to push local changes, it seems you do not have permission to push your changes to this repository'...
Any developers here willing to share some knowledge on this?
Re: rc-switch plugin
Posted: 08 Mar 2017, 12:52
by paxi
I'm not very versed with github but generally you fork into your own repo online, submit your commit(s) to that and then file a pull request against the original repo.
Re: rc-switch plugin
Posted: 22 Mar 2017, 21:31
by Minims
Hi s4nder,
Thx for code, it works well for me.
I've made a pull request on ESPEasyPluginPlayground to integrate your plugins.
Re: rc-switch plugin
Posted: 23 Mar 2017, 19:01
by Minims
Re: rc-switch plugin
Posted: 23 Mar 2017, 22:51
by s4nder
Strange, I tried to upload them a few days ago and the files where there for a few hours. Now i still can't find them. Why are they removed?

Re: rc-switch plugin
Posted: 14 Apr 2017, 14:48
by ipua
s4nder,
First of all thanks for your RF Tx/Rx plugins - works great!
Can you add to your
Plugin 111: Input RF option to receive data from Livolo switches based on
this arduino scetch?
I am using OpenHab and many of rc-switch compatible devices plus
Livolo switches in my house, so it will be very convinient to control them.
As of today I am using arduino connected to serial port of ESP for this purpose.
I think that many other ESPEasy users will be happy to use this option.
Thanks in advance,
Igor
Re: rc-switch plugin
Posted: 21 Apr 2017, 17:56
by annakin
When I try to compile u plugin i have error:
Code: Select all
'irReceiver' was not declared in this scope
on this line:
Re: rc-switch plugin
Posted: 24 Apr 2017, 09:56
by s4nder
@ipua; I think it would be better if someone would create a new plugin for that. This plugin only supports the RC-switch library.
@annakin; Also use the _P035_IRTX.ino and _P016_IR.ino plugins, then it will work.
I tried to make a newer version that can control Tristate/ Dip Switch/ Intertechno swithes. But, I do not have any hardware to test this, so can someone test this for me?
You can view the latest plugins on my github page:
https://github.com/sanderpleijers/EspEasy-RC-Switch
Re: rc-switch plugin
Posted: 24 Apr 2017, 11:16
by psy0rz
We also have another rcswitch plugin on the playground? anyone knows whats going on with that?
https://github.com/letscontrolit/ESPEas ... -Switch-TX
Re: rc-switch plugin
Posted: 25 Apr 2017, 09:41
by s4nder
@psy0rz; verry good question, I did not see that until now! It is not of my making... Code looks a wee bit shorter that what I stamped together...
I cannot say that my version is better or not, I barely have time to code everything... Ill leave that to you pro-coders

Re: rc-switch plugin
Posted: 15 May 2017, 08:27
by Mics78
Hi s4nder!
Thank you for your plugin.
Unfortunately, ESPEasy crashes with it. I think it is rcswitch issues. I use version 2.52.
Could you send me link for library you use?
Re: rc-switch plugin
Posted: 15 May 2017, 13:06
by trs
I use this RC-Switch plugin from playground to send RF commands to my DIP-coded RF power outlets, works great!
https://github.com/letscontrolit/ESPEas ... -Switch-TX
it can send
- binary code with any length ("RC,SEND=000000000001010100010001")
- tristate code with any length ("RC,SEND=00000FFF0F0F")
- 24 bit decimal code ("RC,SENDDEC=5393")
- binary code for simple 10 DIP switch devices ("RC,ON=1010100010")
- switch position for simple 2 rotary switch devices ("RC,ON=42")
- switch position for Intertechno devices ("RC,ON=a42")
[/list]
Re: rc-switch plugin
Posted: 16 May 2017, 15:10
by s4nder
@Mics78; I used rc-switch 2.6.2 (straight from github) together with the ESP-easy mega dev8 release. That works for me...
@trs: Your code looks great, my own code is kinda messy with conversions/variables but for me it works. What I really use from my own code is that I can save the pulselength or repeats in the settings so you don't have to worry about that anymore.
It seems to me that lots of people want this functionality in ESP-Easy, can we somehow kindly inform the developers to include these plug-ins in upcoming ESP easy (mega?) releases?
Re: rc-switch plugin
Posted: 16 May 2017, 17:29
by toffel969
s4nder wrote: ↑16 May 2017, 15:10
@Mics78; I used rc-switch 2.6.2 (straight from github) together with the ESP-easy mega dev8 release. That works for me...
@trs: Your code looks great, my own code is kinda messy with conversions/variables but for me it works. What I really use from my own code is that I can save the pulselength or repeats in the settings so you don't have to worry about that anymore.
It seems to me that lots of people want this functionality in ESP-Easy, can we somehow kindly inform the developers to include these plug-ins in upcoming ESP easy (mega?) releases?
+1
Re: rc-switch plugin
Posted: 23 May 2017, 19:40
by Mics78
Thank you.
I try to use rc-switch 2.6.2 with Arduino IDE 1.8.1 and 1.8.2 and receive an compilation's error:
C:/users/michael/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\Michael\AppData\Local\Temp\arduino_build_252850/ESPEasy.ino.elf section `.text' will not fit in region `iram1_0_seg'
collect2.exe: error: ld returned 1 exit status
If I return 2.5.2 version I have no error compilation but I have reboots my device...
I need receiver functionality in ESPEasy...
Re: rc-switch plugin
Posted: 31 May 2017, 16:19
by s4nder
@Mics78; remove some un-needed plugins from the ESP-Easy source. The error you get means that the firmware is too big...
Re: rc-switch plugin
Posted: 02 Jun 2017, 11:35
by ManS-H
Hello All,
I've a question. Can i use this plugin for a stand alone version of Vhome Smart Home RF433MHZ Switch Shape Smart Remote Control in combination with ESP Easy, RfxCom and Domoticz?
Or did i need extra hardware for this unit?
https://nl.aliexpress.com/item/Vhome-Sm ... Title=true

- Vhome.jpg (22.88 KiB) Viewed 67738 times
Re: rc-switch plugin
Posted: 05 Jun 2017, 18:35
by oisisi
I am now using "Plugin 144: RC-Switch TX"
from the plugin playground together with the current Mega release. It works nicely with my dip switch and rotary type sockets. Regrettably, I can't get it to work with MQTT so I have to to issue get requests (e.g. http://192.168.4.151/control?cmd=RC,ON=1000010000,5).
If anyone knows the proper topic and syntax to publish the command I would be even more happy. I've tried all thinkable variations of topics and payloads (e.g. 'mosquitto_pub -t "home/esp014/cmd" -m "RC,ON=1000010000,5"' while the module is subscribed to "home/esp/#") but nothing happens.
Re: rc-switch plugin
Posted: 06 Jun 2017, 08:18
by ipua
I am using openhab and items file contains:
Code: Select all
mqtt=">[broker:/ESP1/cmd:command:on:rfsend,1111111],>[broker:/ESP1/cmd:command:off:rfsend,22222222]
In your case - try 'mosquitto_pub -t "home/esp014/cmd" -m "rfsend,1000010000,5"
Hope this helps..
Re: rc-switch plugin
Posted: 07 Jun 2017, 19:11
by oisisi
ipua wrote: ↑06 Jun 2017, 08:18
In your case - try 'mosquitto_pub -t "home/esp014/cmd" -m "rfsend,1000010000,5"
Hope this helps..
Regrettably this and variants thereof don't work. My device is named "rcswitch" so I tried `mosquitto_pub -t "home/esp014/cmd" -m "rcswitch,ON=1000010000,5"` - no dice. I think a command beginning with 'rc' is expected:
Code: Select all
case PLUGIN_WRITE:
{
String command = parseString(string, 1);
if (command == F("rc"))
{
String param;
byte paramIdx = 2;
string.replace(" ", " ");
string.replace(" =", "=");
string.replace("= ", "=");
I guess I have to stick to GET requests. :(
Re: rc-switch plugin
Posted: 10 Jun 2017, 10:56
by JKD
All command names are independent of the task names. To trigger the RCswitch you have to use the command "RC".
-> "RC,ON=1000010000,5" should work
Note: commands are only be executed on enabled tasks.
Re: rc-switch plugin
Posted: 13 Jun 2017, 17:57
by oisisi
JKD wrote: ↑10 Jun 2017, 10:56
"RC,ON=1000010000,5" should work
Thanks for the advice. Regrettably it doesn't work. I can see that the payload arrives in the log:
Code: Select all
mosquitto_pub -t "home/esp014/cmd" -m "RC,ON=1000010000,5"
shows up in the log as
Code: Select all
375247309 : MQTT : Topic: home/esp014/cmd
375247309 : MQTT : Payload: RC,ON=1000010000,5
But nothing happens.
While the get request
Code: Select all
wget -qO- "http://192.168.178.151/control?cmd=RC,ON=1000010000,5"
appears in the log as
Code: Select all
375429728 : on=1000010000
375429728 : ON
375429728 : 1000010000
375430269 : 5
and the switch is toggled.