Page 1 of 1

every minute script not working

Posted: Sunday 10 September 2017 10:23
by boguslaw
Any idea why this script is not called every minute ?

return {
active = true,
on = {
devices =
{
'Bojler','Bojler-godzina'
}
,
timer ='every minute'
},

execute = function(domoticz)
if domoticz.variables('BojlerON').value == 1 then
domoticz.notify('Bojler', 'BojlerON=1', domoticz.PRIORITY_HIGH,domoticz.SOUND_ALIEN,0,domoticz.NSS_PUSHBULLET)
if (domoticz.devices('Bojler').state == 'On' and domoticz.devices('Bojler').lastUpdate.minutesAgo > 3) then
domoticz.devices('Bojler').switchOff()
domoticz.log('Bojler >> timer OFF');
end
end
end
}

Re: every minute script not working

Posted: Sunday 10 September 2017 10:53
by boguslaw
Domoticz v 3.8153
dzVents is called properly on device or variable change but not timer based

Re: every minute script not working

Posted: Sunday 10 September 2017 11:27
by SweetPants
boguslaw wrote: Sunday 10 September 2017 10:53 Domoticz v 3.8153
dzVents is called properly on device or variable change but not timer based
When inserting code on the forum, can you please put it between code markers

Code: Select all

your code
more easy to read

Re: every minute script not working

Posted: Sunday 10 September 2017 12:12
by BakSeeDaa
boguslaw wrote: Sunday 10 September 2017 10:23 Any idea why this script is not called every minute ?

return {
active = true,
on = {
devices =
{
'Bojler','Bojler-godzina'
}
,
timer ='every minute'
},

execute = function(domoticz)
if domoticz.variables('BojlerON').value == 1 then
domoticz.notify('Bojler', 'BojlerON=1', domoticz.PRIORITY_HIGH,domoticz.SOUND_ALIEN,0,domoticz.NSS_PUSHBULLET)
if (domoticz.devices('Bojler').state == 'On' and domoticz.devices('Bojler').lastUpdate.minutesAgo > 3) then
domoticz.devices('Bojler').switchOff()
domoticz.log('Bojler >> timer OFF');
end
end
end
}
Well, timer should be a table.

Try this code:

Code: Select all

return {
	active = true,
	on = {
		devices = {
			'Bojler',
			'Bojler-godzina'
		},
		timer = {
			'every minute'
		}
	},
	execute = function(domoticz)
		domoticz.log('HEUREKA!', domoticz.LOG_FORCE)
		if domoticz.variables('BojlerON').value == 1 then
			domoticz.notify('Bojler', 'BojlerON=1', domoticz.PRIORITY_HIGH,domoticz.SOUND_ALIEN,0,domoticz.NSS_PUSHBULLET)
			if (domoticz.devices('Bojler').state == 'On' and domoticz.devices('Bojler').lastUpdate.minutesAgo > 3) then
				domoticz.devices('Bojler').switchOff()
				domoticz.log('Bojler >> timer OFF', domoticz.LOG_FORCE)
			end
		end
	end
}

Re: every minute script not working

Posted: Sunday 10 September 2017 13:03
by boguslaw
Thanks.It works now.