Author Topic: Motion sensor to trigger a scene?  (Read 2559 times)

Offline computerScience

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Motion sensor to trigger a scene?
« on: September 11, 2011, 12:34:12 am »
Hi,
I've been searching for triggering a scene when a motion sensor is tripped.
It sounds as a very easy task but I can't find any information. May someone please advice me how to do?

Offline computerScience

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Re: Motion sensor to trigger a scene?
« Reply #1 on: September 11, 2011, 04:11:05 am »
I came across this code that I've put in a scene:
Code: [Select]
local sIsTripped1=luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",5)


if (sIsTripped1=="1") then
   luup.inet.wget("https://prowl.weks.net/publicapi/add?apikey=private&application=Vera&event=testaaa2")
   return false
end
Which will send me a notification if motion sensor is tripped. But as of now this only work when I press run scene and the motion sensor is tripped which is kinda useless. I want the tripped sensor to trigger the wget command.

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3258
  • Karma: +191/-9
Re: Motion sensor to trigger a scene?
« Reply #2 on: September 11, 2011, 07:29:48 am »
How much digging have you done on the Events tab of the scene?  Have you tried to add an event?

Edit: For those finding this thread later on while searching, apparently UI5 will call Events "Triggers".
« Last Edit: September 11, 2011, 07:59:13 am by futzle »

Offline computerScience

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Re: Motion sensor to trigger a scene?
« Reply #3 on: September 11, 2011, 07:48:57 am »
Thanks! I knew it would be this easy :)

Offline Intrepid

  • Hero Member
  • *****
  • Posts: 536
  • Karma: +4/-0
Re: Motion sensor to trigger a scene?
« Reply #4 on: September 11, 2011, 08:14:46 am »
FYI, you can set up multiple events in one scene.  These are OR triggers, in that ANY of the events in a scene will trigger it.

In order to do an AND conditional where multiple things happen or are in a certain state, you'll need to apply luup code.  Example, motion ON and it's night.  All doors closed.  And so on. 

The event GUI only handle OR situations.


Offline computerScience

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Re: Motion sensor to trigger a scene?
« Reply #5 on: September 11, 2011, 08:58:14 am »
Ok, thanks for the information!

Does anyone know how I can create a device that keeps variables that are changable from luup?

I've tried to create a device Description: "System"and left all other fields empty.
Then I created a Variable: Service: "SystemDevice1", variable: "Mode", value: "out"

And I am trying to change this variable from luup code with no great success:
luup.variable_set("SystemDevice1", "Mode", "home", 28)

What am I doing wrong here?