Strange numbers

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Strange numbers

Post by Knibor »

Hi,

I have 2 virtual counters, number 1 "stroom totaal verbruik" with IDX 74 and number 2 "stroom totaal levering" with IDX 75

I use the dzVents code:

Code: Select all

--[[ 
	Combinetest (dzVents 2.4.1)
 ]]--
 
return {
	on = { timer = { "every minute at daytime" , "every minutes at nighttime" } },

	execute = function(domoticz, _)
		domoticz.devices(78).updateCounter( 1000 * ( domoticz.devices(75).counter - domoticz.devices(74).counter ) )
	end	
}
But the output virtual counter "Stroom totaal" with IDX 78 gifs me strange numbers?
What to do to get it correct?
Attachments
Schermafbeelding 2019-01-26 om 12.01.08.png
Schermafbeelding 2019-01-26 om 12.01.08.png (192.99 KiB) Viewed 397 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Strange numbers

Post by waaren »

Knibor wrote: Saturday 26 January 2019 12:12 But the output virtual counter "Stroom totaal" with IDX 78 gifs me strange numbers?
What to do to get it correct?
Your "levering" is more then "verbruik" that makes that the outcome of calculation is negative and the device type you picked for "totaal" is not designed to receive negative values (it uses unsigned integer)
If you switch to device type managed counter you can display negative values. But dzVents needs a (minor) update to be able to handle this type.
I will send you an updated device-adapter to test via PM and if OK I will create a PR for it.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Strange numbers

Post by Knibor »

Hi,

Thanks for the information, I will try the device adapter and it is OK to create PR for it.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest