Disable push notification using virtual switch

Hi. Can anyone help?

I have 2 pieces of code (virtual switch & push notification) below and need to stitch them together.
The idea is to turn off push notifications if a virtual switch is set to ‘off’.
At the moment I’ve got the push notification code in the Luup Event section of the trigger and on it’s own works well.
So the questions are how do I merge the code and where does it go?
Thanks

run = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,#319)
if(run==“1”)then
return true
else
return false
end

local http = require(“socket.http”)
http.request{url = “http://www.homewave.dreamhosters.com/push/push.php?pushdevice=********************&message=Perimeter%20PIR%20Broken”}

You should read:
http://forum.micasaverde.com/index.php/topic,18679.0.html

You put it where you would return true

run = luup.variable_get("urn:upnp-org:serviceId:VSwitch1","Status",#319)
if(run=="1")then
  local http = require("socket.http")
  http.request{url = "http://www.homewave.dreamhosters.com/push/push.php?pushdevice=********************&message=Perimeter%20PIR%20Broken"}
  return true
else
  return false
end

Thanks for the reply. All sorted. Works and I’ve read the posts you advised.
Also, it made me check a bit more and just realised my error … I’d put a # before the Device ID.
Many thanks for the help.