Tripped Sensor Lua Code Help!!

I’m trying to get a PUSH Message to my iPhone when i get home.

I’ve installed the ping plugin and have set it up to respond to my iPhones ip address. This then trips the virtual sensor which now exists in my Vera 2 and works great. iPhone wifi on sensor tripped, iPhone wifi off sensor goes back to armed state.

I’ve the created a scene to respond to the virtual sensor and added the following lua code in the appropriate section of that scene


local lul_tmp = luup.variable_get(“urn:schemas-micasaverde-com:device:MotionSensor:1”,“Status”,30)

if (lul_tmp==“Tripped”) then



not sure if my uup.variable_get is correct?

i have other PUSH Messages sent to my phone for weather events so i know that part works

Any help will be greatly received. ( i’ve altered the push code so above is not mine or anyone else’s)



You need to use a URN with the :serviceId: in it, not :device:

It’s similar to the problem that was going on here (just with a different Device and Service being used)

From this list:

You want:

[ul][li]serviceId -> [tt]urn:micasaverde-com:serviceId:SecuritySensor1[/tt][/li]
[li]variable -> [tt]Tripped[/tt][/li][/ul]

Thanks guessed for your help, which has got me back on the right path.

Just having that well documented trouble with a Virtual Sensor, which is being Tripped but not triggering a scene!!!

Will keep at it and thanks again


I am also trying to use the ping sensor.
I have it working, but do not really see how to use it in an event.
I can schedule a 1 minute timer, this works good.
But I would like to have something to happen ‘immediately’; not having to verify every minute (that delay is too big).
When creating a new scene; the ‘ping sensor device’ is not listed in the device list when selecting to add an event.

Any advice = very welcome!!! )

Ok, managed to use it now in an event! No help needed anymore (for now) :stuck_out_tongue:

Hi pepebel4

How did you get the ping sensor to trigger a scene. It just won’t work for me!!!

I modifed the D_PingSensor.xml.
I added after the devicetype :


Adding this line enables the device to be selected when creating a scene.
Hope that works out for you too.
Tested this evening; works perfect! When I come home in the evening with my iPad; my home welcomes
me with turning on the lights:) Cheaper then a motion sensor (taken into account you already have an iphone/ipad :stuck_out_tongue: :stuck_out_tongue: )

Thanks a lot pepebel4 that extra line of code did the trick and the sensor is now triggering scenes.



This solution is now working.
Thanks for sharing this info


Can someone point me into the right direction. I really appropriate it.

I have create 2 ping sensors and 2 scenes. Ip adresses are stated to the computers at our office.

When the ping sensor is tripped ( this mean the computer is turn on) , a event is trigger and will enable the printers and heating at the office. This works really good.

Now I want a step further. When both pc’s are not used and turned off I want to shut even shut down the printers.

So would it be possible to create a luup code witch is checking both computers at the office of there are present at the network. When both are not present( i will amuse the are powered off ) then send a off command to the printers.

something like this :

-ping sensor 1 is not tripped AND -ping sensor 2 is not tripped
Then power off printers.

[sup]local lul_tmp = luup.variable_get(“urn:schemas-micasaverde-com:serviceId:MotionSensor:1”,“Status”,1)

if (lul_tmp==“Tripped”) then goto end

local lul_tmp = luup.variable_get(“urn:schemas-micasaverde-com:serviceId:MotionSensor:1”,“Status”,2)
if (lul_tmp==“Tripped”) then goto end
else “Power down printers”


Many thanks in advance

[sub]local lul_tmp = luup.variable_get(“urn:schemas-micasaverde-com:serviceId:MotionSensor:1”,“Status”,1)

if (lul_tmp==“Tripped”)
local lul_tmp = luup.variable_get(“urn:schemas-micasaverde-com:serviceId:MotionSensor:1”,“Status”,2)

	if (lul_tmp=="Tripped") 
		luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },7)


IS this correct …?
Regards Marco

See my post above, and check the exact ServiceId used. It’s important. :wink:

Hi Guessed,

Thanks for the very quick response.

See picture , i suppose the ServiceID would be the Id nr…?
correct ?


That’s a Device Type, not a Service Id. A device has one Device Type, but can have (implement) multiple Serviced Id’s.

You’ll want to read my post 2nd from the top, it lists the exact Service Id to use.

Hi Guessed,

Can you help me please into the right direction.
I have read you’re post ( before you pointed me) and i don’t get this.

Normally when you have a device , the have a 1 device type and 1 service ID

What I suspect would be something like this :
[sub]local lul_tmp = luup.variable_get(“urn:schemas-micasaverde-com:serviceId:MotionSensor1”,“Status”,62)[/sub]


Normally, yes, but that’s a degenerate case. Imagine a remote-controlled power board, with three individually-controllable appliance switches in it. One device, three on-off services. Each service would have a “Status” variable, so how would your program get the status of switch #3?

The way it’s done is that each switch has its own Service ID. Same Service type, different Service ID:

  • Switch 1: Service type urn:schemas-upnp-org:service:SwitchPower:1, Service ID urn:upnp-org:serviceId:SwitchPower1
  • Switch 2: Service type urn:schemas-upnp-org:service:SwitchPower:1, Service ID urn:upnp-org:serviceId:SwitchPower2
  • Switch 3: Service type urn:schemas-upnp-org:service:SwitchPower:1, Service ID urn:upnp-org:serviceId:SwitchPower3

That’s why you need to provide the Service ID of the variable that you’re interested in. If you like, you can think of the ServiceID and VariableName as a two-part primary key. Both are needed to get or set a variable uniquely.

Go back to the Advanced tab in UI4 and hover the mouse pointer over the variable name (“Status”). Up pops some hover text. That’s the service ID, and it’s needed to query or set that variable’s value.

Hi Fuzzle,

That make sense to me , so this is a little step further.

Only looking for the “hover text” and there is nothing pops up within a text in the advance screen.
(see picture).

Can you help me with direction i must take a look …?

Many thanks in advance

[quote=“mversluis, post:17, topic:167050”]Only looking for the “hover text” and there is nothing pops up within a text in the advance screen.
(see picture).[/quote]

Scroll to the bottom where the true Luup variables are. Put the mouse pointer right on top of one of the words on the left.

This may be browser-dependent; I am using Firefox 3.6.

Oke found,

Thanks for pointed me that way. [sub]( Its a little mess code , there are 3 or 4 different serviceid used for the pingsensor)[/sub]
I will need to have the Tripped variable and that will use SecuritySensor1

Other question , to check of I will get the way of work :

[System variable] [serviceId] [status],[Device id]
local lul_tmp = luup.variable_get(“urn:schemas-micasaverde-com:serviceId:SecuritySensor1”,“Tripped”,62)

Is This correct :

Tripped return a value with the current state of te device.
with error levels can those have :
0 = sensor not tripped
1= sensor Tripped

Am I correct …?

What about “Status” , with values will be return by that funtion ?
What about “Armed” , with value will be return by that …?

Many thanks in advance

For ‘Armed’ see and

‘Status’ for switches: 0 or 1

‘Status’ for locks: ?