Page 1 of 1

.countertoday in dzvents

Posted: Monday 16 May 2022 13:31
by Andyyyy
Hi !

I want to use "x.counterToday" in dzvents to display the actual daily runtime of a device in an external system.

Code: Select all

return {
	on = {
		timer = {
			'every minute',	
			
		}
	    },
		logging = {
        level = domoticz.LOG_INFO,
        marker = "TMR"
	},
	execute = function(domoticz, timer)
		domoticz.log('CL dosierung (TMR): '..domoticz.devices('$Pool CL dosierung (TMR)').counterToday, domoticz.LOG_INFO)

    end
}


In the Webinterface and the Json output display the Value "0" but dzvents diplays the last value from yesterday until a new value is set.
counter.jpg
counter.jpg (23.02 KiB) Viewed 556 times
json.jpg
json.jpg (68.13 KiB) Viewed 556 times
Log.jpg
Log.jpg (34.17 KiB) Viewed 556 times
Does someone know where the bug is ?

Re: .countertoday in dzvents

Posted: Monday 16 May 2022 13:58
by waltervl
I can confirm that behavior. I have two counters (solarpanel generation) that I summarize in a total counter. And I see that one of these solarpanel counters is reset only when a new value is written to the counter, normally the next morning after sunrise. The other counter is reset at midnight. probably by the plugin that is controlling it.

Re: .countertoday in dzvents

Posted: Tuesday 17 May 2022 6:20
by Andyyyy
Now i have a solution that work for me. Simply set the counter with the actual value once at the beginning of the day,

Code: Select all

return {
	on = {
		timer = {
				'at 00:01',	
			    }
	        },
	execute = function(domoticz, timer)
	domoticz.devices('$Pool CL dosierung (TMR)').updateCounter(domoticz.devices('$Pool CL dosierung (TMR)').counter)
        end
         }