Hi,
I am using UDP controller to send data to influxdb. This works well for single valued sensors like DS18B20. However for multi value sensors like BME280 only the first value is transfered. Looking at the code for the controller (C010.ino) I conclude that for each element several txt entries are created. However these are not processed. As a workaround I creted a separate element for each value, This seems to work for me, but I am not sure if it is consistent with the original ideas...
The UDP controller worked fine with older versions (I assume my last version was from June '18)
Stefan
Generic UDP Controller with multi value sensors problem
Moderators: grovkillen, Stuntteam, TD-er
Re: Generic UDP Controller with multi value sensors problem
Could you post a part of your changes?
I did change a lot recently regarding the controllers, so it may very well be there is some bug left.
So please help me here to fix it
I did change a lot recently regarding the controllers, so it may very well be there is some bug left.
So please help me here to fix it
Re: Generic UDP Controller with multi value sensors problem
Sure.
here is what I did:
To sum up my changes:
Stefan
here is what I did:
Code: Select all
case CPLUGIN_PROTOCOL_SEND:
{
byte valueCount = getValueCountFromSensorType(event->sensorType);
C010_queue_element element(event, 1);
if (ExtraTaskSettings.TaskDeviceValueNames[0][0] == 0)
PluginCall(PLUGIN_GET_DEVICEVALUENAMES, event, dummyString);
ControllerSettingsStruct ControllerSettings;
LoadControllerSettings(event->ControllerIndex, (byte*)&ControllerSettings, sizeof(ControllerSettings));
for (byte x = 0; x < valueCount; x++)
{
bool isvalid;
String formattedValue = formatUserVar(event, x, isvalid);
if (isvalid) {
element.txt[0] = "";
element.txt[0] += ControllerSettings.Publish;
parseControllerVariables(element.txt[0], event, false);
element.txt[0].replace(F("%valname%"), ExtraTaskSettings.TaskDeviceValueNames[x]);
element.txt[0].replace(F("%value%"), formattedValue);
if (loglevelActiveFor(LOG_LEVEL_DEBUG_MORE)) {
char log[80];
element.txt[0].toCharArray(log, 80);
addLog(LOG_LEVEL_DEBUG_MORE, log);
}
}
success = C010_DelayHandler.addToQueue(element);
scheduleNextDelayQueue(TIMER_C010_DELAY_QUEUE, C010_DelayHandler.getNextScheduleTime());
}
break;
}
- only write to element.txt[0] instead of element.txt[x]
- put addToQueue and scheduleNextDelayQueue in the loop
Stefan
Who is online
Users browsing this forum: No registered users and 49 guests