How can i make a code for display reading on lcd of energy meter by OBIS Code using Nodemcu. Can you suggest or link to me for making code for Secure meter?
The example reads the clock object. Find //Read clock.
It also prints date and time for the serial port using GXTRACE.
You need to add register objects in the same way as the clock object has been added.
The problem at the moment is that one of your settings is different than the meter expects.
Try to connect with GXDLMSDirector for your meter. It will help you to get a better idea of DLMS meters.
Thanks sir for reply. My question is not that use gxtrace or com_AllObject. My question is that what should i write read value in gxtrace or com_retAllObject and How should i write read value in gxtrace.?
for example, Can i write syntax in void loop() in Arduindo in given below-
ret = gxtrace("1.0.99.1.0.255") or not? please tell me syntax to read value of register and clock in void loop()?
gxtrace is send to write a trace. You don't use it for the communication. You can think that gxtrace equals Console.WriteLine. It's used to print the value, not for the communication.
Check this. It will read the date and time from the clock object and then write the content of the clock object for the meter.
Thanks for replying sir, How can i read value of Register and Extended Register in void loop() function in Arduino? What is syntax of Register and Extended register in void loop() function?
Thank you so much for replying sir . How can i find InvocationCounter for Secure Meter?
Please tell me about InvocationCounter for Secure meter? How can I find it and What is role of Invocation Counter in DLMS Meter?
I am very happy to hear for reply sir , thank you so much sir. If Some meter don't use Invocation Counter then What should i write in " ret = com_readAllObjects("0.0.43.1.0.255") " in the void loop()
Thanks for replying sir. I have found new error in NodeMCU Board in Arduino IDE when clock and register define in void loop() function in given below. How can I solve this sir?
Arduino: 1.8.18 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Thank you so much sir. It is working perfectly and i did make it Global Variable char* data = NULL;
I have some question now that if i want to read more values of Register for example reg2, reg3, reg4 and reg5 etc. So what will syntax be written in void loop() function for reg2,reg3,reg4 etc??
Thanks for reply sir. I am receiving this error again after convert object to string function obj_toString() in void loop() function in arduino ide in given below. Where am i going wrong ? Please tell me real solution.
Thanks for replying sir. I am very happy that you are guiding well sir. I am attaching code of void loop() function of client.ino in given below - and please tell me this is Right or Wrong?
void loop()
{
int ret;
// Read the clock
gxClock clock1;
if (millis() - runTime > 5000)
{
runTime = millis();
GXTRACE(GET_STR_FROM_EEPROM("Start reading"), NULL);
//TODO: Change logical name of the frame counter if it's used.
ret = com_readAllObjects(1.0..43.1.0.255);
Thanks for replying sir. Very nice responsive talking. I have added more register whose name is reg2,reg3,reg4 in given below code. what is this correct code or not because i am taking register value in same time and declare global variable char* data = NULL; So please brief explain how is storing reg1,reg2,reg3 and reg4 in data in same time? And please tell sir this code is correct or not in given below-
client.ino
int ret;
// Read the clock
gxClock clock1;
//Read the Register
gxRegister reg1;
gxRegister reg2;
gxRegister reg3;
gxRegister reg4;
if (millis() - runTime > 5000)
{
This is the correct way to do it. You aren't reading the values with the same request. You can use readList to read multiple values with one request, but all the meters don't support it.
Thanks for reply sir, Can you please suggest and give syntax me How can use readList to read multiple values in code?
And also brief tell sir if meter don't support it then what should be do for it?
Very thank you so much. Very nice talking and I am very happy that you are very helpful sir. Can you please tell how can read all value in com_readScalerAndUnits()? Please can you write a syntax to read all value in com_readScalerAndUnits().
Hi,
Hi,
The example reads the clock object. Find //Read clock.
It also prints date and time for the serial port using GXTRACE.
You need to add register objects in the same way as the clock object has been added.
The problem at the moment is that one of your settings is different than the meter expects.
Try to connect with GXDLMSDirector for your meter. It will help you to get a better idea of DLMS meters.
BR,
Mikko
Hi,
Hi,
Thanks sir for reply. My question is not that use gxtrace or com_AllObject. My question is that what should i write read value in gxtrace or com_retAllObject and How should i write read value in gxtrace.?
for example, Can i write syntax in void loop() in Arduindo in given below-
ret = gxtrace("1.0.99.1.0.255") or not? please tell me syntax to read value of register and clock in void loop()?
Thanks Sir,
Hi,
Hi,
gxtrace is send to write a trace. You don't use it for the communication. You can think that gxtrace equals Console.WriteLine. It's used to print the value, not for the communication.
Check this. It will read the date and time from the clock object and then write the content of the clock object for the meter.
//Read clock
gxClock clock1;
cosem_init(BASE(clock1), DLMS_OBJECT_TYPE_CLOCK, "0.0.1.0.0.255");
com_read(BASE(clock1), 3);
com_read(BASE(clock1), 2);
obj_toString(BASE(clock1), &data);
GXTRACE(GET_STR_FROM_EEPROM("Clock"), data);
obj_clear(BASE(clock1));
free(data);
BR,
Mikko
Hi,
Hi,
Thanks for replying sir, How can i read value of Register and Extended Register in void loop() function in Arduino? What is syntax of Register and Extended register in void loop() function?
Thanks sir
Hi,
Hi,
Add values that you want to read under the clock object. Something like this:
//Read register
gxRegister reg1;
cosem_init(BASE(reg1), DLMS_OBJECT_TYPE_REGISTER, "YOUR_OBIS_CODE");
com_read(BASE(reg1), 3);
com_read(BASE(reg1), 2);
obj_toString(BASE(reg1), &data);
GXTRACE(GET_STR_FROM_EEPROM("Register"), data);
obj_clear(BASE(reg1));
free(data);
BR,
Mikko
Hi,
Hi,
Thank you so much for replying sir . How can i find InvocationCounter for Secure Meter?
Please tell me about InvocationCounter for Secure meter? How can I find it and What is role of Invocation Counter in DLMS Meter?
Thank you sir
Hi,
Hi,
When you connect to the meter there should be an Invocation Counter data object. It's used to improve security, but all meters don't use it.
BR,
Mikko
Hi,
Hi,
I am very happy to hear for reply sir , thank you so much sir. If Some meter don't use Invocation Counter then What should i write in " ret = com_readAllObjects("0.0.43.1.0.255") " in the void loop()
Hi,
Hi,
Set it NULL if you don't want to use Invocation Counter.
com_readAllObjects(NULL);
BR,
Mikko
Hi,
Hi,
Thanks for replying sir. I have found new error in NodeMCU Board in Arduino IDE when clock and register define in void loop() function in given below. How can I solve this sir?
Arduino: 1.8.18 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Hi,
Hi,
You need to define data variable like this:
char* data = NULL;
BR,
Mikko
Hi,
Hi,
Thank you so much sir. It is working perfectly and i did make it Global Variable char* data = NULL;
I have some question now that if i want to read more values of Register for example reg2, reg3, reg4 and reg5 etc. So what will syntax be written in void loop() function for reg2,reg3,reg4 etc??
Hi,
Hi,
Check my answer:
https://www.gurux.fi/comment/25325#comment-25325
BR,
Mikko
Hi,
Hi,
Thanks for reply sir. I am receiving this error again after convert object to string function obj_toString() in void loop() function in arduino ide in given below. Where am i going wrong ? Please tell me real solution.
Hi,
Hi,
It's a little hard to say from your pics, but you need to set data to NULL after free.
free(data);
data = NULL;
BR,
Mikko
Hi,
Hi,
Thanks for replying sir. I am very happy that you are guiding well sir. I am attaching code of void loop() function of client.ino in given below - and please tell me this is Right or Wrong?
void loop()
{
int ret;
// Read the clock
gxClock clock1;
if (millis() - runTime > 5000)
{
runTime = millis();
GXTRACE(GET_STR_FROM_EEPROM("Start reading"), NULL);
//TODO: Change logical name of the frame counter if it's used.
ret = com_readAllObjects(1.0..43.1.0.255);
com_close();
}
}
Hi,
Hi,
It looks correct to me.
BR,
Mikko
Hi,
Hi,
Thanks for replying sir. Very nice responsive talking. I have added more register whose name is reg2,reg3,reg4 in given below code. what is this correct code or not because i am taking register value in same time and declare global variable char* data = NULL; So please brief explain how is storing reg1,reg2,reg3 and reg4 in data in same time? And please tell sir this code is correct or not in given below-
client.ino
int ret;
// Read the clock
gxClock clock1;
//Read the Register
gxRegister reg1;
gxRegister reg2;
gxRegister reg3;
gxRegister reg4;
if (millis() - runTime > 5000)
{
}
}
Hi,
Hi,
This is the correct way to do it. You aren't reading the values with the same request. You can use readList to read multiple values with one request, but all the meters don't support it.
BR,
Mikko
Hi,
Hi,
Thanks for reply sir, Can you please suggest and give syntax me How can use readList to read multiple values in code?
And also brief tell sir if meter don't support it then what should be do for it?
Hi,
Hi,
com_readScalerAndUnits do what you want to do.
https://github.com/Gurux/GuruxDLMS.c/blob/c65175efc8917f0ee3a7eb340ac4e…
If that is not supported then you need to read objects one by one as you do now.
BR,
Mikko
Hi,
Hi,
Very thank you so much. Very nice talking and I am very happy that you are very helpful sir. Can you please tell how can read all value in com_readScalerAndUnits()? Please can you write a syntax to read all value in com_readScalerAndUnits().
Hi,
Hi,
I believe that you don't want to read all values. It's taking a long time, but this does it.
https://github.com/Gurux/GuruxDLMS.c/blob/c65175efc8917f0ee3a7eb340ac4e…
BR,
Mikko
Hi,
Hi,
I believe that you don't want to read all values. It's taking a long time, but this does it.
https://github.com/Gurux/GuruxDLMS.c/blob/c65175efc8917f0ee3a7eb340ac4e…
BR,
Mikko
Hi, Thank you, But i am not…
Hi,
Thanks for helping but i didn,t get ouput. Sure, I will find.