Hi, I'm having a problem when I use an xml file with several OBIS codes to perform readouts with the xmlClient. Sometimes the responses get mixed up.
These are the OBIS codes I'm reading
Sometimes one value doesn't get sent back, for example active energy, then the other results get mixed up when writing to the database.
This is the part of my code which handles the replies
switch (action_name)
{
// if energia activa
case "01000F0800FF":
cmd_readouts.CommandText = "INSERT INTO readouts (active_energy, nis) VALUES (@energy, @nis)";
break;
// if energia reactiva
case "0100050800FF":
cmd_readouts.CommandText = "UPDATE readouts SET reactive_energy=@energy, status=@status WHERE date IN (SELECT date FROM readouts WHERE nis=@nis ORDER BY date DESC LIMIT 1)";
break;
// if cierre del mes
case "0100010801FF":
cmd_readouts.CommandText = "UPDATE readouts SET sum_li_active_power=@energy, status=@status WHERE date IN (SELECT date FROM readouts WHERE nis=@nis ORDER BY date DESC LIMIT 1)";
break;
default:
throw new ArgumentException("SQL request not supported!");
}