Page 1 of 1

Event triggers - confused

Posted: Friday 07 October 2016 16:20
by rbeyers
Hi guys

I recently discovered this great tool! Many congratulations to all the makers.

I'm confused about making blockly events though. I'm just playing around a little bit and I found that when I create a blockly, for example:

if outsidetemperature > 15
send mail

or

if lightswitch = on
send mail

it will keep sending mails every 30secs or so, as long as the condition is met. Is this normal? I would expect to only send it one time, when the condition was not met before, but is met now.

I know I can bypass this by creating a local variable that will store the previous value, but this is more work.

Is there an easier way?

Re: Event triggers - confused

Posted: Friday 07 October 2016 16:42
by emme
You can choose to use the NOTIFICATION option on each device to trigger the event (you would need a bash script to do that) instead of use Blocky or LUA

OR.....
you can use a global variable (naming it LightSwitchNotify for example) and evaluate it in the script:

If lightswitch = ON and variable LightSwitchNotify = 0
send mail
LightSwitchNotify = 1
elseIf lightswitch = OFF and variable LightSwitchNotify = 1
set variabe LightSwitchNotify = 0