.countertoday in dzvents

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

Moderator: leecollings

Post Reply
Andyyyy
Posts: 29
Joined: Saturday 13 July 2013 23:46
Target OS: -
Domoticz version:
Contact:

.countertoday in dzvents

Post 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 553 times
json.jpg
json.jpg (68.13 KiB) Viewed 553 times
Log.jpg
Log.jpg (34.17 KiB) Viewed 553 times
Does someone know where the bug is ?
User avatar
waltervl
Posts: 6683
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: .countertoday in dzvents

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Andyyyy
Posts: 29
Joined: Saturday 13 July 2013 23:46
Target OS: -
Domoticz version:
Contact:

Re: .countertoday in dzvents

Post 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
         }
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest