Page 1 of 1

suggestion for .checkFirst()

Posted: Wednesday 14 February 2018 16:52
by emme
ciao,

I was wodering if a possible change can be made to the checkFirst function in dzVents:

could the function include a log message in case of activation? (so the syntax would be .checkFirst(logMessage of operation is performed)
if no argument is given then it runs as usual

example:

Code: Select all

if dz.devices(myDev).state == 'Off' then
   dz.devices(myDev).switchOn()
   dz.log('Hey!... I\'m ON!!')
end

can be turned to:

Code: Select all

dz.devices(myDev).switchOn().checkFirst('Hey!... I\'m ON!!')
could it be a good idea? :P:P
ciao
M

Re: suggestion for .checkFirst()

Posted: Wednesday 14 February 2018 17:16
by bigpea
I like it..

Re: suggestion for .checkFirst()

Posted: Wednesday 14 February 2018 17:41
by guantolento
very good ...

Re: suggestion for .checkFirst()

Posted: Wednesday 14 February 2018 17:59
by dioniso
:o Mind blow!

Re: suggestion for .checkFirst()

Posted: Wednesday 14 February 2018 19:10
by dannybloe
But what if you want a message when it is NOT switching? Then you need two options. Isn’t it just for debugging purposes? If so I could also log debug info so you can put logging in debug mode

Re: suggestion for .checkFirst()

Posted: Wednesday 14 February 2018 21:17
by emme
mmmh that's nice either....
a .checkFirst(log true, log false, LOG_INFO) maybe?

I did not think about a 'not triggered' log but it is helpful indeed.

My intention was not only for debug issue but also for notification (of course we cannot add a lot of option in that function :P :P)
it looks very nice!!! :D