Iv been using send to HTTP to send all 8 variables to Thingspeak (TS). Iv noticed there are a quite a few occasions when the data does not get to TS even though pinging TS says it is OK. My send data rate is every 30S. I just started to use the TS controller BUT it seems you cannot send all 8 data fields back in one go from 2 quad dummy variables. So i am attempting to make my own Octal dummy (8 variables).
Although this seems to work and will update all 8 fields on TS in one send with a MUCH better error rate than sendtoHTTP there are issues.
1. I update the 8 values in rules with values 10 to 80 (for test purposes) using the following code. Looking at debug window and the devices window the values are correct and correctly sent to TS. The problem is the variable names cannot be correctly set when i edit the device, it seems that the last 4 variables can have names but not the first 4 (not shown in the screen shot).
Code: Select all
TaskValueSet 3,1,10
TaskValueSet 3,2,20
TaskValueSet 3,3,30
TaskValueSet 3,4,40
TaskValueSet 3,5,50
TaskValueSet 3,6,60
TaskValueSet 3,7,70
TaskValueSet 3,8,80
Code: Select all
#ifdef USES_P130
//#######################################################################################################
//#################################### Plugin 130: Octal Dummy ##########################################
//#######################################################################################################
#define PLUGIN_130
#define PLUGIN_ID_130 130
#define PLUGIN_NAME_130 "OctalDummy Device"
#define PLUGIN_VALUENAME1_8 "Octal Dummy"
boolean Plugin_130(byte function, struct EventStruct *event, String& string)
{
boolean success = false;
switch (function)
{
case PLUGIN_DEVICE_ADD:
{
Device[++deviceCount].Number = PLUGIN_ID_130;
Device[deviceCount].Type = DEVICE_TYPE_DUMMY;
Device[deviceCount].VType = SENSOR_TYPE_SINGLE;
Device[deviceCount].Ports = 0;
Device[deviceCount].PullUpOption = false;
Device[deviceCount].InverseLogicOption = false;
Device[deviceCount].FormulaOption = false;
Device[deviceCount].DecimalsOnly = true;
Device[deviceCount].ValueCount = 8;
Device[deviceCount].SendDataOption = true;
Device[deviceCount].TimerOption = true;
Device[deviceCount].GlobalSyncOption = true;
break;
}
case PLUGIN_GET_DEVICENAME:
{
string = F(PLUGIN_NAME_130);
break;
}
case PLUGIN_GET_DEVICEVALUENAMES:
{
strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_8));
break;
}
case PLUGIN_WEBFORM_LOAD:
{
byte choice = PCONFIG(0);
String options[1]; //RAE
options[0] = F("SENSOR_TYPE_OCTAL"); //RAE
int optionValues[11]; //RAE
optionValues[0] = SENSOR_TYPE_OCTAL; //RAE
addFormSelector(F("Simulate Data Type"), F("p130_sensortype"), 1, options, optionValues, choice ); //RAE
success = true;
break;
}
case PLUGIN_WEBFORM_SAVE:
{
PCONFIG(0) = getFormItemInt(F("p130_sensortype"));
success = true;
break;
}
case PLUGIN_READ:
{
event->sensorType = PCONFIG(0);
for (byte x=0; x<8;x++) //RAE
{
String log = F("Dummy: value ");
log += x+1;
log += F(": ");
log += UserVar[event->BaseVarIndex+x];
addLog(LOG_LEVEL_INFO,log);
}
success = true;
break;
}
}
return success;
}
#endif // USES_P130
Change in Cplugin_sensortype_helper.ino (added SENSOR_TYPE_OCTAL in switch statement)
Code: Select all
switch (sensorType)
{
case SENSOR_TYPE_NONE:
return 0;
case SENSOR_TYPE_SINGLE: // single value sensor, used for Dallas, BH1750, etc
case SENSOR_TYPE_SWITCH:
case SENSOR_TYPE_DIMMER:
return 1;
case SENSOR_TYPE_LONG: // single LONG value, stored in two floats (rfid tags)
return 1;
case SENSOR_TYPE_TEMP_HUM:
case SENSOR_TYPE_TEMP_BARO:
case SENSOR_TYPE_DUAL:
return 2;
case SENSOR_TYPE_TEMP_HUM_BARO:
case SENSOR_TYPE_TEMP_EMPTY_BARO: // Values 1 and 3 will contain data.
case SENSOR_TYPE_TRIPLE:
case SENSOR_TYPE_WIND:
return 3;
case SENSOR_TYPE_QUAD:
return 4;
case SENSOR_TYPE_OCTAL: //RAE
return 8;
}
Code: Select all
#define SENSOR_TYPE_OCTAL 30 //RAE
Ray