Page 1 of 1

Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Thursday 25 November 2021 13:25
by jasjuh
Hello Users,

I have a bug which I am unable to fix in domoticz.
In the virtual sensor department I have created a standard counter.
Under the report functionality it is showing NaN and a question mark instead of the units.
img1.JPG
img1.JPG (53.76 KiB) Viewed 1050 times
I have tried to update the counter using DsVents and Lua, but in both options the result is the same.

The log functionality itself is operating without any troubles.
img2.JPG
img2.JPG (83.81 KiB) Viewed 1050 times
DSVents commando's to update the counter with a user variable:

local CounterToUpdate = domoticz.devices('TestCounter')
vDeviceWaarde = tonumber(domoticz.variables('Stiebel_Bedrijfsuren').value)
CounterToUpdate.updateCounter(vDeviceWaarde)

What should I do to repair this issue? Hope you guy's could help me.

Br,

Re: Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Thursday 25 November 2021 13:35
by waltervl
What do you expected to see?
You have to sent every day or hour or 5 minutes or pick your time schedule the value vDeviceWaarde to the counter. Than you get a overview of counter values per day/week/month/year etc.
The vDeviceWaarde (bedrijfsuren) should rise during time. Unless the device is not used ;)
Now you have only send 1 time a value. That is not what this counter is designed for that is why it behaves differently.
And the first time you start with a big value because you start with 4206 hrs. That will show differently as time will go by.

So next time you send for example
day 2 value 4207
day 3 value 4210
day 4 value 4220
day 5 value 4224
etc
And you will see in Domoticz usage
day 1 usage 1
day 2 usage 3
day 4 usage 10
day 5 usage 4
etc

Re: Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Thursday 25 November 2021 14:00
by waltervl
Additional:
Make a screenshot of your device when clicked on Edit button.
You have to fill in something with Value Units, eg "hours".
https://www.domoticz.com/wiki/Dummy_for ... es#Counter

Re: Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Thursday 25 November 2021 14:09
by jasjuh
Hi Waltervl,

The counter itself is working fine. Under the log functionality you can see them updating every hour/day etc etc. No problem at all.
The problem is visible when you press the report button and see monthly/yearly values. Then the counter value suddenly has 3 decimals, NaN (Not a number) values, and a ? (Question mark), instead of the units you have defined in the edit menu.
It seems not to recognise the total counter value, cause total usage is yearly summed up.
img3.JPG
img3.JPG (66.53 KiB) Viewed 1040 times
img4.JPG
img4.JPG (44.17 KiB) Viewed 1040 times

Re: Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Thursday 25 November 2021 16:42
by waltervl
Yes, I can reproduce that behavior on my test system.
The question marks also show up on when setting the counter to energy, gas or water. So its seems a bug.

Re: Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Thursday 25 November 2021 17:33
by waltervl
mentioned it in an already running github issue https://github.com/domoticz/domoticz/is ... -979329160

Re: Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Monday 10 January 2022 20:15
by waltervl
New issue created so it can be better tracked: https://github.com/domoticz/domoticz/issues/5101

Re: Virtual Counter missing Units and showing NaN (Not a number) at count value

Posted: Monday 14 February 2022 17:09
by waltervl
Issue is solved, a proper report for this Counter type is available in beta build 14188 (after clearing your cache!)