-
Notifications
You must be signed in to change notification settings - Fork 4
Fun Runner
Ulf edited this page Aug 6, 2014
·
12 revisions
Rule :
The following rule will switch on a light and after 20 seconds, the light will switched off.
fun(Pid, Name, Body) ->
case Body of
"off" -> ok;
"on" -> sensor:send([], Name, {"Licht","11111 2","1"}),
sensor:send_after(Pid, Name, 20000, [], {"Licht","11111 2","0"});
_ -> ok
end
end.When we get an motion detected signal, then we will inform the alarm thing to play a sound.
fun(Pid, Name, Body) ->
case Body of
"on" -> sensor:send([], Name, "on"),
sensor:send([], Name, [{to,"ua@innoq.com"}, {subject,"Alarm"}, {content, "somebody is in your house!"}]);
_ -> ok
end
end.```