Error: GetJSonDevices: exception occurred : 'stoll'

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
akamming
Posts: 343
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Error: GetJSonDevices: exception occurred : 'stoll'

Post 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?
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

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

Post 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
Quality outlives Quantity!
akamming
Posts: 343
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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?
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

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

Post 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
Quality outlives Quantity!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests