every minute script not working

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

Moderator: leecollings

Post Reply
boguslaw
Posts: 4
Joined: Tuesday 17 January 2017 11:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

every minute script not working

Post 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
}
boguslaw
Posts: 4
Joined: Tuesday 17 January 2017 11:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: every minute script not working

Post by boguslaw »

Domoticz v 3.8153
dzVents is called properly on device or variable change but not timer based
SweetPants

Re: every minute script not working

Post 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
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: every minute script not working

Post 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
}
boguslaw
Posts: 4
Joined: Tuesday 17 January 2017 11:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: every minute script not working

Post by boguslaw »

Thanks.It works now.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest