Page 1 of 1

Error: GetJSonDevices: exception occurred : 'stoll'

Posted: Tuesday 10 December 2024 12:08
by akamming
Hi,

since a few months my domoticz is less stable. Every now and then it just stops working. Also not crashing, so no specific errors to look for.

The only hint i have is that around the same time when this started occuring, i also occasionally get a the following error in the logging

Code: Select all

Error: GetJSonDevices: exception occurred : 'stoll'
So there might be a relation, so i want to fix this error.

The error occurs about 10-12 times a day. It seems to be related to updating devices from dzVents or Python, cause it happens mostly around
- a p1 meter update (which triggers a dzvents script to do some caluclations and updates virtual energy counters)
- My volvo plugin heartbeat which updates several sensors

I found this info
- https://github.com/domoticz/domoticz/issues/6083
- viewtopic.php?t=40407

which both also indicate the error has something to do with updating devices from scripts (yep seems to be the case) and empty sValues for the devices. I checked all sValues, but cannot see where it goes wrong.

Is there some way to get more logging on exactly which device update the Stoll exception error was found?

Re: Error: GetJSonDevices: exception occurred : 'stoll'

Posted: Tuesday 10 December 2024 17:42
by gizmocuz
It means that we expect a number value, and it is not a number or a string

Looking at the code inside the function (GetJSonDevices), you can see where 'stoll' is called

For example for:

pTypeRFXMeter
sTypeCounterIncremental

And that is basically it.

So now you can search the reason what is making your Domoticz not so stable... And in 99% of the cases it is indeed caused by a plugin, or a script that does not set the correct values

For both device types above, have a look at the Value in the Meter table, something is not correct here

Re: Error: GetJSonDevices: exception occurred : 'stoll'

Posted: Friday 13 December 2024 12:52
by akamming
it's difficult to troubleshoot.

Cause when i look at all the svalues for the devices in the meter update are numbers (as strings)

Theses scripts run a lot (e.g. my p1 meter reports every 10 seconds. So the actual energy consumption is also updates every 10 seconds) and i only get this error once or twice a day. (basically every 10 seconds it updates a counter with <P1 delivered by the net> + <Delivered by solared panels> - <delivered back to the net>)

But the stoll exception only happens once or twice a day. So probably when i'm looking the error is not there, cause it only occurs a few times per day

I already added a lot of dzvents debug logging and can confirm there are no weird svalues as far as i can see in this extra logging.

Any other hints how to troubleshoot?

Re: Error: GetJSonDevices: exception occurred : 'stoll'

Posted: Saturday 14 December 2024 8:01
by gizmocuz
I added some logging (and catching the error) in beta 16360

Code: Select all

							if (sd2[0].empty())
							{
								_log.Log(LOG_ERROR, "Empty Value in Meter table for device idx: '%q'", sd[0].c_str());
								continue;
							}
							if (!is_number(sValue))
							{
								_log.Log(LOG_ERROR, "Invalid Number sValue: '%q' for device idx: '%q'", sValue.c_str(), sd[0].c_str());
								continue;
							}
							if (!is_number(sd2[0]))
							{
								_log.Log(LOG_ERROR, "Invalid Number value: '%q' for device idx: '%q'", sd2[0].c_str(), sd[0].c_str());
								continue;
							}
So, please watch for these errors.

As you know from which device types they are, you should also know who is updating these devices.
It's not the native code of Domoticz, so it must be a plugin/script/event that does this, and it is not doing a correct job at this
Hope this helps