Page 1 of 1

dzVents noob question

Posted: Friday 11 January 2019 16:42
by freijn
Guys,

I am trying to step in the wonderfull world of dzVents and doing my first baby steps..

If I open de script editor the get the following example. Saving and activate for "device" don't do anyting.
I have changed the 'myDevice' into 'spare_grey' which is a test switch I play with. Nothing again.

Can you please help me understand what is the on = function for? ( I do see it with 1 min timer and understand it )
The goal is to have something happening ( a log entry in this case ) on a status change of my spare_grey switch.

next level question. same event but now for a text device.

Any help is welcome ! THanks Frank

Code: Select all

return {
	on = {
		devices = {
			'myDevice'
		}
	},
	execute = function(domoticz, device)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
	end
}

Re: dzVents noob question

Posted: Friday 11 January 2019 17:59
by waaren
freijn wrote: Friday 11 January 2019 16:42 If I open de script editor the get the following example. Saving and activate for "device" don't do anyting.
I have changed the 'myDevice' into 'spare_grey' which is a test switch I play with. Nothing again.
The script looks ok. Try with changing LOG_INFO to LOG_FORCE. If you switch the 'myDevice' switch to On or Off you should see a message in the log like

Code: Select all

2019-01-11 17:38:58.197 Status: dzVents: !Info: Device myDevice was changed
Can you please help me understand what is the on = function for? ( I do see it with 1 min timer and understand it )
The goal is to have something happening ( a log entry in this case ) on a status change of my spare_grey switch.
As described here
  • on = { ... }
    The on section tells dzVents when the execute function has to be executed. It holds all the events/triggers that are monitored by dzVents. If any of the events or triggers match with the current event coming from Domoticz, then the execute part of the script is executed by dzVents.
next level question. same event but now for a text device.
Nope. domoticz does not trigger an event for a text device.

Re: dzVents noob question

Posted: Friday 11 January 2019 21:32
by freijn
Many thanks for the fast response !