Before commenting read Forum rules
Don't comment the topic if you have a new question.
You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.
Before commenting read Forum rules
Don't comment the topic if you have a new question.
You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.
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
xml file link https://drive.google.com/file/d/18VCavxm5R-XO7zV9rFRxfhqw2EAbWBUd/view?…
<?xml version="1.0" encoding="utf-8"?>
<Messages>
<GetRequest>
<GetRequestNormal>
<InvokeIdAndPriority Value="193" />
<AttributeDescriptor>
<!--REGISTER-->
<ClassId Value="3" />
<!--1.0.15.8.0.255-->
<InstanceId Value="01000F0800FF" />
<AttributeId Value="2" />
</AttributeDescriptor>
</GetRequestNormal>
</GetRequest>
<GetRequest>
<GetRequestNormal>
<InvokeIdAndPriority Value="193" />
<AttributeDescriptor>
<!--REGISTER-->
<ClassId Value="3" />
<!--1.0.5.8.0.255-->
<InstanceId Value="0100050800FF" />
<AttributeId Value="2" />
</AttributeDescriptor>
</GetRequestNormal>
</GetRequest>
<GetRequest>
<GetRequestNormal>
<InvokeIdAndPriority Value="193" />
<AttributeDescriptor>
<!--REGISTER-->
<ClassId Value="3" />
<!-- 1.0.1.8.1.255 -->
<InstanceId Value="0100010801FF" />
<AttributeId Value="2" />
</AttributeDescriptor>
</GetRequestNormal>
</GetRequest>
</Messages>
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!");
}
I also added the complete code which handles the reply in this link:
https://drive.google.com/file/d/1limqLA8M5e-VCxb1OLZuEAMePYIRHl9q/view?…