We have moved at community.getvera.com

Author Topic: UI7, can't find Luup scene code I know is executing  (Read 399 times)

Offline rlmalisz

  • Sr. Member
  • ****
  • Posts: 400
  • Karma: +1/-0
UI7, can't find Luup scene code I know is executing
« on: March 06, 2019, 07:37:28 pm »
I have a simple pair of scenes set up to control the light in our laundry room.  They're triggered by motion detect and motion stopped events from one of the newer Fibaro eyeball 3-in-1 guys.  I was having tons of trouble getting reliable responses so I added some extra Luup code to send me Prowl alerts about the scenes firing.  It now seems that a lot of the flakiness I was seeing was due to a very crappy 123 battery that came with the sensor.  I've replaced it with a shiny new Duracell, and everything seems to work.  Has been quite reliable since the battery swap.

So I was going to go into the scenes and delete (or comment out) the Prowl alerts.  For the "motion detect", there needn't be any remaining Luup, as what we want to have happen on detect is to set the light on at 100%.  For the "stopped" scene, I have it checking to see if the light is on at all...if so, dim to 10%, if not, leave well enough alone.  This is so when one of us leaves the laundry room and turns off the light as we leave, it doesn't get turned back on to 10% a couple minutes later when the motion timing lapses.  That code is clearly working.  And I am getting the Prowl alerts.

When I go into the scenes to edit them, both say "No Luup Code Defined".   Interestingly, Vera has added a second action for the "no motion" scene to arm the motion detection on the eyeball.  That hurts nothing, but seems sort of pointless in a scene that's only triggered when the eyeball is armed and detects motion.  But the thing that is boggling my mind is trying to figure out where the Luup code for both of these scenes went.  They're the only scenes on the V+, which has exactly two devices: the eyeball and the light switch.  Any clues about where to look would be much appreciated.  I guess I could delete the scenes and rebuild them, and that may be what it takes.  But would prefer to understand where this code that's obviously executing is hiding, and fix it.

--Richard

Offline rlmalisz

  • Sr. Member
  • ****
  • Posts: 400
  • Karma: +1/-0
Re: UI7, can't find Luup scene code I know is executing
« Reply #1 on: March 06, 2019, 07:57:43 pm »
I have a simple pair of scenes set up to control the light in our laundry room.  They're triggered by motion detect and motion stopped events from one of the newer Fibaro eyeball 3-in-1 guys.  I was having tons of trouble getting reliable responses so I added some extra Luup code to send me Prowl alerts about the scenes firing.  It now seems that a lot of the flakiness I was seeing was due to a very crappy 123 battery that came with the sensor.  I've replaced it with a shiny new Duracell, and everything seems to work.  Has been quite reliable since the battery swap.

So I was going to go into the scenes and delete (or comment out) the Prowl alerts.  For the "motion detect", there needn't be any remaining Luup, as what we want to have happen on detect is to set the light on at 100%.  For the "stopped" scene, I have it checking to see if the light is on at all...if so, dim to 10%, if not, leave well enough alone.  This is so when one of us leaves the laundry room and turns off the light as we leave, it doesn't get turned back on to 10% a couple minutes later when the motion timing lapses.  That code is clearly working.  And I am getting the Prowl alerts.

When I go into the scenes to edit them, both say "No Luup Code Defined".   Interestingly, Vera has added a second action for the "no motion" scene to arm the motion detection on the eyeball.  That hurts nothing, but seems sort of pointless in a scene that's only triggered when the eyeball is armed and detects motion.  But the thing that is boggling my mind is trying to figure out where the Luup code for both of these scenes went.  They're the only scenes on the V+, which has exactly two devices: the eyeball and the light switch.  Any clues about where to look would be much appreciated.  I guess I could delete the scenes and rebuild them, and that may be what it takes.  But would prefer to understand where this code that's obviously executing is hiding, and fix it.

--Richard

DOH.  I had put the code in as Luup triggers.  Realized after I had deleted the scenes and started rebuilding them.  My lack of experience with UI7 shows up again.  Sigh.

Offline rlmalisz

  • Sr. Member
  • ****
  • Posts: 400
  • Karma: +1/-0
Re: UI7, can't find Luup scene code I know is executing
« Reply #2 on: March 06, 2019, 08:17:14 pm »
So now I am rebuilding the Luup trigger for the motion stopped scene.  I have the following in the Luup trigger:

local lightOnOff = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 3)
if(lightOnOff == "0")then
  return false
else
  return true
end

The scene continues execution both when device 3 (the laundry room light) is on or off.  I would expect it to bail out if "lightOnOff" comes back as "0".  I remember (vaguely) struggling to find the right trigger syntax for this.  Am I doing something obvious wrong?

--Richard