Error on a dummy General kWh meter

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
Kedi
Posts: 595
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Error on a dummy General kWh meter

Post by Kedi »

I got this error:

Code: Select all

2025-11-30 10:15:00.527 Error: UpdateMeter: Error converting sValue/sUsage! (IDX: 1973, sValue: 'nan', sUsage: '55210', dType: 243, sType: 29)
Any idea how to resolve the 'nan' error?
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Error on a dummy General kWh meter

Post by FireWizard »

Hello @Kedi,

'nan' means Not a Number. Your dummy kWh meter expects a number value, written as a string, e.g. "123" and obviously receives something else. I don't know how you populatie your variable, but check your source.

Regards
Kedi
Posts: 595
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Error on a dummy General kWh meter

Post by Kedi »

I use node-red to populate the values.
I now made some provisions in node-red to catch the 'nan' so the domoticz database does not get the 'nan's anymore.
I had to go into deleting and editing records directly into the Domoticz database, so it is working again.
But Domoticz should be self-healing for those errors if data after the nan is correct, but it does not.
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Error on a dummy General kWh meter

Post by FireWizard »

Hello @Kedi,

You said:
But Domoticz should be self-healing for those errors if data after the nan is correct, but it does not.
The General kWh sensor requires two values:
1. The power usage in W(att)
2. The cumulative energy in Wh (but will be shown in kWh)
These two values are separated by a semicolon (;) and send as a svalue. So as a string.

How could Domoticz restore or repair an invalid value, send by an external application, even if the other value is valid?
I.m.o it is the responsibility of the transmitting party to check that valid data will be sent.

Regards
Kedi
Posts: 595
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Error on a dummy General kWh meter

Post by Kedi »

Node-red had some time sending 'nan' as a value.
That is transfered to Domoticz, hence the errors.
I fixed the 'nan' transfer to nothing being send to Domoticz.
I also fixed the source of the nan's so Node-red is sending valid values again.
But Domoticz still would refuse to take the valid values as valid, because the 'nan' was still in the database
and was not overwritten by the valid values Node-red was already sending.
With 'self-healing' I ment that Domoticz should accept the valid values again, which it did not.
I had to go into the Domoticz database and fix it there.
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Error on a dummy General kWh meter

Post by FireWizard »

Hello @Kedi.

I do not know, if Domoticz checks for NaN and, if so, how Domoticz checks.

Keep in mind, that (as said earlier) in JavaScript, NaN is short for "Not-a-Number", but in JavaScript, NaN is a number that is not a legal number.
This is quite confusing and so be careful on how to check for NaN.

You cannot use the typeof operator in JavaScript to check for NaN, but you have to use the isNaN() method.
The isNaN() method returns true if a value is NaN.

For more info: https://www.w3schools.com/jsref/jsref_isnan.asp

Regards
User avatar
habahabahaba
Posts: 266
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Error on a dummy General kWh meter

Post by habahabahaba »

We discussed such problem HERE

@Kedi, may be your version of Domoticz is older than 2024 ?
Kedi
Posts: 595
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Error on a dummy General kWh meter

Post by Kedi »

My version is: Version: 2025.1 (build 16657) So a little over half a year old, so should be fine.
I now use this to catch a NaN or the string 'nan' (because 'nan' was in the database).

Code: Select all

if (isNaN(msg.payload) || msg.payload == 'nan') {
    node.warn(msg.payload);
    return;
} else {.....
Data is comming from a P1P2 device from a Daikin heatpump. I never had the NaN's before, watched the node.warn for a while but it never came back. I had this issue twice now, hopefully no more.
Logic will get you from A to B. Imagination will take you everywhere.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], heggink and 1 guest